@theia/debug 1.65.0-next.6 → 1.65.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/lib/browser/console/debug-console-items.d.ts.map +1 -1
  2. package/lib/browser/console/debug-console-items.js +34 -20
  3. package/lib/browser/console/debug-console-items.js.map +1 -1
  4. package/lib/browser/debug-configuration-manager.d.ts +2 -2
  5. package/lib/browser/debug-configuration-manager.d.ts.map +1 -1
  6. package/lib/browser/debug-configuration-manager.js +8 -9
  7. package/lib/browser/debug-configuration-manager.js.map +1 -1
  8. package/lib/browser/debug-configuration-model.d.ts +1 -1
  9. package/lib/browser/debug-configuration-model.d.ts.map +1 -1
  10. package/lib/browser/debug-configuration-model.js.map +1 -1
  11. package/lib/browser/debug-frontend-application-contribution.d.ts +17 -3
  12. package/lib/browser/debug-frontend-application-contribution.d.ts.map +1 -1
  13. package/lib/browser/debug-frontend-application-contribution.js +208 -44
  14. package/lib/browser/debug-frontend-application-contribution.js.map +1 -1
  15. package/lib/browser/debug-frontend-module.js +2 -2
  16. package/lib/browser/debug-frontend-module.js.map +1 -1
  17. package/lib/browser/debug-prefix-configuration.d.ts +1 -1
  18. package/lib/browser/debug-prefix-configuration.d.ts.map +1 -1
  19. package/lib/browser/debug-prefix-configuration.js +3 -2
  20. package/lib/browser/debug-prefix-configuration.js.map +1 -1
  21. package/lib/browser/debug-schema-updater.d.ts +0 -1
  22. package/lib/browser/debug-schema-updater.d.ts.map +1 -1
  23. package/lib/browser/debug-schema-updater.js +5 -5
  24. package/lib/browser/debug-schema-updater.js.map +1 -1
  25. package/lib/browser/debug-session-contribution.d.ts +1 -1
  26. package/lib/browser/debug-session-contribution.d.ts.map +1 -1
  27. package/lib/browser/debug-session-contribution.js +1 -1
  28. package/lib/browser/debug-session-contribution.js.map +1 -1
  29. package/lib/browser/debug-session-manager.d.ts.map +1 -1
  30. package/lib/browser/debug-session-manager.js +14 -8
  31. package/lib/browser/debug-session-manager.js.map +1 -1
  32. package/lib/browser/debug-session.d.ts +8 -0
  33. package/lib/browser/debug-session.d.ts.map +1 -1
  34. package/lib/browser/debug-session.js +13 -3
  35. package/lib/browser/debug-session.js.map +1 -1
  36. package/lib/browser/disassembly-view/disassembly-view-contribution.js +1 -1
  37. package/lib/browser/disassembly-view/disassembly-view-contribution.js.map +1 -1
  38. package/lib/browser/disassembly-view/disassembly-view-widget.d.ts +2 -2
  39. package/lib/browser/disassembly-view/disassembly-view-widget.d.ts.map +1 -1
  40. package/lib/browser/disassembly-view/disassembly-view-widget.js +3 -3
  41. package/lib/browser/disassembly-view/disassembly-view-widget.js.map +1 -1
  42. package/lib/browser/editor/debug-editor-model.d.ts.map +1 -1
  43. package/lib/browser/editor/debug-editor-model.js +16 -10
  44. package/lib/browser/editor/debug-editor-model.js.map +1 -1
  45. package/lib/browser/editor/debug-inline-value-decorator.d.ts +1 -1
  46. package/lib/browser/editor/debug-inline-value-decorator.d.ts.map +1 -1
  47. package/lib/browser/editor/debug-inline-value-decorator.js +1 -1
  48. package/lib/browser/editor/debug-inline-value-decorator.js.map +1 -1
  49. package/lib/browser/model/debug-breakpoint.d.ts.map +1 -1
  50. package/lib/browser/model/debug-breakpoint.js +3 -2
  51. package/lib/browser/model/debug-breakpoint.js.map +1 -1
  52. package/lib/browser/model/debug-instruction-breakpoint.js +1 -1
  53. package/lib/browser/model/debug-instruction-breakpoint.js.map +1 -1
  54. package/lib/browser/model/debug-source-breakpoint.d.ts.map +1 -1
  55. package/lib/browser/model/debug-source-breakpoint.js +10 -9
  56. package/lib/browser/model/debug-source-breakpoint.js.map +1 -1
  57. package/lib/browser/model/debug-thread.js +1 -1
  58. package/lib/browser/model/debug-thread.js.map +1 -1
  59. package/lib/browser/view/debug-stack-frames-source.d.ts.map +1 -1
  60. package/lib/browser/view/debug-stack-frames-source.js +2 -1
  61. package/lib/browser/view/debug-stack-frames-source.js.map +1 -1
  62. package/lib/browser/view/debug-view-model.d.ts.map +1 -1
  63. package/lib/browser/view/debug-view-model.js +1 -1
  64. package/lib/browser/view/debug-view-model.js.map +1 -1
  65. package/lib/{browser → common}/debug-preferences.d.ts +1 -1
  66. package/lib/{browser → common}/debug-preferences.d.ts.map +1 -1
  67. package/lib/{browser → common}/debug-preferences.js +4 -5
  68. package/lib/common/debug-preferences.js.map +1 -0
  69. package/lib/common/inline-debug-adapter.d.ts +3 -0
  70. package/lib/common/inline-debug-adapter.d.ts.map +1 -1
  71. package/lib/{browser/preferences → common}/launch-preferences.d.ts +2 -1
  72. package/lib/common/launch-preferences.d.ts.map +1 -0
  73. package/lib/{browser/preferences → common}/launch-preferences.js +8 -10
  74. package/lib/common/launch-preferences.js.map +1 -0
  75. package/lib/node/debug-backend-module.d.ts.map +1 -1
  76. package/lib/node/debug-backend-module.js +4 -0
  77. package/lib/node/debug-backend-module.js.map +1 -1
  78. package/package.json +16 -16
  79. package/src/browser/console/debug-console-items.tsx +32 -20
  80. package/src/browser/debug-configuration-manager.ts +5 -6
  81. package/src/browser/debug-configuration-model.ts +1 -2
  82. package/src/browser/debug-frontend-application-contribution.ts +231 -50
  83. package/src/browser/debug-frontend-module.ts +2 -2
  84. package/src/browser/debug-prefix-configuration.ts +3 -3
  85. package/src/browser/debug-schema-updater.ts +2 -2
  86. package/src/browser/debug-session-contribution.ts +1 -1
  87. package/src/browser/debug-session-manager.ts +14 -8
  88. package/src/browser/debug-session.tsx +14 -2
  89. package/src/browser/disassembly-view/disassembly-view-contribution.ts +1 -1
  90. package/src/browser/disassembly-view/disassembly-view-widget.ts +2 -2
  91. package/src/browser/editor/debug-editor-model.ts +15 -10
  92. package/src/browser/editor/debug-inline-value-decorator.ts +1 -1
  93. package/src/browser/model/debug-breakpoint.tsx +3 -2
  94. package/src/browser/model/debug-instruction-breakpoint.tsx +1 -1
  95. package/src/browser/model/debug-source-breakpoint.tsx +13 -10
  96. package/src/browser/model/debug-thread.tsx +1 -1
  97. package/src/browser/style/index.css +6 -2
  98. package/src/browser/view/debug-stack-frames-source.tsx +2 -1
  99. package/src/browser/view/debug-view-model.ts +2 -2
  100. package/src/{browser → common}/debug-preferences.ts +4 -5
  101. package/src/{browser/preferences → common}/launch-preferences.ts +5 -6
  102. package/src/node/debug-backend-module.ts +4 -0
  103. package/lib/browser/debug-preferences.js.map +0 -1
  104. package/lib/browser/preferences/launch-preferences.d.ts.map +0 -1
  105. package/lib/browser/preferences/launch-preferences.js.map +0 -1
