@theia/debug 1.70.0-next.81 → 1.70.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 (100) hide show
  1. package/lib/browser/breakpoint/breakpoint-manager.d.ts +80 -45
  2. package/lib/browser/breakpoint/breakpoint-manager.d.ts.map +1 -1
  3. package/lib/browser/breakpoint/breakpoint-manager.js +553 -170
  4. package/lib/browser/breakpoint/breakpoint-manager.js.map +1 -1
  5. package/lib/browser/breakpoint/breakpoint-manager.spec.d.ts +2 -0
  6. package/lib/browser/breakpoint/breakpoint-manager.spec.d.ts.map +1 -0
  7. package/lib/browser/breakpoint/breakpoint-manager.spec.js +861 -0
  8. package/lib/browser/breakpoint/breakpoint-manager.spec.js.map +1 -0
  9. package/lib/browser/breakpoint/breakpoint-marker.d.ts +7 -10
  10. package/lib/browser/breakpoint/breakpoint-marker.d.ts.map +1 -1
  11. package/lib/browser/breakpoint/breakpoint-marker.js +14 -11
  12. package/lib/browser/breakpoint/breakpoint-marker.js.map +1 -1
  13. package/lib/browser/breakpoint/debug-data-breakpoint-actions.js +1 -1
  14. package/lib/browser/breakpoint/debug-data-breakpoint-actions.js.map +1 -1
  15. package/lib/browser/debug-frontend-application-contribution.d.ts +1 -2
  16. package/lib/browser/debug-frontend-application-contribution.d.ts.map +1 -1
  17. package/lib/browser/debug-frontend-application-contribution.js +13 -21
  18. package/lib/browser/debug-frontend-application-contribution.js.map +1 -1
  19. package/lib/browser/debug-frontend-module.d.ts.map +1 -1
  20. package/lib/browser/debug-frontend-module.js +3 -0
  21. package/lib/browser/debug-frontend-module.js.map +1 -1
  22. package/lib/browser/debug-session-manager.d.ts +8 -27
  23. package/lib/browser/debug-session-manager.d.ts.map +1 -1
  24. package/lib/browser/debug-session-manager.js +14 -132
  25. package/lib/browser/debug-session-manager.js.map +1 -1
  26. package/lib/browser/debug-session.d.ts +1 -21
  27. package/lib/browser/debug-session.d.ts.map +1 -1
  28. package/lib/browser/debug-session.js +72 -203
  29. package/lib/browser/debug-session.js.map +1 -1
  30. package/lib/browser/disassembly-view/disassembly-view-breakpoint-renderer.js +1 -1
  31. package/lib/browser/disassembly-view/disassembly-view-breakpoint-renderer.js.map +1 -1
  32. package/lib/browser/disassembly-view/disassembly-view-widget.d.ts.map +1 -1
  33. package/lib/browser/disassembly-view/disassembly-view-widget.js +17 -24
  34. package/lib/browser/disassembly-view/disassembly-view-widget.js.map +1 -1
  35. package/lib/browser/editor/debug-editor-model.d.ts +15 -5
  36. package/lib/browser/editor/debug-editor-model.d.ts.map +1 -1
  37. package/lib/browser/editor/debug-editor-model.js +56 -32
  38. package/lib/browser/editor/debug-editor-model.js.map +1 -1
  39. package/lib/browser/model/debug-breakpoint-opener.d.ts +14 -0
  40. package/lib/browser/model/debug-breakpoint-opener.d.ts.map +1 -0
  41. package/lib/browser/model/debug-breakpoint-opener.js +67 -0
  42. package/lib/browser/model/debug-breakpoint-opener.js.map +1 -0
  43. package/lib/browser/model/debug-breakpoint.d.ts +32 -13
  44. package/lib/browser/model/debug-breakpoint.d.ts.map +1 -1
  45. package/lib/browser/model/debug-breakpoint.js +76 -16
  46. package/lib/browser/model/debug-breakpoint.js.map +1 -1
  47. package/lib/browser/model/debug-data-breakpoint.d.ts +1 -0
  48. package/lib/browser/model/debug-data-breakpoint.d.ts.map +1 -1
  49. package/lib/browser/model/debug-data-breakpoint.js +6 -5
  50. package/lib/browser/model/debug-data-breakpoint.js.map +1 -1
  51. package/lib/browser/model/debug-function-breakpoint.d.ts +4 -1
  52. package/lib/browser/model/debug-function-breakpoint.d.ts.map +1 -1
  53. package/lib/browser/model/debug-function-breakpoint.js +20 -29
  54. package/lib/browser/model/debug-function-breakpoint.js.map +1 -1
  55. package/lib/browser/model/debug-instruction-breakpoint.d.ts +2 -1
  56. package/lib/browser/model/debug-instruction-breakpoint.d.ts.map +1 -1
  57. package/lib/browser/model/debug-instruction-breakpoint.js +8 -8
  58. package/lib/browser/model/debug-instruction-breakpoint.js.map +1 -1
  59. package/lib/browser/model/debug-source-breakpoint.d.ts +6 -15
  60. package/lib/browser/model/debug-source-breakpoint.d.ts.map +1 -1
  61. package/lib/browser/model/debug-source-breakpoint.js +16 -90
  62. package/lib/browser/model/debug-source-breakpoint.js.map +1 -1
  63. package/lib/browser/view/debug-breakpoints-source.d.ts +0 -2
  64. package/lib/browser/view/debug-breakpoints-source.d.ts.map +1 -1
  65. package/lib/browser/view/debug-breakpoints-source.js +2 -10
  66. package/lib/browser/view/debug-breakpoints-source.js.map +1 -1
  67. package/lib/browser/view/debug-breakpoints-widget.d.ts +2 -0
  68. package/lib/browser/view/debug-breakpoints-widget.d.ts.map +1 -1
  69. package/lib/browser/view/debug-breakpoints-widget.js +3 -0
  70. package/lib/browser/view/debug-breakpoints-widget.js.map +1 -1
  71. package/lib/browser/view/debug-exception-breakpoint.d.ts +18 -11
  72. package/lib/browser/view/debug-exception-breakpoint.d.ts.map +1 -1
  73. package/lib/browser/view/debug-exception-breakpoint.js +58 -24
  74. package/lib/browser/view/debug-exception-breakpoint.js.map +1 -1
  75. package/lib/browser/view/debug-view-model.d.ts +8 -4
  76. package/lib/browser/view/debug-view-model.d.ts.map +1 -1
  77. package/lib/browser/view/debug-view-model.js +16 -9
  78. package/lib/browser/view/debug-view-model.js.map +1 -1
  79. package/package.json +16 -16
  80. package/src/browser/breakpoint/breakpoint-manager.spec.ts +1106 -0
  81. package/src/browser/breakpoint/breakpoint-manager.ts +583 -194
  82. package/src/browser/breakpoint/breakpoint-marker.ts +21 -15
  83. package/src/browser/breakpoint/debug-data-breakpoint-actions.ts +1 -1
  84. package/src/browser/debug-frontend-application-contribution.ts +18 -23
  85. package/src/browser/debug-frontend-module.ts +5 -1
  86. package/src/browser/debug-session-manager.ts +15 -147
  87. package/src/browser/debug-session.tsx +71 -221
  88. package/src/browser/disassembly-view/disassembly-view-breakpoint-renderer.ts +1 -1
  89. package/src/browser/disassembly-view/disassembly-view-widget.ts +17 -23
  90. package/src/browser/editor/debug-editor-model.ts +58 -35
  91. package/src/browser/model/debug-breakpoint-opener.ts +51 -0
  92. package/src/browser/model/debug-breakpoint.tsx +101 -20
  93. package/src/browser/model/debug-data-breakpoint.tsx +8 -5
  94. package/src/browser/model/debug-function-breakpoint.tsx +18 -29
  95. package/src/browser/model/debug-instruction-breakpoint.tsx +10 -8
  96. package/src/browser/model/debug-source-breakpoint.tsx +23 -101
  97. package/src/browser/view/debug-breakpoints-source.tsx +2 -9
  98. package/src/browser/view/debug-breakpoints-widget.ts +6 -0
  99. package/src/browser/view/debug-exception-breakpoint.tsx +66 -27
  100. package/src/browser/view/debug-view-model.ts +21 -13