@@ -20,11 +20,12 @@ import {
20
20
  import { TreeElementNode } from '@theia/core/lib/browser/source-tree';
21
21
  import { injectable, inject } from '@theia/core/shared/inversify';
22
22
  import * as monaco from '@theia/monaco-editor-core';
23
- import { MenuModelRegistry, CommandRegistry, MAIN_MENU_BAR, Command, Emitter, Mutable } from '@theia/core/lib/common';
23
+ import { MenuModelRegistry, CommandRegistry, MAIN_MENU_BAR, Command, Emitter, Mutable, URI, Event, MessageService, CancellationError } from '@theia/core/lib/common';
24
+ import { waitForEvent } from '@theia/core/lib/common/promise-util';
24
25
  import { EDITOR_CONTEXT_MENU, EDITOR_LINENUMBER_CONTEXT_MENU, EditorManager } from '@theia/editor/lib/browser';
25
26
  import { DebugSessionManager } from './debug-session-manager';
26
27
  import { DebugWidget } from './view/debug-widget';
27
- import { FunctionBreakpoint } from './breakpoint/breakpoint-marker';
28
+ import { FunctionBreakpoint, SourceBreakpoint } from './breakpoint/breakpoint-marker';
28
29
  import { BreakpointManager } from './breakpoint/breakpoint-manager';
29
30
  import { DebugConfigurationManager } from './debug-configuration-manager';
30
31
  import { DebugState, DebugSession } from './debug-session';
@@ -42,7 +43,7 @@ import { DebugEditorService } from './editor/debug-editor-service';
42
43
  import { DebugConsoleContribution } from './console/debug-console-contribution';
43
44
  import { DebugService } from '../common/debug-service';
44
45
  import { DebugSchemaUpdater } from './debug-schema-updater';
45
- import { DebugPreferences } from './debug-preferences';
46
+ import { DebugPreferences } from '../common/debug-preferences';
46
47
  import { RenderedToolbarAction, TabBarToolbarContribution, TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
47
48
  import { DebugWatchWidget } from './view/debug-watch-widget';
48
49
  import { DebugWatchExpression } from './view/debug-watch-expression';
@@ -57,6 +58,9 @@ import { DebugInstructionBreakpoint } from './model/debug-instruction-breakpoint
57
58
  import { DebugConfiguration } from '../common/debug-configuration';
58
59
  import { DebugExceptionBreakpoint } from './view/debug-exception-breakpoint';
59
60
  import { DebugToolBar } from './view/debug-toolbar-widget';
61
+ import { ConsoleWidget } from '@theia/console/lib/browser/console-widget';
62
+ import { ConsoleContentWidget } from '@theia/console/lib/browser/console-content-widget';
63
+ import { ConsoleContextMenu } from '@theia/console/lib/browser/console-contribution';
60
64
 
61
65
  export namespace DebugMenus {
62
66
  export const DEBUG = [...MAIN_MENU_BAR, '6_debug'];
@@ -192,21 +196,21 @@ export namespace DebugCommands {
192
196
  category: DEBUG_CATEGORY,
193
197
  label: 'Add Function Breakpoint',
194
198
  });
195
- export const ENABLE_SELECTED_BREAKPOINTS = Command.toDefaultLocalizedCommand({
199
+ export const ENABLE_SELECTED_BREAKPOINTS = Command.toLocalizedCommand({
196
200
  id: 'debug.breakpoint.enableSelected',
197
201
  category: DEBUG_CATEGORY,
198
202
  label: 'Enable Selected Breakpoints',
199
- });
203
+ }, 'theia/debug/enableSelectedBreakpoints', DEBUG_CATEGORY_KEY);
200
204
  export const ENABLE_ALL_BREAKPOINTS = Command.toDefaultLocalizedCommand({
201
205
  id: 'debug.breakpoint.enableAll',
202
206
  category: DEBUG_CATEGORY,
203
207
  label: 'Enable All Breakpoints',
204
208
  });
205
- export const DISABLE_SELECTED_BREAKPOINTS = Command.toDefaultLocalizedCommand({
209
+ export const DISABLE_SELECTED_BREAKPOINTS = Command.toLocalizedCommand({
206
210
  id: 'debug.breakpoint.disableSelected',
207
211
  category: DEBUG_CATEGORY,
208
212
  label: 'Disable Selected Breakpoints',
209
- });
213
+ }, 'theia/debug/disableSelectedBreakpoints', DEBUG_CATEGORY_KEY);
210
214
  export const DISABLE_ALL_BREAKPOINTS = Command.toDefaultLocalizedCommand({
211
215
  id: 'debug.breakpoint.disableAll',
212
216
  category: DEBUG_CATEGORY,
@@ -258,11 +262,26 @@ export namespace DebugCommands {
258
262
  id: 'editor.debug.action.showDebugHover',
259
263
  label: 'Debug: Show Hover'
260
264
  });
265
+ export const EVALUATE_IN_DEBUG_CONSOLE = Command.toDefaultLocalizedCommand({
266
+ id: 'editor.debug.action.selectionToRepl',
267
+ category: DEBUG_CATEGORY,
268
+ label: 'Evaluate in Debug Console'
269
+ });
261
270
  export const JUMP_TO_CURSOR = Command.toDefaultLocalizedCommand({
262
271
  id: 'editor.debug.action.jumpToCursor',
263
272
  category: DEBUG_CATEGORY,
264
273
  label: 'Jump to Cursor'
265
274
  });
275
+ export const RUN_TO_CURSOR = Command.toDefaultLocalizedCommand({
276
+ id: 'editor.debug.action.runToCursor',
277
+ category: DEBUG_CATEGORY,
278
+ label: 'Run to Cursor'
279
+ });
280
+ export const RUN_TO_LINE = Command.toDefaultLocalizedCommand({
281
+ id: 'editor.debug.action.runToLine',
282
+ category: DEBUG_CATEGORY,
283
+ label: 'Run to Line'
284
+ });
266
285
 
267
286
  export const RESTART_FRAME = Command.toDefaultLocalizedCommand({
268
287
  id: 'debug.frame.restart',
@@ -401,6 +420,9 @@ export namespace DebugEditorContextCommands {
401
420
  export const JUMP_TO_CURSOR = {
402
421
  id: 'debug.editor.context.jumpToCursor'
403
422
  };
423
+ export const RUN_TO_LINE = {
424
+ id: 'debug.editor.context.runToLine'
425
+ };
404
426
  }
405
427
  export namespace DebugBreakpointWidgetCommands {
406
428
  export const ACCEPT = {
@@ -448,6 +470,9 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
448
470
  @inject(EditorManager)
449
471
  protected readonly editorManager: EditorManager;
450
472
 
473
+ @inject(MessageService)
474
+ protected readonly messageService: MessageService;
475
+
451
476
  constructor() {
452
477
  super({
453
478
  widgetId: DebugWidget.ID,
@@ -533,7 +558,7 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
533
558
 
534
559
  override registerMenus(menus: MenuModelRegistry): void {
535
560
  super.registerMenus(menus);
536
- const registerMenuActions = (menuPath: string[], ...commands: Command[]) => {
561
+ const registerMenuActions = (menuPath: string[], ...commands: (Command & { order?: string })[]) => {
537
562
  for (const [index, command] of commands.entries()) {
538
563
  const label = command.label;
539
564
  const debug = `${DebugCommands.DEBUG_CATEGORY}:`;
@@ -541,7 +566,7 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
541
566
  commandId: command.id,
542
567
  label: label && label.startsWith(debug) && label.slice(debug.length).trimStart() || label,
543
568
  icon: command.iconClass,
544
- order: String.fromCharCode('a'.charCodeAt(0) + index)
569
+ order: command.order || String.fromCharCode('a'.charCodeAt(0) + index)
545
570
  });
546
571
  }
547
572
  };
@@ -605,6 +630,10 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
605
630
  DebugCommands.COPY_CALL_STACK
606
631
  );
607
632
 
633
+ registerMenuActions(ConsoleContextMenu.CLIPBOARD,
634
+ { ...DebugCommands.COPY_VARIABLE_VALUE, order: 'a1a' },
635
+ { ...DebugCommands.COPY_VARIABLE_AS_EXPRESSION, order: 'a1b' }
636
+ );
608
637
  registerMenuActions(DebugVariablesWidget.EDIT_MENU,
609
638
  DebugCommands.SET_VARIABLE_VALUE,
610
639
  DebugCommands.COPY_VARIABLE_VALUE,
@@ -643,10 +672,13 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
643
672
 
644
673
  const DEBUG_EDITOR_CONTEXT_MENU_GROUP = [...EDITOR_CONTEXT_MENU, '2_debug'];
645
674
  registerMenuActions(DEBUG_EDITOR_CONTEXT_MENU_GROUP,
646
- DebugCommands.JUMP_TO_CURSOR
675
+ DebugCommands.EVALUATE_IN_DEBUG_CONSOLE,
676
+ DebugCommands.JUMP_TO_CURSOR,
677
+ DebugCommands.RUN_TO_CURSOR,
678
+ DebugCommands.RUN_TO_LINE
647
679
  );
648
680
 
649
- registerMenuActions(DebugEditorModel.CONTEXT_MENU,
681
+ registerMenuActions([...DebugEditorModel.CONTEXT_MENU, '1_breakpoint'],
650
682
  { ...DebugEditorContextCommands.ADD_BREAKPOINT, label: nls.localizeByDefault('Add Breakpoint') },
651
683
  { ...DebugEditorContextCommands.ADD_CONDITIONAL_BREAKPOINT, label: DebugCommands.ADD_CONDITIONAL_BREAKPOINT.label },
652
684
  { ...DebugEditorContextCommands.ADD_LOGPOINT, label: DebugCommands.ADD_LOGPOINT.label },
@@ -657,12 +689,15 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
657
689
  { ...DebugEditorContextCommands.REMOVE_LOGPOINT, label: DebugCommands.REMOVE_LOGPOINT.label },
658
690
  { ...DebugEditorContextCommands.EDIT_LOGPOINT, label: DebugCommands.EDIT_LOGPOINT.label },
659
691
  { ...DebugEditorContextCommands.ENABLE_LOGPOINT, label: nlsEnableBreakpoint('Logpoint') },
660
- { ...DebugEditorContextCommands.DISABLE_LOGPOINT, label: nlsDisableBreakpoint('Logpoint') },
661
- { ...DebugEditorContextCommands.JUMP_TO_CURSOR, label: nls.localizeByDefault('Jump to Cursor') }
692
+ { ...DebugEditorContextCommands.DISABLE_LOGPOINT, label: nlsDisableBreakpoint('Logpoint') }
693
+ );
694
+ registerMenuActions([...DebugEditorModel.CONTEXT_MENU, '2_control'],
695
+ { ...DebugEditorContextCommands.JUMP_TO_CURSOR, label: nls.localizeByDefault('Jump to Cursor') },
696
+ { ...DebugEditorContextCommands.RUN_TO_LINE, label: DebugCommands.RUN_TO_LINE.label }
662
697
  );
663
698
  menus.linkCompoundMenuNode({ newParentPath: EDITOR_LINENUMBER_CONTEXT_MENU, submenuPath: DebugEditorModel.CONTEXT_MENU });
664
699
 
665
- menus.registerSubmenu(DebugToolBar.MENU, 'Debug Toolbar Menu');
700
+ menus.registerSubmenu(DebugToolBar.MENU, nls.localize('theia/debug/debugToolbarMenu', 'Debug Toolbar Menu'));
666
701
  }
667
702
 
668
703
  override registerCommands(registry: CommandRegistry): void {
@@ -702,8 +737,13 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
702
737
  isEnabled: () => this.manager.state === DebugState.Stopped
703
738
  });
704
739
  registry.registerCommand(DebugCommands.CONTINUE, {
705
- execute: () => this.manager.currentThread && this.manager.currentThread.continue(),
706
- isEnabled: () => this.manager.state === DebugState.Stopped
740
+ execute: () => {
741
+ if (this.manager.state === DebugState.Stopped && this.manager.currentThread) {
742
+ this.manager.currentThread.continue();
743
+ }
744
+ },
745
+ // When there is a debug session, F5 should always be captured by this command
746
+ isEnabled: () => this.manager.state !== DebugState.Inactive
707
747
  });
708
748
  registry.registerCommand(DebugCommands.PAUSE, {
709
749
  execute: () => this.manager.currentThread && this.manager.currentThread.pause(),
@@ -888,6 +928,21 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
888
928
  isEnabled: () => this.editors.canShowHover()
889
929
  });
890
930
 
931
+ registry.registerCommand(DebugCommands.EVALUATE_IN_DEBUG_CONSOLE, {
932
+ execute: async () => {
933
+ const { model } = this.editors;
934
+ if (model) {
935
+ const { editor } = model;
936
+ const { selection, document } = editor;
937
+ const value = document.getText(selection) || document.getLineContent(selection.start.line + 1).trim();
938
+ const consoleWidget = await this.console.openView({ reveal: true, activate: false });
939
+ await consoleWidget.execute(value);
940
+ }
941
+ },
942
+ isEnabled: () => !!this.editors.model && !!this.manager.currentFrame,
943
+ isVisible: () => !!this.editors.model && !!this.manager.currentFrame
944
+ });
945
+
891
946
  registry.registerCommand(DebugCommands.JUMP_TO_CURSOR, {
892
947
  execute: () => {
893
948
  const model = this.editors.model;
@@ -902,6 +957,29 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
902
957
  isVisible: () => !!this.manager.currentThread && this.manager.currentThread.supportsGoto
903
958
  });
904
959
 
960
+ registry.registerCommand(DebugCommands.RUN_TO_CURSOR, {
961
+ execute: async () => {
962
+ const { model } = this.editors;
963
+ if (model) {
964
+ const { editor, position } = model;
965
+ await this.runTo(editor.getResourceUri(), position.lineNumber, position.column);
966
+ }
967
+ },
968
+ isEnabled: () => !!this.editors.model && !!this.manager.currentThread?.stopped,
969
+ isVisible: () => !!this.editors.model && !!this.manager.currentThread?.stopped
970
+ });
971
+ registry.registerCommand(DebugCommands.RUN_TO_LINE, {
972
+ execute: async () => {
973
+ const { model } = this.editors;
974
+ if (model) {
975
+ const { editor, position } = model;
976
+ await this.runTo(editor.getResourceUri(), position.lineNumber);
977
+ }
978
+ },
979
+ isEnabled: () => !!this.editors.model && !!this.manager.currentThread?.stopped,
980
+ isVisible: () => !!this.editors.model && !!this.manager.currentThread?.stopped
981
+ });
982
+
905
983
  registry.registerCommand(DebugCommands.RESTART_FRAME, {
906
984
  execute: () => this.selectedFrame && this.selectedFrame.restart(),
907
985
  isEnabled: () => !!this.selectedFrame
@@ -1010,6 +1088,18 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
1010
1088
  isEnabled: () => !!this.manager.currentThread && this.manager.currentThread.supportsGoto,
1011
1089
  isVisible: () => !!this.manager.currentThread && this.manager.currentThread.supportsGoto
1012
1090
  });
1091
+ registry.registerCommand(DebugEditorContextCommands.RUN_TO_LINE, {
1092
+ execute: async position => {
1093
+ if (this.isPosition(position)) {
1094
+ const { currentUri } = this.editors;
1095
+ if (currentUri) {
1096
+ await this.runTo(currentUri, position.lineNumber);
1097
+ }
1098
+ }
1099
+ },
1100
+ isEnabled: position => this.isPosition(position) && !!this.editors.currentUri && !!this.manager.currentThread?.stopped,
1101
+ isVisible: position => this.isPosition(position) && !!this.editors.currentUri && !!this.manager.currentThread?.stopped
1102
+ });
1013
1103
 
1014
1104
  registry.registerCommand(DebugBreakpointWidgetCommands.ACCEPT, {
1015
1105
  execute: () => this.editors.acceptBreakpoint()
@@ -1085,11 +1175,13 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
1085
1175
  super.registerKeybindings(keybindings);
1086
1176
  keybindings.registerKeybinding({
1087
1177
  command: DebugCommands.START.id,
1088
- keybinding: 'f5'
1178
+ keybinding: 'f5',
1179
+ when: '!inDebugMode'
1089
1180
  });
1090
1181
  keybindings.registerKeybinding({
1091
1182
  command: DebugCommands.START_NO_DEBUG.id,
1092
- keybinding: 'ctrl+f5'
1183
+ keybinding: 'ctrl+f5',
1184
+ when: '!inDebugMode'
1093
1185
  });
1094
1186
  keybindings.registerKeybinding({
1095
1187
  command: DebugCommands.STOP.id,
@@ -1142,12 +1234,12 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
1142
1234
  keybindings.registerKeybinding({
1143
1235
  command: DebugBreakpointWidgetCommands.ACCEPT.id,
1144
1236
  keybinding: 'enter',
1145
- when: 'breakpointWidgetFocus'
1237
+ when: 'breakpointWidgetFocus && !suggestWidgetVisible'
1146
1238
  });
1147
1239
  keybindings.registerKeybinding({
1148
1240
  command: DebugBreakpointWidgetCommands.CLOSE.id,
1149
1241
  keybinding: 'esc',
1150
- when: 'isBreakpointWidgetVisible || breakpointWidgetFocus'
1242
+ when: 'isBreakpointWidgetVisible || (breakpointWidgetFocus && !suggestWidgetVisible)'
1151
1243
  });
1152
1244
  }
1153
1245
 
@@ -1258,6 +1350,87 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
1258
1350
  await this.manager.start(current);
1259
1351
  }
1260
1352
 
1353
+ async runTo(uri: URI, line: number, column?: number): Promise<void> {
1354
+ const thread = this.manager.currentThread;
1355
+ if (!thread) {
1356
+ return;
1357
+ }
1358
+ const checkThread = () => {
1359
+ if (thread.stopped && thread === this.manager.currentThread) {
1360
+ return true;
1361
+ }
1362
+ console.warn('Cannot run to the specified location. The current thread has changed or is not stopped.');
1363
+ return false;
1364
+ };
1365
+ if (!checkThread()) {
1366
+ return;
1367
+ }
1368
+ const breakpoint = SourceBreakpoint.create(uri, { line, column });
1369
+ let shouldRemoveBreakpoint = this.breakpointManager.addBreakpoint(breakpoint);
1370
+ const removeBreakpoint = () => {
1371
+ const breakpoints = this.breakpointManager.getBreakpoints(uri);
1372
+ const newBreakpoints = breakpoints.filter(bp => bp.id !== breakpoint.id);
1373
+ if (breakpoints.length !== newBreakpoints.length) {
1374
+ this.breakpointManager.setBreakpoints(uri, newBreakpoints);
1375
+ }
1376
+ };
1377
+ try {
1378
+ const sessionBreakpoint = await this.verifyBreakpoint(breakpoint, thread.session);
1379
+ if (!checkThread()) {
1380
+ return;
1381
+ }
1382
+ if (!sessionBreakpoint || !sessionBreakpoint.installed || !sessionBreakpoint.verified) {
1383
+ this.messageService.warn(nls.localize('theia/debug/cannotRunToThisLocation',
1384
+ 'Could not run the current thread to the specified location.'
1385
+ ));
1386
+ return;
1387
+ }
1388
+ const rawBreakpoint = sessionBreakpoint.raw!; // an installed breakpoint always has the underlying raw breakpoint
1389
+ if (rawBreakpoint.line !== line || (column && rawBreakpoint.column !== column)) {
1390
+ const shouldRun = await new ConfirmDialog({
1391
+ title: nls.localize('theia/debug/confirmRunToShiftedPosition_title',
1392
+ 'Cannot run the current thread to exactly the specified location'),
1393
+ msg: nls.localize('theia/debug/confirmRunToShiftedPosition_msg',
1394
+ 'The target position will be shifted to Ln {0}, Col {1}. Run anyway?', rawBreakpoint.line, rawBreakpoint.column || 1),
1395
+ ok: Dialog.YES,
1396
+ cancel: Dialog.NO
1397
+ }).open();
1398
+ if (!shouldRun || !checkThread()) {
1399
+ return;
1400
+ }
1401
+ }
1402
+ if (shouldRemoveBreakpoint) {
1403
+ Event.toPromise(Event.filter(
1404
+ Event.any(this.manager.onDidStopDebugSession, this.manager.onDidDestroyDebugSession),
1405
+ session => session === thread.session
1406
+ )).then(removeBreakpoint);
1407
+ }
1408
+ await thread.continue();
1409
+ shouldRemoveBreakpoint = false;
1410
+ } finally {
1411
+ if (shouldRemoveBreakpoint) {
1412
+ removeBreakpoint();
1413
+ }
1414
+ }
1415
+ }
1416
+
1417
+ protected async verifyBreakpoint(breakpoint: SourceBreakpoint, session: DebugSession, timeout = 2000): Promise<DebugBreakpoint | undefined> {
1418
+ let sessionBreakpoint = session.getBreakpoint(breakpoint.id);
1419
+ if (!sessionBreakpoint || !sessionBreakpoint.installed || !sessionBreakpoint.verified) {
1420
+ try {
1421
+ await waitForEvent(Event.filter(session.onDidChangeBreakpoints, () => {
1422
+ sessionBreakpoint = session.getBreakpoint(breakpoint.id);
1423
+ return !!sessionBreakpoint && sessionBreakpoint.installed && sessionBreakpoint.verified;
1424
+ }), timeout); // wait up to `timeout` ms for the breakpoint to become installed and verified
1425
+ } catch (e) {
1426
+ if (!(e instanceof CancellationError)) { // ignore the `CancellationError` on timeout
1427
+ throw e;
1428
+ }
1429
+ }
1430
+ }
1431
+ return sessionBreakpoint;
1432
+ }
1433
+
1261
1434
  get threads(): DebugThreadsWidget | undefined {
1262
1435
  const { currentWidget } = this.shell;
1263
1436
  return currentWidget instanceof DebugThreadsWidget && currentWidget || undefined;
@@ -1326,13 +1499,20 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
1326
1499
  }
1327
1500
  }
1328
1501
 
1502
+ get consoleWidget(): ConsoleWidget | undefined {
1503
+ const { currentWidget } = this.shell;
1504
+ return currentWidget instanceof ConsoleWidget && currentWidget.id === DebugConsoleContribution.options.id && currentWidget || undefined;
1505
+ }
1329
1506
  get variables(): DebugVariablesWidget | undefined {
1330
1507
  const { currentWidget } = this.shell;
1331
1508
  return currentWidget instanceof DebugVariablesWidget && currentWidget || undefined;
1332
1509
  }
1510
+ get variablesSource(): DebugVariablesWidget | ConsoleContentWidget | undefined {
1511
+ return this.variables ?? this.consoleWidget?.content;
1512
+ }
1333
1513
  get selectedVariable(): DebugVariable | undefined {
1334
- const { variables } = this;
1335
- return variables && variables.selectedElement instanceof DebugVariable && variables.selectedElement || undefined;
1514
+ const { variablesSource } = this;
1515
+ return variablesSource && variablesSource.selectedElement instanceof DebugVariable && variablesSource.selectedElement || undefined;
1336
1516
  }
1337
1517
 
1338
1518
  get watch(): DebugWatchWidget | undefined {
@@ -1344,7 +1524,7 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
1344
1524
  return watch && watch.selectedElement instanceof DebugWatchExpression && watch.selectedElement || undefined;
1345
1525
  }
1346
1526
 
1347
- protected isPosition(position: unknown): boolean {
1527
+ protected isPosition(position: unknown): position is monaco.IPosition {
1348
1528
  return monaco.Position.isIPosition(position);
1349
1529
  }
1350
1530
 
@@ -1362,7 +1542,7 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
1362
1542
  light: '#ffff6673',
1363
1543
  hcDark: '#fff600',
1364
1544
  hcLight: '#ffff6673'
1365
- }, description: 'Background color for the highlight of line at the top stack frame position.'
1545
+ }, description: nls.localizeByDefault('Background color for the highlight of line at the top stack frame position.')
1366
1546
  },
1367
1547
  {
1368
1548
  id: 'editor.focusedStackFrameHighlightBackground',
@@ -1371,7 +1551,7 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
1371
1551
  light: '#cee7ce73',
1372
1552
  hcDark: '#cee7ce',
1373
1553
  hcLight: '#cee7ce73'
1374
- }, description: 'Background color for the highlight of line at focused stack frame position.'
1554
+ }, description: nls.localizeByDefault('Background color for the highlight of line at focused stack frame position.')
1375
1555
  },
1376
1556
  // Status bar colors should be aligned with debugging colors from https://code.visualstudio.com/api/references/theme-color#status-bar-colors
1377
1557
  {
@@ -1380,7 +1560,7 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
1380
1560
  light: '#CC6633',
1381
1561
  hcDark: '#CC6633',
1382
1562
  hcLight: '#B5200D'
1383
- }, description: 'Status bar background color when a program is being debugged. The status bar is shown in the bottom of the window'
1563
+ }, description: nls.localizeByDefault('Status bar background color when a program is being debugged. The status bar is shown in the bottom of the window')
1384
1564
  },
1385
1565
  {
1386
1566
  id: 'statusBar.debuggingForeground', defaults: {
@@ -1388,7 +1568,7 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
1388
1568
  light: 'statusBar.foreground',
1389
1569
  hcDark: 'statusBar.foreground',
1390
1570
  hcLight: 'statusBar.foreground'
1391
- }, description: 'Status bar foreground color when a program is being debugged. The status bar is shown in the bottom of the window'
1571
+ }, description: nls.localizeByDefault('Status bar foreground color when a program is being debugged. The status bar is shown in the bottom of the window')
1392
1572
  },
1393
1573
  {
1394
1574
  id: 'statusBar.debuggingBorder', defaults: {
@@ -1396,7 +1576,8 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
1396
1576
  light: 'statusBar.border',
1397
1577
  hcDark: 'statusBar.border',
1398
1578
  hcLight: 'statusBar.border'
1399
- }, description: 'Status bar border color separating to the sidebar and editor when a program is being debugged. The status bar is shown in the bottom of the window'
1579
+ }, description: nls.localizeByDefault(
1580
+ 'Status bar border color separating to the sidebar and editor when a program is being debugged. The status bar is shown in the bottom of the window')
1400
1581
  },
1401
1582
  // Debug Exception Widget colors should be aligned with
1402
1583
  // https://github.com/microsoft/vscode/blob/ff5f581425da6230b6f9216ecf19abf6c9d285a6/src/vs/workbench/contrib/debug/browser/exceptionWidget.ts#L23
@@ -1406,7 +1587,7 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
1406
1587
  light: '#a31515',
1407
1588
  hcDark: '#a31515',
1408
1589
  hcLight: '#a31515'
1409
- }, description: 'Exception widget border color.',
1590
+ }, description: nls.localizeByDefault('Exception widget border color.'),
1410
1591
  },
1411
1592
  {
1412
1593
  id: 'debugExceptionWidget.background', defaults: {
@@ -1414,7 +1595,7 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
1414
1595
  light: '#f1dfde',
1415
1596
  hcDark: '#420b0d',
1416
1597
  hcLight: '#f1dfde'
1417
- }, description: 'Exception widget background color.'
1598
+ }, description: nls.localizeByDefault('Exception widget background color.')
1418
1599
  },
1419
1600
  // Debug Icon colors should be aligned with
1420
1601
  // https://code.visualstudio.com/api/references/theme-color#debug-icons-colors
@@ -1425,7 +1606,7 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
1425
1606
  hcDark: '#E51400',
1426
1607
  hcLight: '#E51400'
1427
1608
  },
1428
- description: 'Icon color for breakpoints.'
1609
+ description: nls.localizeByDefault('Icon color for breakpoints.')
1429
1610
  },
1430
1611
  {
1431
1612
  id: 'debugIcon.breakpointDisabledForeground', defaults: {
@@ -1434,7 +1615,7 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
1434
1615
  hcDark: '#848484',
1435
1616
  hcLight: '#848484'
1436
1617
  },
1437
- description: 'Icon color for disabled breakpoints.'
1618
+ description: nls.localizeByDefault('Icon color for disabled breakpoints.')
1438
1619
  },