@@ -15,15 +15,15 @@
15
15
  // *****************************************************************************
16
16
 
17
17
  import { UUID } from '@theia/core/shared/@lumino/coreutils';
18
- import { Marker } from '@theia/markers/lib/common/marker';
19
18
  import { DebugProtocol } from '@vscode/debugprotocol/lib/debugProtocol';
20
19
  import { isObject, isString, URI } from '@theia/core/lib/common';
21
20
 
22
- export const BREAKPOINT_KIND = 'breakpoint';
21
+ export const DEBUG_BREAKPOINT_SCHEME = 'debug-breakpoint';
23
22
 
24
23
  export interface BaseBreakpoint {
25
24
  id: string;
26
25
  enabled: boolean;
26
+ raw: object;
27
27
  }
28
28
 
29
29
  export interface SourceBreakpoint extends BaseBreakpoint {
@@ -44,16 +44,7 @@ export namespace SourceBreakpoint {
44
44
  }
45
45
  }
46
46
 
47
- export interface BreakpointMarker extends Marker<SourceBreakpoint> {
48
- kind: 'breakpoint'
49
- }
50
- export namespace BreakpointMarker {
51
- export function is(node: Marker<object>): node is BreakpointMarker {
52
- return 'kind' in node && node.kind === BREAKPOINT_KIND;
53
- }
54
- }
55
-
56
- export interface ExceptionBreakpoint {
47
+ export interface ExceptionBreakpoint extends BaseBreakpoint {
57
48
  enabled: boolean;
58
49
  condition?: string;
59
50
  raw: DebugProtocol.ExceptionBreakpointsFilter;
@@ -61,7 +52,8 @@ export interface ExceptionBreakpoint {
61
52
  export namespace ExceptionBreakpoint {
62
53
  export function create(data: DebugProtocol.ExceptionBreakpointsFilter, origin?: ExceptionBreakpoint): ExceptionBreakpoint {
63
54
  return {
64
- enabled: origin ? origin.enabled : false,
55
+ id: origin?.id ?? UUID.uuid4(),
56
+ enabled: origin?.enabled ?? !!data.default,
65
57
  condition: origin ? origin.condition : undefined,
66
58
  raw: {
67
59
  ...(origin && origin.raw),
@@ -69,11 +61,23 @@ export namespace ExceptionBreakpoint {
69
61
  }
70
62
  };
71
63
  }
64
+
65
+ /** Copied from https://github.com/microsoft/vscode/blob/8934b59d4aa696b6f51ac9bf2eeae8bbac5dac03/src/vs/workbench/contrib/debug/common/debugModel.ts#L1368-L1374 */
66
+ export function matches(left: DebugProtocol.ExceptionBreakpointsFilter, right: DebugProtocol.ExceptionBreakpointsFilter): boolean {
67
+ return (
68
+ left.filter === right.filter &&
69
+ left.label === right.label &&
70
+ !!left.supportsCondition === !!right.supportsCondition &&
71
+ left.conditionDescription === right.conditionDescription &&
72
+ left.description === right.description
73
+ );
74
+ }
72
75
  }
73
76
 
74
77
  export interface FunctionBreakpoint extends BaseBreakpoint {
75
78
  raw: DebugProtocol.FunctionBreakpoint;
76
79
  }
80
+
77
81
  export namespace FunctionBreakpoint {
78
82
  export function create(data: DebugProtocol.FunctionBreakpoint, origin?: FunctionBreakpoint): FunctionBreakpoint {
79
83
  return {
@@ -87,12 +91,14 @@ export namespace FunctionBreakpoint {
87
91
  }
88
92
  }
89
93
 
90
- export interface InstructionBreakpoint extends BaseBreakpoint, DebugProtocol.InstructionBreakpoint { }
94
+ export interface InstructionBreakpoint extends BaseBreakpoint {
95
+ raw: DebugProtocol.InstructionBreakpoint;
96
+ }
91
97
 
92
98
  export namespace InstructionBreakpoint {
93
99
  export function create(raw: DebugProtocol.InstructionBreakpoint, existing?: InstructionBreakpoint): InstructionBreakpoint {
94
100
  return {
95
- ...raw,
101
+ raw,
96
102
  id: existing?.id ?? UUID.uuid4(),
97
103
  enabled: existing?.enabled ?? true,
98
104
  };
@@ -95,7 +95,7 @@ export class AddOrEditDataBreakpointAddress implements CommandHandler {
95
95
 
96
96
  const src: DataBreakpointSource = { type: DataBreakpointSourceType.Address, ...range };
97
97
  if (existingBreakpoint) {
98
- this.breakpointManager.removeDataBreakpoint(existingBreakpoint.id);
98
+ this.breakpointManager.removeDataBreakpoint(existingBreakpoint);
99
99
  }
100
100
 
101
101
  this.breakpointManager.addDataBreakpoint(DataBreakpoint.create({ dataId: info.dataId, accessType }, { ...info, canPersist: true }, src));
@@ -25,7 +25,7 @@ import { waitForEvent } from '@theia/core/lib/common/promise-util';
25
25
  import { EDITOR_CONTEXT_MENU, EDITOR_LINENUMBER_CONTEXT_MENU, EditorManager } from '@theia/editor/lib/browser';
26
26
  import { DebugSessionManager } from './debug-session-manager';
27
27
  import { DebugWidget } from './view/debug-widget';
28
- import { FunctionBreakpoint, SourceBreakpoint } from './breakpoint/breakpoint-marker';
28
+ import { SourceBreakpoint } from './breakpoint/breakpoint-marker';
29
29
  import { BreakpointManager } from './breakpoint/breakpoint-manager';
30
30
  import { DebugConfigurationManager } from './debug-configuration-manager';
31
31
  import { DebugState, DebugSession } from './debug-session';
@@ -499,11 +499,7 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
499
499
  isEnabled: () => !!this.editors.model && !this.editors.anyBreakpoint()
500
500
  });
501
501
  registry.registerCommand(DebugCommands.ADD_FUNCTION_BREAKPOINT, {
502
- execute: async () => {
503
- const { labelProvider, breakpointManager, editorManager } = this;
504
- const options = { labelProvider, breakpoints: breakpointManager, editorManager };
505
- await new DebugFunctionBreakpoint(FunctionBreakpoint.create({ name: '' }), options).open();
506
- },
502
+ execute: async () => DebugFunctionBreakpoint.editOrCreate(this.breakpointManager),
507
503
  isEnabled: widget => !(widget instanceof Widget) || widget instanceof DebugBreakpointsWidget,
508
504
  isVisible: widget => !(widget instanceof Widget) || widget instanceof DebugBreakpointsWidget
509
505
  });
@@ -557,8 +553,8 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
557
553
  await selectedExceptionBreakpoint.editCondition();
558
554
  }
559
555
  },
560
- isEnabled: () => !!this.selectedExceptionBreakpoint?.data.raw.supportsCondition,
561
- isVisible: () => !!this.selectedExceptionBreakpoint?.data.raw.supportsCondition
556
+ isEnabled: () => this.selectedBreakpoints.length === 1 && !!this.selectedExceptionBreakpoint?.origin.raw.supportsCondition,
557
+ isVisible: () => this.selectedBreakpoints.length === 1 && !!this.selectedExceptionBreakpoint?.origin.raw.supportsCondition
562
558
  });
563
559
  registry.registerCommand(DebugCommands.REMOVE_BREAKPOINT, {
564
560
  execute: () => {
@@ -1057,16 +1053,15 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
1057
1053
  return;
1058
1054
  }
1059
1055
  const breakpoint = SourceBreakpoint.create(uri, { line, column });
1060
- let shouldRemoveBreakpoint = this.breakpointManager.addBreakpoint(breakpoint);
1056
+ const breakpointsBefore = this.breakpointManager.getBreakpoints(uri);
1057
+ const breakpointToRemove = this.breakpointManager.addBreakpoint(breakpoint);
1058
+ const breakpointsAfter = this.breakpointManager.getBreakpoints(uri);
1059
+ let shouldRemoveBreakpoint = breakpointsBefore.length !== breakpointsAfter.length;
1061
1060
  const removeBreakpoint = () => {
1062
- const breakpoints = this.breakpointManager.getBreakpoints(uri);
1063
- const newBreakpoints = breakpoints.filter(bp => bp.id !== breakpoint.id);
1064
- if (breakpoints.length !== newBreakpoints.length) {
1065
- this.breakpointManager.setBreakpoints(uri, newBreakpoints);
1066
- }
1061
+ breakpointToRemove.remove();
1067
1062
  };
1068
1063
  try {
1069
- const sessionBreakpoint = await this.verifyBreakpoint(breakpoint, thread.session);
1064
+ const sessionBreakpoint = await this.verifyBreakpoint(breakpointToRemove, thread.session);
1070
1065
  if (!checkThread()) {
1071
1066
  return;
1072
1067
  }
@@ -1105,21 +1100,21 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi
1105
1100
  }
1106
1101
  }
1107
1102
 
1108
- protected async verifyBreakpoint(breakpoint: SourceBreakpoint, session: DebugSession, timeout = 2000): Promise<DebugBreakpoint | undefined> {
1109
- let sessionBreakpoint = session.getBreakpoint(breakpoint.id);
1110
- if (!sessionBreakpoint || !sessionBreakpoint.installed || !sessionBreakpoint.verified) {
1103
+ protected async verifyBreakpoint(breakpoint: DebugSourceBreakpoint, session: DebugSession, timeout = 2000): Promise<DebugBreakpoint> {
1104
+ if (!breakpoint.getDebugProtocolBreakpoint(session.id)?.verified) {
1111
1105
  try {
1112
- await waitForEvent(Event.filter(session.onDidChangeBreakpoints, () => {
1113
- sessionBreakpoint = session.getBreakpoint(breakpoint.id);
1114
- return !!sessionBreakpoint && sessionBreakpoint.installed && sessionBreakpoint.verified;
1115
- }), timeout); // wait up to `timeout` ms for the breakpoint to become installed and verified
1106
+ await waitForEvent(Event.filter(
1107
+ this.breakpointManager.onDidChangeBreakpoints,
1108
+ () => breakpoint.getDebugProtocolBreakpoint(session.id)?.verified),
1109
+ timeout // wait up to `timeout` ms for the breakpoint to become installed and verified
1110
+ );
1116
1111
  } catch (e) {
1117
1112
  if (!(e instanceof CancellationError)) { // ignore the `CancellationError` on timeout
1118
1113
  throw e;
1119
1114
  }
1120
1115
  }
1121
1116
  }
1122
- return sessionBreakpoint;
1117
+ return breakpoint;
1123
1118
  }
1124
1119
 
1125
1120
  get threads(): DebugThreadsWidget | undefined {
@@ -22,7 +22,8 @@ import { DebugWidget } from './view/debug-widget';
22
22
  import { DebugPath, DebugService } from '../common/debug-service';
23
23
  import {
24
24
  WidgetFactory, WebSocketConnectionProvider, FrontendApplicationContribution,
25
- bindViewContribution
25
+ bindViewContribution,
26
+ OpenHandler
26
27
  } from '@theia/core/lib/browser';
27
28
  import { DebugSessionManager } from './debug-session-manager';
28
29
  import { DebugResourceResolver } from './debug-resource';
@@ -66,6 +67,7 @@ import { ICodeEditorService } from '@theia/monaco-editor-core/esm/vs/editor/brow
66
67
  import { DebugSessionConfigurationLabelProvider } from './debug-session-configuration-label-provider';
67
68
  import { AddOrEditDataBreakpointAddress } from './breakpoint/debug-data-breakpoint-actions';
68
69
  import { WorkspaceRestrictionContribution, WorkspaceRestriction } from '@theia/workspace/lib/browser/workspace-trust-service';
70
+ import { DebugBreakpointOpener } from './model/debug-breakpoint-opener';
69
71
 
70
72
  export default new ContainerModule((bind: interfaces.Bind) => {
71
73
  bindRootContributionProvider(bind, DebugContribution);
@@ -138,6 +140,8 @@ export default new ContainerModule((bind: interfaces.Bind) => {
138
140
 
139
141
  bind(DebugSessionConfigurationLabelProvider).toSelf().inSingletonScope();
140
142
  bind(AddOrEditDataBreakpointAddress).toSelf().inSingletonScope();
143
+ bind(DebugBreakpointOpener).toSelf().inSingletonScope();
144
+ bind(OpenHandler).toService(DebugBreakpointOpener);
141
145
 
142
146
  bind(WorkspaceRestrictionContribution).toConstantValue({
143
147
  getRestrictions(): WorkspaceRestriction[] {
@@ -14,35 +14,30 @@
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
16
 
17
- import { CommandService, DisposableCollection, Emitter, Event, MessageService, nls, ProgressService, WaitUntilEvent } from '@theia/core';
18
- import { LabelProvider, ApplicationShell, ConfirmDialog } from '@theia/core/lib/browser';
19
- import { WindowService } from '@theia/core/lib/browser/window/window-service';
20
- import { WorkspaceTrustService } from '@theia/workspace/lib/browser';
17
+ import { DisposableCollection, Emitter, Event, MessageService, nls, ProgressService, WaitUntilEvent } from '@theia/core';
18
+ import { ApplicationShell, ConfirmDialog } from '@theia/core/lib/browser';
21
19
  import { ContextKey, ContextKeyService } from '@theia/core/lib/browser/context-key-service';
20
+ import { WindowService } from '@theia/core/lib/browser/window/window-service';
22
21
  import URI from '@theia/core/lib/common/uri';
23
- import { EditorManager } from '@theia/editor/lib/browser';
22
+ import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
23
+ import * as monaco from '@theia/monaco-editor-core';
24
24
  import { QuickOpenTask } from '@theia/task/lib/browser/quick-open-task';
25
- import { TaskService, TaskEndedInfo, TaskEndedTypes } from '@theia/task/lib/browser/task-service';
25
+ import { TaskEndedInfo, TaskEndedTypes, TaskService } from '@theia/task/lib/browser/task-service';
26
+ import { TaskIdentifier } from '@theia/task/lib/common';
26
27
  import { VariableResolverService } from '@theia/variable-resolver/lib/browser';
27
- import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
28
+ import { WorkspaceTrustService } from '@theia/workspace/lib/browser';
28
29
  import { DebugConfiguration } from '../common/debug-common';
29
30
  import { DebugPreferences } from '../common/debug-preferences';
30
31
  import { DebugError, DebugService } from '../common/debug-service';
31
32
  import { BreakpointManager } from './breakpoint/breakpoint-manager';
33
+ import { DebugVariable } from './console/debug-console-items';
32
34
  import { DebugConfigurationManager } from './debug-configuration-manager';
33
35
  import { DebugSession, DebugState, debugStateContextValue } from './debug-session';
36
+ import { DebugSessionConfigurationLabelProvider } from './debug-session-configuration-label-provider';
34
37
  import { DebugSessionContributionRegistry, DebugSessionFactory } from './debug-session-contribution';
35
38
  import { DebugCompoundRoot, DebugCompoundSessionOptions, DebugConfigurationSessionOptions, DebugSessionOptions, InternalDebugSessionOptions } from './debug-session-options';
36
39
  import { DebugStackFrame } from './model/debug-stack-frame';
37
40
  import { DebugThread } from './model/debug-thread';
38
- import { TaskIdentifier } from '@theia/task/lib/common';
39
- import { DebugSourceBreakpoint } from './model/debug-source-breakpoint';
40
- import { DebugFunctionBreakpoint } from './model/debug-function-breakpoint';
41
- import * as monaco from '@theia/monaco-editor-core';
42
- import { DebugInstructionBreakpoint } from './model/debug-instruction-breakpoint';
43
- import { DebugSessionConfigurationLabelProvider } from './debug-session-configuration-label-provider';
44
- import { DebugDataBreakpoint } from './model/debug-data-breakpoint';
45
- import { DebugVariable } from './console/debug-console-items';
46
41
 
47
42
  export interface WillStartDebugSession extends WaitUntilEvent {
48
43
  }
@@ -106,12 +101,6 @@ export class DebugSessionManager {
106
101
  protected readonly onDidFocusThreadEmitter = new Emitter<DebugThread | undefined>();
107
102
  readonly onDidFocusThread = this.onDidFocusThreadEmitter.event;
108
103
 
109
- protected readonly onDidChangeBreakpointsEmitter = new Emitter<DidChangeBreakpointsEvent>();
110
- readonly onDidChangeBreakpoints = this.onDidChangeBreakpointsEmitter.event;
111
- protected fireDidChangeBreakpoints(event: DidChangeBreakpointsEvent): void {
112
- this.onDidChangeBreakpointsEmitter.fire(event);
113
- }
114
-
115
104
  protected readonly onDidChangeEmitter = new Emitter<DebugSession | undefined>();
116
105
  readonly onDidChange: Event<DebugSession | undefined> = this.onDidChangeEmitter.event;
117
106
  protected fireDidChange(current: DebugSession | undefined): void {
@@ -130,15 +119,6 @@ export class DebugSessionManager {
130
119
  @inject(DebugService)
131
120
  protected readonly debug: DebugService;
132
121
 
133
- @inject(LabelProvider)
134
- protected readonly labelProvider: LabelProvider;
135
-
136
- @inject(EditorManager)
137
- protected readonly editorManager: EditorManager;
138
-
139
- @inject(CommandService)
140
- protected commandService: CommandService;
141
-
142
122
  @inject(BreakpointManager)
143
123
  protected readonly breakpoints: BreakpointManager;
144
124
 
@@ -190,15 +170,6 @@ export class DebugSessionManager {
190
170
  this.debugTypeKey = this.contextKeyService.createKey<string>('debugType', undefined);
191
171
  this.inDebugModeKey = this.contextKeyService.createKey<boolean>('inDebugMode', this.inDebugMode);
192
172
  this.debugStateKey = this.contextKeyService.createKey<string>('debugState', debugStateContextValue(this.state));
193
- this.breakpoints.onDidChangeMarkers(uri => this.fireDidChangeBreakpoints({ uri }));
194
- this.labelProvider.onDidChange(event => {
195
- for (const uriString of this.breakpoints.getUris()) {
196
- const uri = new URI(uriString);
197
- if (event.affects(uri)) {
198
- this.fireDidChangeBreakpoints({ uri });
199
- }
200
- }
201
- });
202
173
  }
203
174
 
204
175
  get inDebugMode(): boolean {
@@ -463,7 +434,6 @@ export class DebugSessionManager {
463
434
  // The selection logic in widgets will handle not jumping to non-stopped threads
464
435
  this.fireDidChange(session);
465
436
  });
466
- session.onDidChangeBreakpoints(uri => this.fireDidChangeBreakpoints({ session, uri }));
467
437
  session.on('terminated', async event => {
468
438
  const restart = event.body && event.body.restart;
469
439
  if (restart) {
@@ -499,17 +469,16 @@ export class DebugSessionManager {
499
469
  }
500
470
 
501
471
  protected cleanup(session: DebugSession): void {
502
- // Data breakpoints belonging to this session that can't persist and aren't verified by some other session should be removed.
472
+ // Data breakpoints that can't persist should be removed when a session ends.
503
473
  const currentDataBreakpoints = this.breakpoints.getDataBreakpoints();
504
- const toRemove = currentDataBreakpoints.filter(candidate => !candidate.info.canPersist && this.sessions.every(otherSession => otherSession !== session
505
- && otherSession.getDataBreakpoints().every(otherSessionBp => otherSessionBp.id !== candidate.id || !otherSessionBp.verified)))
506
- .map(bp => bp.id);
507
- const toRetain = this.breakpoints.getDataBreakpoints().filter(candidate => !toRemove.includes(candidate.id));
474
+ const toRetain = currentDataBreakpoints.filter(candidate => candidate.origin.info.canPersist);
508
475
  if (currentDataBreakpoints.length !== toRetain.length) {
509
- this.breakpoints.setDataBreakpoints(toRetain);
476
+ this.breakpoints.setDataBreakpoints(toRetain.map(bp => bp.origin));
510
477
  }
511
478
  if (this.remove(session.id)) {
512
479
  this.onDidDestroyDebugSessionEmitter.fire(session);
480
+ this.breakpoints.updateSessionData(session.id, session.capabilities);
481
+ this.breakpoints.clearExceptionSessionEnablement(session.id);
513
482
  }
514
483
  }
515
484
 
@@ -599,7 +568,6 @@ export class DebugSessionManager {
599
568
  const { currentThread } = current;
600
569
  this.onDidFocusThreadEmitter.fire(currentThread);
601
570
  }
602
- this.updateBreakpoints(previous, current);
603
571
  this.open();
604
572
  this.fireDidChange(current);
605
573
  }
@@ -616,22 +584,6 @@ export class DebugSessionManager {
616
584
  }
617
585
  }
618
586
  }
619
- protected updateBreakpoints(previous: DebugSession | undefined, current: DebugSession | undefined): void {
620
- const affectedUri = new Set();
621
- for (const session of [previous, current]) {
622
- if (session) {
623
- for (const uriString of session.breakpointUris) {
624
- if (!affectedUri.has(uriString)) {
625
- affectedUri.add(uriString);
626
- this.fireDidChangeBreakpoints({
627
- session: current,
628
- uri: new URI(uriString)
629
- });
630
- }
631
- }
632
- }
633
- }
634
- }
635
587
  protected updateCurrentSession(session: DebugSession | undefined): void {
636
588
  this.currentSession = session || this.sessions[0];
637
589
  }
@@ -655,90 +607,6 @@ export class DebugSessionManager {
655
607
  return currentThread && currentThread.topFrame;
656
608
  }
657
609
 
658
- getFunctionBreakpoints(session?: DebugSession): DebugFunctionBreakpoint[] {
659
- if (session && session.state > DebugState.Initializing) {
660
- return session.getFunctionBreakpoints();
661
- }
662
- const { labelProvider, breakpoints, editorManager } = this;
663
- return this.breakpoints.getFunctionBreakpoints().map(origin => new DebugFunctionBreakpoint(origin, { labelProvider, breakpoints, editorManager }));
664
- }
665
-
666
- getInstructionBreakpoints(session?: DebugSession): DebugInstructionBreakpoint[] {
667
- if (session && session.state > DebugState.Initializing) {
668
- return session.getInstructionBreakpoints();
669
- }
670
- const { labelProvider, breakpoints, editorManager } = this;
671
- return this.breakpoints.getInstructionBreakpoints().map(origin => new DebugInstructionBreakpoint(origin, { labelProvider, breakpoints, editorManager }));
672
- }
673
-
674
- getDataBreakpoints(session = this.currentSession): DebugDataBreakpoint[] {
675
- if (session && session.state > DebugState.Initializing) {
676
- return session.getDataBreakpoints();
677
- }
678
- const { labelProvider, breakpoints, editorManager } = this;
679
- return this.breakpoints.getDataBreakpoints().map(origin => new DebugDataBreakpoint(origin, { labelProvider, breakpoints, editorManager }));
680
- }
681
-
682
- getBreakpoints(session?: DebugSession): DebugSourceBreakpoint[];
683
- getBreakpoints(uri: URI, session?: DebugSession): DebugSourceBreakpoint[];
684
- getBreakpoints(arg?: URI | DebugSession, arg2?: DebugSession): DebugSourceBreakpoint[] {
685
- const uri = arg instanceof URI ? arg : undefined;
686
- const session = arg instanceof DebugSession ? arg : arg2 instanceof DebugSession ? arg2 : undefined;
687
- if (session && session.state > DebugState.Initializing) {
688
- return session.getSourceBreakpoints(uri);
689
- }
690
-
691
- const activeSessions = this.sessions.filter(s => s.state > DebugState.Initializing);
692
-
693
- // Start with all breakpoints from markers (not installed = shows as filled circle)
694
- const { labelProvider, breakpoints, editorManager } = this;
695
- const breakpointMap = new Map<string, DebugSourceBreakpoint>();
696
- const markers = this.breakpoints.findMarkers({ uri });
697
-
698
- for (const { data } of markers) {
699
- const bp = new DebugSourceBreakpoint(data, { labelProvider, breakpoints, editorManager }, this.commandService);
700
- breakpointMap.set(bp.id, bp);
701
- }
702
-
703
- // Overlay with VERIFIED breakpoints from active sessions only
704
- // We only replace a marker-based breakpoint if the session has VERIFIED it
705
- // This ensures breakpoints show as filled (not installed) rather than hollow (installed but unverified)
706
- for (const activeSession of activeSessions) {
707
- const sessionBps = activeSession.getSourceBreakpoints(uri);
708
-
709
- for (const bp of sessionBps) {
710
- if (bp.verified) {
711
- // Session has verified this breakpoint - use the session's version
712
- breakpointMap.set(bp.id, bp);
713
- }
714
- // If not verified, keep the marker-based one (shows as not installed = filled circle)
715
- }
716
- }
717
-
718
- return Array.from(breakpointMap.values());
719
- }
720
-
721
- getLineBreakpoints(uri: URI, line: number): DebugSourceBreakpoint[] {
722
- const session = this.currentSession;
723
- if (session && session.state > DebugState.Initializing) {
724
- return session.getSourceBreakpoints(uri).filter(breakpoint => breakpoint.line === line);
725
- }
726
- const { labelProvider, breakpoints, editorManager } = this;
727
- return this.breakpoints.getLineBreakpoints(uri, line).map(origin =>
728
- new DebugSourceBreakpoint(origin, { labelProvider, breakpoints, editorManager }, this.commandService)
729
- );
730
- }
731
-
732
- getInlineBreakpoint(uri: URI, line: number, column: number): DebugSourceBreakpoint | undefined {
733
- const session = this.currentSession;
734
- if (session && session.state > DebugState.Initializing) {
735
- return session.getSourceBreakpoints(uri).filter(breakpoint => breakpoint.line === line && breakpoint.column === column)[0];
736
- }
737
- const origin = this.breakpoints.getInlineBreakpoint(uri, line, column);
738
- const { labelProvider, breakpoints, editorManager } = this;
739
- return origin && new DebugSourceBreakpoint(origin, { labelProvider, breakpoints, editorManager }, this.commandService);
740
- }
741
-
742
610
  /**
743
611
  * Runs the given tasks.
744
612
  * @param taskName the task name to run, see [TaskNameResolver](#TaskNameResolver)