1439
1620
  {
1440
1621
  id: 'debugIcon.breakpointUnverifiedForeground', defaults: {
@@ -1443,7 +1624,7 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
1443
1624
  hcDark: '#848484',
1444
1625
  hcLight: '#848484'
1445
1626
  },
1446
- description: 'Icon color for unverified breakpoints.'
1627
+ description: nls.localizeByDefault('Icon color for unverified breakpoints.')
1447
1628
  },
1448
1629
  {
1449
1630
  id: 'debugIcon.breakpointCurrentStackframeForeground', defaults: {
@@ -1452,7 +1633,7 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
1452
1633
  hcDark: '#FFCC00',
1453
1634
  hcLight: '#BE8700'
1454
1635
  },
1455
- description: 'Icon color for the current breakpoint stack frame.'
1636
+ description: nls.localizeByDefault('Icon color for the current breakpoint stack frame.')
1456
1637
  },
1457
1638
  {
1458
1639
  id: 'debugIcon.breakpointStackframeForeground', defaults: {
@@ -1461,7 +1642,7 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
1461
1642
  hcDark: '#89D185',
1462
1643
  hcLight: '#89D185'
1463
1644
  },
1464
- description: 'Icon color for all breakpoint stack frames.'
1645
+ description: nls.localizeByDefault('Icon color for all breakpoint stack frames.')
1465
1646
  },
1466
1647
  {
1467
1648
  id: 'debugIcon.startForeground', defaults: {
@@ -1469,7 +1650,7 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
1469
1650
  light: '#388A34',
1470
1651
  hcDark: '#89D185',
1471
1652
  hcLight: '#388A34'
1472
- }, description: 'Debug toolbar icon for start debugging.'
1653
+ }, description: nls.localizeByDefault('Debug toolbar icon for start debugging.')
1473
1654
  },
1474
1655
  {
1475
1656
  id: 'debugIcon.pauseForeground', defaults: {
@@ -1477,7 +1658,7 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
1477
1658
  light: '#007ACC',
1478
1659
  hcDark: '#75BEFF',
1479
1660
  hcLight: '#007ACC'
1480
- }, description: 'Debug toolbar icon for pause.'
1661
+ }, description: nls.localizeByDefault('Debug toolbar icon for pause.')
1481
1662
  },
1482
1663
  {
1483
1664
  id: 'debugIcon.stopForeground', defaults: {
@@ -1485,7 +1666,7 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
1485
1666
  light: '#A1260D',
1486
1667
  hcDark: '#F48771',
1487
1668
  hcLight: '#A1260D'
1488
- }, description: 'Debug toolbar icon for stop.'
1669
+ }, description: nls.localizeByDefault('Debug toolbar icon for stop.')
1489
1670
  },
1490
1671
  {
1491
1672
  id: 'debugIcon.disconnectForeground', defaults: {
@@ -1493,7 +1674,7 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
1493
1674
  light: '#A1260D',
1494
1675
  hcDark: '#F48771',
1495
1676
  hcLight: '#A1260D'
1496
- }, description: 'Debug toolbar icon for disconnect.'
1677
+ }, description: nls.localizeByDefault('Debug toolbar icon for disconnect.')
1497
1678
  },
1498
1679
  {
1499
1680
  id: 'debugIcon.restartForeground', defaults: {
@@ -1501,7 +1682,7 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
1501
1682
  light: '#388A34',
1502
1683
  hcDark: '#89D185',
1503
1684
  hcLight: '#388A34'
1504
- }, description: 'Debug toolbar icon for restart.'
1685
+ }, description: nls.localizeByDefault('Debug toolbar icon for restart.')
1505
1686
  },
1506
1687
  {
1507
1688
  id: 'debugIcon.stepOverForeground', defaults: {
@@ -1509,7 +1690,7 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
1509
1690
  light: '#007ACC',
1510
1691
  hcDark: '#75BEFF',
1511
1692
  hcLight: '#007ACC',
1512
- }, description: 'Debug toolbar icon for step over.'
1693
+ }, description: nls.localizeByDefault('Debug toolbar icon for step over.')
1513
1694
  },
1514
1695
  {
1515
1696
  id: 'debugIcon.stepIntoForeground', defaults: {
@@ -1517,7 +1698,7 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
1517
1698
  light: '#007ACC',
1518
1699
  hcDark: '#75BEFF',
1519
1700
  hcLight: '#007ACC'
1520
- }, description: 'Debug toolbar icon for step into.'
1701
+ }, description: nls.localizeByDefault('Debug toolbar icon for step into.')
1521
1702
  },
1522
1703
  {
1523
1704
  id: 'debugIcon.stepOutForeground', defaults: {
@@ -1525,7 +1706,7 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
1525
1706
  light: '#007ACC',
1526
1707
  hcDark: '#75BEFF',
1527
1708
  hcLight: '#007ACC',
1528
- }, description: 'Debug toolbar icon for step over.'
1709
+ }, description: nls.localizeByDefault('Debug toolbar icon for step over.')
1529
1710
  },
1530
1711
  {
1531
1712
  id: 'debugIcon.continueForeground', defaults: {
@@ -1533,7 +1714,7 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
1533
1714
  light: '#007ACC',
1534
1715
  hcDark: '#75BEFF',
1535
1716
  hcLight: '#007ACC'
1536
- }, description: 'Debug toolbar icon for continue.'
1717
+ }, description: nls.localizeByDefault('Debug toolbar icon for continue.')
1537
1718
  },
1538
1719
  {
1539
1720
  id: 'debugIcon.stepBackForeground', defaults: {
@@ -1541,7 +1722,7 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
1541
1722
  light: '#007ACC',
1542
1723
  hcDark: '#75BEFF',
1543
1724
  hcLight: '#007ACC'
1544
- }, description: 'Debug toolbar icon for step back.'
1725
+ }, description: nls.localizeByDefault('Debug toolbar icon for step back.')
1545
1726
  },
1546
1727
  {
1547
1728
  id: 'debugConsole.infoForeground', defaults: {
@@ -1549,7 +1730,7 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
1549
1730
  light: 'editorInfo.foreground',
1550
1731
  hcDark: 'foreground',
1551
1732
  hcLight: 'foreground'
1552
- }, description: 'Foreground color for info messages in debug REPL console.'
1733
+ }, description: 'Foreground color for info messages in debug REPL console.' // this description is present in VS Code, but is not currently localized there
1553
1734
  },
1554
1735
  {
1555
1736
  id: 'debugConsole.warningForeground', defaults: {
@@ -1558,7 +1739,7 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
1558
1739
  hcDark: '#008000',
1559
1740
  hcLight: 'editorWarning.foreground'
1560
1741
  },
1561
- description: 'Foreground color for warning messages in debug REPL console.'
1742
+ description: 'Foreground color for warning messages in debug REPL console.' // this description is present in VS Code, but is not currently localized there
1562
1743
  },
1563
1744
  {
1564
1745
  id: 'debugConsole.errorForeground', defaults: {
@@ -1567,7 +1748,7 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
1567
1748
  hcDark: 'errorForeground',
1568
1749
  hcLight: 'errorForeground'
1569
1750
  },
1570
- description: 'Foreground color for error messages in debug REPL console.',
1751
+ description: 'Foreground color for error messages in debug REPL console.', // this description is present in VS Code, but is not currently localized there
1571
1752
  },
1572
1753
  {
1573
1754
  id: 'debugConsole.sourceForeground', defaults: {
@@ -1576,7 +1757,7 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
1576
1757
  hcDark: 'foreground',
1577
1758
  hcLight: 'foreground'
1578
1759
  },
1579
- description: 'Foreground color for source filenames in debug REPL console.',
1760
+ description: 'Foreground color for source filenames in debug REPL console.', // this description is present in VS Code, but is not currently localized there
1580
1761
  },
1581
1762
  {
1582
1763
  id: 'debugConsoleInputIcon.foreground', defaults: {
@@ -1585,7 +1766,7 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
1585
1766
  hcDark: 'foreground',
1586
1767
  hcLight: 'foreground'
1587
1768
  },
1588
- description: 'Foreground color for debug console input marker icon.'
1769
+ description: 'Foreground color for debug console input marker icon.' // this description is present in VS Code, but is not currently localized there
1589
1770
  }
1590
1771
  );
1591
1772
  }
@@ -40,10 +40,10 @@ import { DebugConsoleContribution } from './console/debug-console-contribution';
40
40
  import { BreakpointManager } from './breakpoint/breakpoint-manager';
41
41
  import { DebugEditorService } from './editor/debug-editor-service';
42
42
  import { DebugEditorModelFactory, DebugEditorModel } from './editor/debug-editor-model';
43
- import { bindDebugPreferences } from './debug-preferences';
43
+ import { bindDebugPreferences } from '../common/debug-preferences';
44
44
  import { DebugSchemaUpdater } from './debug-schema-updater';
45
45
  import { DebugCallStackItemTypeKey } from './debug-call-stack-item-type-key';
46
- import { bindLaunchPreferences } from './preferences/launch-preferences';
46
+ import { bindLaunchPreferences } from '../common/launch-preferences';
47
47
  import { DebugPrefixConfiguration } from './debug-prefix-configuration';
48
48
  import { CommandContribution } from '@theia/core/lib/common/command';
49
49
  import { TabBarToolbarContribution } from '@theia/core/lib/browser/shell/tab-bar-toolbar';