@theia/debug 1.70.0-next.81 → 1.71.0-next.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
@@ -17,19 +17,24 @@
17
17
  var BreakpointManager_1;
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.BreakpointManager = void 0;
20
- exports.diff = diff;
21
20
  const tslib_1 = require("tslib");
22
- const deepEqual = require("fast-deep-equal");
23
21
  const inversify_1 = require("@theia/core/shared/inversify");
24
22
  const common_1 = require("@theia/core/lib/common");
25
23
  const browser_1 = require("@theia/core/lib/browser");
26
- const marker_manager_1 = require("@theia/markers/lib/browser/marker-manager");
27
24
  const uri_1 = require("@theia/core/lib/common/uri");
28
25
  const breakpoint_marker_1 = require("./breakpoint-marker");
29
- let BreakpointManager = class BreakpointManager extends marker_manager_1.MarkerManager {
26
+ const debug_source_breakpoint_1 = require("../model/debug-source-breakpoint");
27
+ const debug_function_breakpoint_1 = require("../model/debug-function-breakpoint");
28
+ const debug_instruction_breakpoint_1 = require("../model/debug-instruction-breakpoint");
29
+ const debug_exception_breakpoint_1 = require("../view/debug-exception-breakpoint");
30
+ const debug_data_breakpoint_1 = require("../model/debug-data-breakpoint");
31
+ const file_service_1 = require("@theia/filesystem/lib/browser/file-service");
32
+ let BreakpointManager = class BreakpointManager {
30
33
  constructor() {
31
- super(...arguments);
32
- this.owner = 'breakpoint';
34
+ // ── Source breakpoints, keyed by URI string ──
35
+ this.sourceBreakpoints = new Map();
36
+ // ── Events ──
37
+ this.onDidChangeMarkersEmitter = new common_1.Emitter();
33
38
  this.onDidChangeBreakpointsEmitter = new common_1.Emitter();
34
39
  this.onDidChangeBreakpoints = this.onDidChangeBreakpointsEmitter.event;
35
40
  this.onDidChangeFunctionBreakpointsEmitter = new common_1.Emitter();
@@ -38,10 +43,15 @@ let BreakpointManager = class BreakpointManager extends marker_manager_1.MarkerM
38
43
  this.onDidChangeInstructionBreakpoints = this.onDidChangeInstructionBreakpointsEmitter.event;
39
44
  this.onDidChangeDataBreakpointsEmitter = new common_1.Emitter();
40
45
  this.onDidChangeDataBreakpoints = this.onDidChangeDataBreakpointsEmitter.event;
46
+ // ── Enable / disable ──
41
47
  this._breakpointsEnabled = true;
42
- this.exceptionBreakpoints = new Map();
48
+ // ── Exception breakpoints ──
49
+ this.exceptionBreakpoints = new Array();
50
+ // ── Function breakpoints ──
43
51
  this.functionBreakpoints = [];
52
+ // ── Instruction breakpoints ──
44
53
  this.instructionBreakpoints = [];
54
+ // ── Data breakpoints ──
45
55
  this.dataBreakpoints = [];
46
56
  }
47
57
  static { BreakpointManager_1 = this; }
@@ -49,142 +59,419 @@ let BreakpointManager = class BreakpointManager extends marker_manager_1.MarkerM
49
59
  static { this.FUNCTION_URI = new uri_1.default('debug:function://'); }
50
60
  static { this.INSTRUCTION_URI = new uri_1.default('debug:instruction://'); }
51
61
  static { this.DATA_URI = new uri_1.default('debug:data://'); }
52
- getKind() {
53
- return breakpoint_marker_1.BREAKPOINT_KIND;
62
+ get onDidChangeMarkers() {
63
+ return this.onDidChangeMarkersEmitter.event;
64
+ }
65
+ fireOnDidChangeMarkers(uri) {
66
+ this.onDidChangeMarkersEmitter.fire(uri);
67
+ }
68
+ // ── Initialization ──
69
+ init() {
70
+ this.fileService.onDidFilesChange(event => {
71
+ if (event.gotDeleted()) {
72
+ for (const uriString of this.sourceBreakpoints.keys()) {
73
+ const uri = new uri_1.default(uriString);
74
+ if (event.contains(uri, 2 /* FileChangeType.DELETED */)) {
75
+ this.sourceBreakpoints.delete(uriString);
76
+ this.fireOnDidChangeMarkers(uri);
77
+ }
78
+ }
79
+ }
80
+ });
81
+ }
82
+ // ── Source breakpoint storage ──
83
+ getBreakpoints(uri) {
84
+ if (uri) {
85
+ return this.sourceBreakpoints.get(uri.toString()) ?? [];
86
+ }
87
+ const result = [];
88
+ for (const bps of this.sourceBreakpoints.values()) {
89
+ result.push(...bps);
90
+ }
91
+ return result;
92
+ }
93
+ getUris() {
94
+ return this.sourceBreakpoints.keys();
95
+ }
96
+ hasBreakpoints() {
97
+ return this.sourceBreakpoints.size > 0 || this.functionBreakpoints.length > 0 || this.instructionBreakpoints.length > 0;
98
+ }
99
+ /**
100
+ * Replace the source breakpoints for a URI. Incoming `breakpoints` are
101
+ * plain `SourceBreakpoint` data; existing `DebugSourceBreakpoint` wrappers
102
+ * are preserved by ID so that session data survives position changes.
103
+ */
104
+ setBreakpoints(uri, breakpoints) {
105
+ const current = this.getBreakpoints(uri);
106
+ const currentById = new Map(current.map(bp => [bp.id, bp]));
107
+ const sorted = breakpoints
108
+ .slice()
109
+ .sort((a, b) => (a.raw.line - b.raw.line) || ((a.raw.column || 0) - (b.raw.column || 0)));
110
+ const seen = new Set();
111
+ const newBps = [];
112
+ for (const bp of sorted) {
113
+ const posKey = `${bp.raw.line}:${bp.raw.column ?? 0}`;
114
+ if (seen.has(posKey)) {
115
+ continue;
116
+ }
117
+ seen.add(posKey);
118
+ // Prefer matching by ID (preserves identity across position changes).
119
+ const existing = currentById.get(bp.id);
120
+ if (existing) {
121
+ existing.origin.raw = bp.raw;
122
+ existing.origin.enabled = bp.enabled;
123
+ newBps.push(existing);
124
+ }
125
+ else {
126
+ newBps.push(this.toDebugSourceBreakpoint(bp));
127
+ }
128
+ }
129
+ this.applySourceBreakpoints(uri, newBps, current);
54
130
  }
55
- setMarkers(uri, owner, newMarkers) {
56
- const result = this.findMarkers({ uri, owner });
131
+ addBreakpoint(breakpoint) {
132
+ const uri = new uri_1.default(breakpoint.uri);
133
+ const current = this.getBreakpoints(uri);
134
+ // Check for positional duplicate.
135
+ const duplicate = current.find(c => c.line === breakpoint.raw.line && c.column === breakpoint.raw.column);
136
+ if (duplicate) {
137
+ return duplicate;
138
+ }
139
+ const bp = this.toDebugSourceBreakpoint(breakpoint);
140
+ const newBps = [...current, bp];
141
+ this.applySourceBreakpoints(uri, newBps, current);
142
+ return bp;
143
+ }
144
+ removeBreakpoint(breakpoint) {
145
+ const current = this.getBreakpoints(breakpoint.uri);
146
+ const index = current.indexOf(breakpoint);
147
+ if (index === -1) {
148
+ return;
149
+ }
150
+ const retained = [...current.slice(0, index), ...current.slice(index + 1)];
151
+ this.applySourceBreakpoints(breakpoint.uri, retained, current);
152
+ }
153
+ /**
154
+ * Diff `oldBps` → `newBps`, store, fire markers and typed events.
155
+ * Both arrays must be for the same URI.
156
+ */
157
+ applySourceBreakpoints(uri, newBps, oldBps) {
158
+ const oldById = new Map(oldBps.map(bp => [bp.id, bp]));
57
159
  const added = [];
58
- const removed = [];
59
160
  const changed = [];
60
- const oldMarkers = new Map(result.map(({ data }) => [data.id, data]));
61
- const ids = new Set();
62
- let didChangeMarkers = false;
63
- for (const newMarker of newMarkers) {
64
- ids.add(newMarker.id);
65
- const oldMarker = oldMarkers.get(newMarker.id);
66
- if (!oldMarker) {
67
- added.push(newMarker);
161
+ let didChange = false;
162
+ for (const bp of newBps) {
163
+ const old = oldById.get(bp.id);
164
+ if (!old) {
165
+ added.push(bp);
166
+ didChange = true;
68
167
  }
69
168
  else {
70
- // We emit all existing markers as 'changed', but we only fire an event if something really did change.
71
- // We also fire an event if oldMarker === newMarker, as we cannot actually detect a change in this case
72
- // (https://github.com/eclipse-theia/theia/issues/12546).
73
- didChangeMarkers ||= !!added.length || oldMarker === newMarker || !deepEqual(oldMarker, newMarker);
74
- changed.push(newMarker);
169
+ changed.push(bp);
170
+ // Identity match: the wrapper was mutated in place, or the same
171
+ // object was passed back (editor model position update).
172
+ // Either way we must re-fire to keep decorations in sync.
173
+ didChange = true;
174
+ oldById.delete(bp.id);
75
175
  }
76
176
  }
77
- for (const [id, data] of oldMarkers.entries()) {
78
- if (!ids.has(id)) {
79
- removed.push(data);
80
- }
177
+ const removed = Array.from(oldById.values());
178
+ didChange ||= removed.length > 0;
179
+ if (!didChange) {
180
+ return;
81
181
  }
82
- if (added.length || removed.length || didChangeMarkers) {
83
- super.setMarkers(uri, owner, newMarkers);
84
- this.onDidChangeBreakpointsEmitter.fire({ uri, added, removed, changed });
182
+ if (newBps.length > 0) {
183
+ this.sourceBreakpoints.set(uri.toString(), [...newBps]);
85
184
  }
86
- return result;
185
+ else {
186
+ this.sourceBreakpoints.delete(uri.toString());
187
+ }
188
+ this.fireOnDidChangeMarkers(uri);
189
+ this.onDidChangeBreakpointsEmitter.fire({ uri, added, removed, changed });
190
+ }
191
+ removeBreakpoints() {
192
+ for (const uriString of [...this.sourceBreakpoints.keys()]) {
193
+ const uri = new uri_1.default(uriString);
194
+ const old = this.sourceBreakpoints.get(uriString) ?? [];
195
+ this.sourceBreakpoints.delete(uriString);
196
+ this.fireOnDidChangeMarkers(uri);
197
+ if (old.length) {
198
+ this.onDidChangeBreakpointsEmitter.fire({ uri, added: [], removed: old, changed: [] });
199
+ }
200
+ }
201
+ this.setFunctionBreakpoints([]);
202
+ this.setInstructionBreakpoints([]);
203
+ this.setDataBreakpoints([]);
87
204
  }
205
+ // ── Query helpers ──
88
206
  getLineBreakpoints(uri, line) {
89
- return this.findMarkers({
90
- uri,
91
- dataFilter: breakpoint => breakpoint.raw.line === line
92
- }).map(({ data }) => data);
207
+ return this.getBreakpoints(uri).filter(bp => bp.line === line);
93
208
  }
94
209
  getInlineBreakpoint(uri, line, column) {
95
- const marker = this.findMarkers({
96
- uri,
97
- dataFilter: breakpoint => breakpoint.raw.line === line && breakpoint.raw.column === column
98
- })[0];
99
- return marker && marker.data;
210
+ return this.getBreakpoints(uri).find(bp => bp.line === line && bp.column === column);
100
211
  }
101
- getBreakpoints(uri) {
102
- return this.findMarkers({ uri }).map(marker => marker.data);
212
+ getBreakpointById(id) {
213
+ for (const bp of this.allBreakpoints()) {
214
+ if (bp.id === id) {
215
+ return bp;
216
+ }
217
+ }
103
218
  }
104
- setBreakpoints(uri, breakpoints) {
105
- this.setMarkers(uri, this.owner, breakpoints.sort((a, b) => (a.raw.line - b.raw.line) || ((a.raw.column || 0) - (b.raw.column || 0))));
219
+ *allBreakpoints() {
220
+ for (const bps of this.sourceBreakpoints.values()) {
221
+ yield* bps;
222
+ }
223
+ yield* this.functionBreakpoints;
224
+ yield* this.instructionBreakpoints;
225
+ yield* this.exceptionBreakpoints;
226
+ yield* this.dataBreakpoints;
227
+ }
228
+ // ── Session data ──
229
+ updateSessionData(sessionId, sessionCapabilities, bps) {
230
+ const bpCapabilities = this.toBpCapabilities(sessionCapabilities);
231
+ const updatedUris = new Map();
232
+ for (const bp of this.allBreakpoints()) {
233
+ if (!bps) {
234
+ if (bp.update(sessionId, undefined)) {
235
+ common_1.MapUtils.addOrInsertWith(updatedUris, bp.uri.toString(), bp);
236
+ }
237
+ }
238
+ else {
239
+ const dataForBp = bps.get(bp.id);
240
+ if (!dataForBp) {
241
+ continue;
242
+ }
243
+ bp.update(sessionId, { ...bpCapabilities, ...dataForBp });
244
+ common_1.MapUtils.addOrInsertWith(updatedUris, bp.uri.toString(), bp);
245
+ }
246
+ }
247
+ for (const changed of updatedUris.values()) {
248
+ this.fireTypedBreakpointEvent(changed[0].uri, [], changed, []);
249
+ }
106
250
  }
107
- addBreakpoint(breakpoint) {
108
- const uri = new uri_1.default(breakpoint.uri);
109
- const breakpoints = this.getBreakpoints(uri);
110
- const newBreakpoints = breakpoints.filter(({ raw }) => !(raw.line === breakpoint.raw.line && raw.column === breakpoint.raw.column));
111
- if (breakpoints.length === newBreakpoints.length) {
112
- newBreakpoints.push(breakpoint);
113
- this.setBreakpoints(uri, newBreakpoints);
114
- return true;
251
+ toBpCapabilities(capabilities) {
252
+ return {
253
+ supportsConditionalBreakpoints: !!capabilities.supportsConditionalBreakpoints,
254
+ supportsHitConditionalBreakpoints: !!capabilities.supportsHitConditionalBreakpoints,
255
+ supportsLogPoints: !!capabilities.supportsLogPoints,
256
+ supportsFunctionBreakpoints: !!capabilities.supportsFunctionBreakpoints,
257
+ supportsDataBreakpoints: !!capabilities.supportsDataBreakpoints,
258
+ supportsInstructionBreakpoints: !!capabilities.supportsInstructionBreakpoints,
259
+ };
260
+ }
261
+ // ── Breakpoint construction ──
262
+ toDebugSourceBreakpoint(source) {
263
+ return debug_source_breakpoint_1.DebugSourceBreakpoint.create(source, this.getBreakpointOptions());
264
+ }
265
+ getBreakpointOptions() {
266
+ if (!this._breakpointOptions) {
267
+ this._breakpointOptions = {
268
+ labelProvider: this.labelProvider,
269
+ openerService: this.openerService,
270
+ commandService: this.commandService,
271
+ breakpoints: this
272
+ };
273
+ }
274
+ return this._breakpointOptions;
275
+ }
276
+ get breakpointsEnabled() {
277
+ return this._breakpointsEnabled;
278
+ }
279
+ set breakpointsEnabled(breakpointsEnabled) {
280
+ if (this._breakpointsEnabled !== breakpointsEnabled) {
281
+ this._breakpointsEnabled = breakpointsEnabled;
282
+ for (const uri of this.getUris()) {
283
+ this.fireOnDidChangeMarkers(new uri_1.default(uri));
284
+ }
285
+ this.fireOnDidChangeMarkers(BreakpointManager_1.FUNCTION_URI);
286
+ this.fireOnDidChangeMarkers(BreakpointManager_1.INSTRUCTION_URI);
287
+ this.fireOnDidChangeMarkers(BreakpointManager_1.DATA_URI);
288
+ this.fireOnDidChangeMarkers(BreakpointManager_1.EXCEPTION_URI);
115
289
  }
116
- return false;
117
290
  }
118
291
  enableAllBreakpoints(enabled) {
119
292
  for (const uriString of this.getUris()) {
120
293
  let didChange = false;
121
294
  const uri = new uri_1.default(uriString);
122
- const markers = this.findMarkers({ uri });
123
- for (const marker of markers) {
124
- if (marker.data.enabled !== enabled) {
125
- marker.data.enabled = enabled;
126
- didChange = true;
127
- }
295
+ const bps = this.getBreakpoints(uri);
296
+ for (const bp of bps) {
297
+ didChange ||= this.doEnableBreakpoint(bp, enabled);
128
298
  }
129
299
  if (didChange) {
130
300
  this.fireOnDidChangeMarkers(uri);
301
+ this.onDidChangeBreakpointsEmitter.fire({ uri, added: [], removed: [], changed: [...bps] });
131
302
  }
132
303
  }
133
304
  let didChangeFunction = false;
134
- for (const breakpoint of this.getFunctionBreakpoints().concat(this.getInstructionBreakpoints())) {
135
- if (breakpoint.enabled !== enabled) {
136
- breakpoint.enabled = enabled;
305
+ for (const breakpoint of this.functionBreakpoints) {
306
+ if (breakpoint.origin.enabled !== enabled) {
307
+ breakpoint.origin.enabled = enabled;
137
308
  didChangeFunction = true;
138
309
  }
139
310
  }
140
311
  if (didChangeFunction) {
141
312
  this.fireOnDidChangeMarkers(BreakpointManager_1.FUNCTION_URI);
313
+ this.onDidChangeFunctionBreakpointsEmitter.fire({
314
+ uri: BreakpointManager_1.FUNCTION_URI, added: [], removed: [], changed: [...this.functionBreakpoints]
315
+ });
316
+ }
317
+ let didChangeInstruction = false;
318
+ for (const breakpoint of this.instructionBreakpoints) {
319
+ if (breakpoint.origin.enabled !== enabled) {
320
+ breakpoint.origin.enabled = enabled;
321
+ didChangeInstruction = true;
322
+ }
323
+ }
324
+ if (didChangeInstruction) {
325
+ this.fireOnDidChangeMarkers(BreakpointManager_1.INSTRUCTION_URI);
326
+ this.onDidChangeInstructionBreakpointsEmitter.fire({
327
+ uri: BreakpointManager_1.INSTRUCTION_URI, added: [], removed: [], changed: [...this.instructionBreakpoints]
328
+ });
329
+ }
330
+ let didChangeData = false;
331
+ for (const breakpoint of this.dataBreakpoints) {
332
+ if (breakpoint.origin.enabled !== enabled) {
333
+ breakpoint.origin.enabled = enabled;
334
+ didChangeData = true;
335
+ }
336
+ }
337
+ if (didChangeData) {
338
+ this.fireOnDidChangeMarkers(BreakpointManager_1.DATA_URI);
339
+ this.onDidChangeDataBreakpointsEmitter.fire({
340
+ uri: BreakpointManager_1.DATA_URI, added: [], removed: [], changed: [...this.dataBreakpoints]
341
+ });
142
342
  }
143
343
  }
144
- get breakpointsEnabled() {
145
- return this._breakpointsEnabled;
344
+ enableBreakpoint(breakpoint, enabled) {
345
+ const didChange = this.doEnableBreakpoint(breakpoint, enabled);
346
+ if (didChange) {
347
+ this.fireBreakpointChanged(breakpoint);
348
+ }
146
349
  }
147
- set breakpointsEnabled(breakpointsEnabled) {
148
- if (this._breakpointsEnabled !== breakpointsEnabled) {
149
- this._breakpointsEnabled = breakpointsEnabled;
150
- for (const uri of this.getUris()) {
151
- this.fireOnDidChangeMarkers(new uri_1.default(uri));
350
+ doEnableBreakpoint(breakpoint, enabled) {
351
+ if (breakpoint.origin.enabled !== enabled) {
352
+ breakpoint.origin.enabled = enabled;
353
+ return true;
354
+ }
355
+ return false;
356
+ }
357
+ // ── Generic update / fire ──
358
+ updateBreakpoint(bp, update) {
359
+ bp.origin.raw = { ...bp.origin.raw, ...update };
360
+ this.fireBreakpointChanged(bp);
361
+ }
362
+ fireBreakpointChanged(breakpoint) {
363
+ this.fireOnDidChangeMarkers(breakpoint.uri);
364
+ this.fireTypedBreakpointEvent(breakpoint.uri, [], [breakpoint], []);
365
+ }
366
+ fireTypedBreakpointEvent(uri, added, changed, removed) {
367
+ // All breakpoints in a single call are the same type (grouped by URI).
368
+ const sample = added[0] ?? changed[0] ?? removed[0];
369
+ if (!sample) {
370
+ return;
371
+ }
372
+ if (sample instanceof debug_source_breakpoint_1.DebugSourceBreakpoint) {
373
+ this.onDidChangeBreakpointsEmitter.fire({ uri, added, changed, removed });
374
+ }
375
+ else if (sample instanceof debug_function_breakpoint_1.DebugFunctionBreakpoint) {
376
+ this.onDidChangeFunctionBreakpointsEmitter.fire({ uri, added, changed, removed });
377
+ }
378
+ else if (sample instanceof debug_instruction_breakpoint_1.DebugInstructionBreakpoint) {
379
+ this.onDidChangeInstructionBreakpointsEmitter.fire({ uri, added, changed, removed });
380
+ }
381
+ else if (sample instanceof debug_data_breakpoint_1.DebugDataBreakpoint) {
382
+ this.onDidChangeDataBreakpointsEmitter.fire({ uri, added, changed, removed });
383
+ }
384
+ }
385
+ // ── Bulk remove by ID (plugin API) ──
386
+ removeBreakpointsById(ids) {
387
+ const toRemove = new Set(ids);
388
+ // Source breakpoints
389
+ for (const [uriString, bps] of this.sourceBreakpoints.entries()) {
390
+ const retained = bps.filter(bp => !toRemove.has(bp.id));
391
+ if (retained.length !== bps.length) {
392
+ const removed = bps.filter(bp => toRemove.has(bp.id));
393
+ const uri = new uri_1.default(uriString);
394
+ if (retained.length > 0) {
395
+ this.sourceBreakpoints.set(uriString, retained);
396
+ }
397
+ else {
398
+ this.sourceBreakpoints.delete(uriString);
399
+ }
400
+ this.fireOnDidChangeMarkers(uri);
401
+ this.onDidChangeBreakpointsEmitter.fire({ uri, removed, added: [], changed: [] });
402
+ }
403
+ }
404
+ // Function breakpoints
405
+ const functionRemoved = [];
406
+ this.functionBreakpoints = this.functionBreakpoints.filter(bp => {
407
+ if (toRemove.has(bp.id)) {
408
+ functionRemoved.push(bp);
409
+ return false;
152
410
  }
411
+ return true;
412
+ });
413
+ if (functionRemoved.length) {
153
414
  this.fireOnDidChangeMarkers(BreakpointManager_1.FUNCTION_URI);
415
+ this.onDidChangeFunctionBreakpointsEmitter.fire({ uri: BreakpointManager_1.FUNCTION_URI, removed: functionRemoved, added: [], changed: [] });
416
+ }
417
+ // Instruction breakpoints
418
+ const instructionRemoved = [];
419
+ this.instructionBreakpoints = this.instructionBreakpoints.filter(bp => {
420
+ if (toRemove.has(bp.id)) {
421
+ instructionRemoved.push(bp);
422
+ return false;
423
+ }
424
+ return true;
425
+ });
426
+ if (instructionRemoved.length) {
427
+ this.fireOnDidChangeMarkers(BreakpointManager_1.INSTRUCTION_URI);
428
+ this.onDidChangeInstructionBreakpointsEmitter.fire({ uri: BreakpointManager_1.INSTRUCTION_URI, removed: instructionRemoved, added: [], changed: [] });
429
+ }
430
+ // Data breakpoints
431
+ const dataRemoved = [];
432
+ this.dataBreakpoints = this.dataBreakpoints.filter(bp => {
433
+ if (toRemove.has(bp.id)) {
434
+ dataRemoved.push(bp);
435
+ return false;
436
+ }
437
+ return true;
438
+ });
439
+ if (dataRemoved.length) {
440
+ this.fireOnDidChangeMarkers(BreakpointManager_1.DATA_URI);
441
+ this.onDidChangeDataBreakpointsEmitter.fire({ uri: BreakpointManager_1.DATA_URI, removed: dataRemoved, added: [], changed: [] });
154
442
  }
155
443
  }
156
444
  getExceptionBreakpoint(filter) {
157
- return this.exceptionBreakpoints.get(filter);
445
+ return this.exceptionBreakpoints.find(candidate => breakpoint_marker_1.ExceptionBreakpoint.matches(candidate.origin.raw, filter));
158
446
  }
159
447
  getExceptionBreakpoints() {
160
- return this.exceptionBreakpoints.values();
161
- }
162
- setExceptionBreakpoints(exceptionBreakpoints) {
163
- const toRemove = new Set(this.exceptionBreakpoints.keys());
164
- for (const exceptionBreakpoint of exceptionBreakpoints) {
165
- const filter = exceptionBreakpoint.raw.filter;
166
- toRemove.delete(filter);
167
- this.exceptionBreakpoints.set(filter, exceptionBreakpoint);
168
- }
169
- for (const filter of toRemove) {
170
- this.exceptionBreakpoints.delete(filter);
171
- }
172
- if (toRemove.size || exceptionBreakpoints.length) {
173
- this.fireOnDidChangeMarkers(BreakpointManager_1.EXCEPTION_URI);
448
+ return this.exceptionBreakpoints;
449
+ }
450
+ addExceptionBreakpoints(filters, sessionId) {
451
+ for (const filter of filters) {
452
+ let bp = this.exceptionBreakpoints.find(candidate => breakpoint_marker_1.ExceptionBreakpoint.matches(candidate.origin.raw, filter));
453
+ if (!bp) {
454
+ bp = debug_exception_breakpoint_1.DebugExceptionBreakpoint.create(breakpoint_marker_1.ExceptionBreakpoint.create(filter), this.getBreakpointOptions());
455
+ this.exceptionBreakpoints.push(bp);
456
+ }
457
+ bp.setSessionEnablement(sessionId, true);
458
+ this.doUpdateExceptionBreakpointVisibility(sessionId);
174
459
  }
460
+ this.fireOnDidChangeMarkers(BreakpointManager_1.EXCEPTION_URI);
175
461
  }
176
- toggleExceptionBreakpoint(filter) {
177
- const breakpoint = this.getExceptionBreakpoint(filter);
178
- if (breakpoint) {
179
- breakpoint.enabled = !breakpoint.enabled;
180
- this.fireOnDidChangeMarkers(BreakpointManager_1.EXCEPTION_URI);
462
+ updateExceptionBreakpointVisibility(sessionId) {
463
+ this.doUpdateExceptionBreakpointVisibility(sessionId);
464
+ this.fireOnDidChangeMarkers(BreakpointManager_1.EXCEPTION_URI);
465
+ }
466
+ clearExceptionSessionEnablement(sessionId) {
467
+ for (const bp of this.exceptionBreakpoints) {
468
+ bp.setSessionEnablement(sessionId, false);
181
469
  }
470
+ this.fireOnDidChangeMarkers(BreakpointManager_1.EXCEPTION_URI);
182
471
  }
183
- updateExceptionBreakpoint(filter, options) {
184
- const breakpoint = this.getExceptionBreakpoint(filter);
185
- if (breakpoint) {
186
- Object.assign(breakpoint, options);
187
- this.fireOnDidChangeMarkers(BreakpointManager_1.EXCEPTION_URI);
472
+ doUpdateExceptionBreakpointVisibility(sessionId) {
473
+ for (const bp of this.exceptionBreakpoints) {
474
+ bp.setPersistentVisibility(bp.isEnabledForSession(sessionId));
188
475
  }
189
476
  }
190
477
  getFunctionBreakpoints() {
@@ -192,13 +479,19 @@ let BreakpointManager = class BreakpointManager extends marker_manager_1.MarkerM
192
479
  }
193
480
  setFunctionBreakpoints(functionBreakpoints) {
194
481
  const oldBreakpoints = new Map(this.functionBreakpoints.map(b => [b.id, b]));
195
- this.functionBreakpoints = functionBreakpoints;
482
+ this.functionBreakpoints = functionBreakpoints.map(bp => {
483
+ const existing = oldBreakpoints.get(bp.id);
484
+ if (existing) {
485
+ return existing;
486
+ }
487
+ return debug_function_breakpoint_1.DebugFunctionBreakpoint.create(bp, this.getBreakpointOptions());
488
+ });
196
489
  this.fireOnDidChangeMarkers(BreakpointManager_1.FUNCTION_URI);
197
490
  const added = [];
198
491
  const removed = [];
199
492
  const changed = [];
200
493
  const ids = new Set();
201
- for (const newBreakpoint of functionBreakpoints) {
494
+ for (const newBreakpoint of this.functionBreakpoints) {
202
495
  ids.add(newBreakpoint.id);
203
496
  if (oldBreakpoints.has(newBreakpoint.id)) {
204
497
  changed.push(newBreakpoint);
@@ -214,85 +507,168 @@ let BreakpointManager = class BreakpointManager extends marker_manager_1.MarkerM
214
507
  }
215
508
  this.onDidChangeFunctionBreakpointsEmitter.fire({ uri: BreakpointManager_1.FUNCTION_URI, added, removed, changed });
216
509
  }
217
- getInstructionBreakpoints() {
218
- return Object.freeze(this.instructionBreakpoints.slice());
510
+ addFunctionBreakpoint(bp) {
511
+ const duplicate = this.functionBreakpoints.find(c => c.origin.raw.name === bp.raw.name);
512
+ if (duplicate) {
513
+ return;
514
+ }
515
+ const newBp = debug_function_breakpoint_1.DebugFunctionBreakpoint.create(bp, this.getBreakpointOptions());
516
+ this.functionBreakpoints = [...this.functionBreakpoints, newBp];
517
+ this.fireOnDidChangeMarkers(newBp.uri);
518
+ this.onDidChangeFunctionBreakpointsEmitter.fire({ uri: newBp.uri, added: [newBp], changed: [], removed: [] });
219
519
  }
220
- hasBreakpoints() {
221
- return Boolean(this.getUris().next().value || this.functionBreakpoints.length || this.instructionBreakpoints.length);
520
+ updateFunctionBreakpoint(bp, update) {
521
+ if (!this.functionBreakpoints.includes(bp)) {
522
+ return;
523
+ }
524
+ const removed = [];
525
+ if ('name' in update && !update.name) {
526
+ throw new Error('Name field of function breakpoint must be populated.');
527
+ }
528
+ else if ('name' in update) {
529
+ this.functionBreakpoints = this.functionBreakpoints.filter(candidate => {
530
+ if (candidate !== bp && candidate.origin.raw.name === update.name) {
531
+ removed.push(candidate);
532
+ return false;
533
+ }
534
+ return true;
535
+ });
536
+ }
537
+ bp.origin.raw = { ...bp.origin.raw, ...update };
538
+ this.fireOnDidChangeMarkers(bp.uri);
539
+ this.onDidChangeFunctionBreakpointsEmitter.fire({ uri: bp.uri, changed: [bp], removed, added: [] });
540
+ }
541
+ removeFunctionBreakpoint(breakpoint) {
542
+ const index = this.functionBreakpoints.indexOf(breakpoint);
543
+ if (index === -1) {
544
+ return;
545
+ }
546
+ const removed = this.functionBreakpoints.splice(index, 1);
547
+ this.fireOnDidChangeMarkers(breakpoint.uri);
548
+ this.onDidChangeFunctionBreakpointsEmitter.fire({ uri: breakpoint.uri, removed, added: [], changed: [] });
549
+ }
550
+ getInstructionBreakpoints() {
551
+ return this.instructionBreakpoints;
222
552
  }
223
553
  setInstructionBreakpoints(newBreakpoints) {
224
- const { added, removed, changed } = diff(this.instructionBreakpoints, newBreakpoints, bp => bp.id);
225
- this.instructionBreakpoints = newBreakpoints.slice();
554
+ const oldBreakpoints = new Map(this.instructionBreakpoints.map(bp => [bp.id, bp]));
555
+ const currentBreakpoints = newBreakpoints.map(bp => {
556
+ const existing = oldBreakpoints.get(bp.id);
557
+ if (existing) {
558
+ return existing;
559
+ }
560
+ return debug_instruction_breakpoint_1.DebugInstructionBreakpoint.create(bp, this.getBreakpointOptions());
561
+ });
562
+ const added = [];
563
+ const changed = [];
564
+ for (const breakpoint of currentBreakpoints) {
565
+ const old = oldBreakpoints.get(breakpoint.id);
566
+ if (old) {
567
+ changed.push(old);
568
+ }
569
+ else {
570
+ added.push(breakpoint);
571
+ }
572
+ oldBreakpoints.delete(breakpoint.id);
573
+ }
574
+ const removed = Array.from(oldBreakpoints.values());
575
+ this.instructionBreakpoints = currentBreakpoints;
226
576
  this.fireOnDidChangeMarkers(BreakpointManager_1.INSTRUCTION_URI);
227
577
  this.onDidChangeInstructionBreakpointsEmitter.fire({ uri: BreakpointManager_1.INSTRUCTION_URI, added, removed, changed });
228
578
  }
229
579
  addInstructionBreakpoint(address, offset, condition, hitCondition) {
230
- this.setInstructionBreakpoints(this.instructionBreakpoints.concat(breakpoint_marker_1.InstructionBreakpoint.create({
580
+ const duplicate = this.instructionBreakpoints.find(c => c.origin.raw.instructionReference === address && (c.origin.raw.offset ?? 0) === (offset ?? 0));
581
+ if (duplicate) {
582
+ return;
583
+ }
584
+ const newBp = debug_instruction_breakpoint_1.DebugInstructionBreakpoint.create(breakpoint_marker_1.InstructionBreakpoint.create({
231
585
  instructionReference: address,
232
586
  offset,
233
587
  condition,
234
588
  hitCondition,
235
- })));
236
- }
237
- updateInstructionBreakpoint(id, options) {
238
- const breakpoint = this.instructionBreakpoints.find(candidate => id === candidate.id);
239
- if (breakpoint) {
240
- Object.assign(breakpoint, options);
241
- this.fireOnDidChangeMarkers(BreakpointManager_1.INSTRUCTION_URI);
242
- this.onDidChangeInstructionBreakpointsEmitter.fire({ uri: BreakpointManager_1.INSTRUCTION_URI, changed: [breakpoint], added: [], removed: [] });
243
- }
589
+ }), this.getBreakpointOptions());
590
+ this.instructionBreakpoints = [...this.instructionBreakpoints, newBp];
591
+ this.fireOnDidChangeMarkers(BreakpointManager_1.INSTRUCTION_URI);
592
+ this.onDidChangeInstructionBreakpointsEmitter.fire({ uri: BreakpointManager_1.INSTRUCTION_URI, added: [newBp], removed: [], changed: [] });
244
593
  }
245
- removeInstructionBreakpoint(address) {
246
- if (!address) {
247
- this.clearInstructionBreakpoints();
594
+ removeInstructionBreakpoint(breakpoint) {
595
+ const index = this.instructionBreakpoints.indexOf(breakpoint);
596
+ if (index === -1) {
597
+ return;
248
598
  }
249
- const breakpointIndex = this.instructionBreakpoints.findIndex(breakpoint => breakpoint.instructionReference === address);
250
- if (breakpointIndex !== -1) {
251
- const removed = this.instructionBreakpoints.splice(breakpointIndex, 1);
252
- this.fireOnDidChangeMarkers(BreakpointManager_1.INSTRUCTION_URI);
253
- this.onDidChangeInstructionBreakpointsEmitter.fire({ uri: BreakpointManager_1.INSTRUCTION_URI, added: [], changed: [], removed });
599
+ const removed = this.instructionBreakpoints.splice(index, 1);
600
+ this.fireOnDidChangeMarkers(breakpoint.uri);
601
+ this.onDidChangeInstructionBreakpointsEmitter.fire({ uri: breakpoint.uri, removed, added: [], changed: [] });
602
+ }
603
+ removeInstructionBreakpointAt(address) {
604
+ const match = this.instructionBreakpoints.find(candidate => candidate.origin.raw.instructionReference === address);
605
+ if (match) {
606
+ this.removeInstructionBreakpoint(match);
254
607
  }
255
608
  }
256
609
  clearInstructionBreakpoints() {
257
610
  this.setInstructionBreakpoints([]);
258
611
  }
259
612
  getDataBreakpoints() {
260
- return Object.freeze(this.dataBreakpoints.slice());
613
+ return this.dataBreakpoints;
261
614
  }
262
615
  setDataBreakpoints(breakpoints) {
263
- const { added, removed, changed } = diff(this.dataBreakpoints, breakpoints, ({ id }) => id);
264
- this.dataBreakpoints = breakpoints.slice();
616
+ const oldBreakpoints = new Map(this.dataBreakpoints.map(bp => [bp.id, bp]));
617
+ const newBreakpoints = breakpoints.map(bp => {
618
+ const existing = oldBreakpoints.get(bp.id);
619
+ if (existing) {
620
+ return existing;
621
+ }
622
+ return debug_data_breakpoint_1.DebugDataBreakpoint.create(bp, this.getBreakpointOptions());
623
+ });
624
+ const added = [];
625
+ const changed = [];
626
+ for (const bp of newBreakpoints) {
627
+ if (oldBreakpoints.has(bp.id)) {
628
+ changed.push(bp);
629
+ }
630
+ else {
631
+ added.push(bp);
632
+ }
633
+ oldBreakpoints.delete(bp.id);
634
+ }
635
+ const removed = Array.from(oldBreakpoints.values());
636
+ this.dataBreakpoints = newBreakpoints;
265
637
  this.fireOnDidChangeMarkers(BreakpointManager_1.DATA_URI);
266
638
  this.onDidChangeDataBreakpointsEmitter.fire({ uri: BreakpointManager_1.DATA_URI, added, removed, changed });
267
639
  }
268
640
  addDataBreakpoint(breakpoint) {
269
- this.setDataBreakpoints(this.dataBreakpoints.concat(breakpoint));
270
- }
271
- updateDataBreakpoint(id, options) {
272
- const breakpoint = this.dataBreakpoints.find(bp => bp.id === id);
273
- if (!breakpoint) {
641
+ const duplicate = this.dataBreakpoints.find(c => c.origin.raw.dataId === breakpoint.raw.dataId);
642
+ if (duplicate) {
274
643
  return;
275
644
  }
276
- Object.assign(breakpoint.raw, options);
277
- breakpoint.enabled = options.enabled ?? breakpoint.enabled;
645
+ const newBp = debug_data_breakpoint_1.DebugDataBreakpoint.create(breakpoint, this.getBreakpointOptions());
646
+ this.dataBreakpoints = [...this.dataBreakpoints, newBp];
278
647
  this.fireOnDidChangeMarkers(BreakpointManager_1.DATA_URI);
279
- this.onDidChangeDataBreakpointsEmitter.fire({ uri: BreakpointManager_1.DATA_URI, added: [], removed: [], changed: [breakpoint] });
648
+ this.onDidChangeDataBreakpointsEmitter.fire({ uri: BreakpointManager_1.DATA_URI, added: [newBp], removed: [], changed: [] });
280
649
  }
281
- removeDataBreakpoint(id) {
282
- const index = this.dataBreakpoints.findIndex(bp => bp.id === id);
650
+ updateDataBreakpoint(bp, options) {
651
+ if (!this.dataBreakpoints.includes(bp)) {
652
+ return;
653
+ }
654
+ if (options.raw) {
655
+ Object.assign(bp.origin.raw, options.raw);
656
+ }
657
+ if (options.enabled !== undefined) {
658
+ bp.origin.enabled = options.enabled;
659
+ }
660
+ this.fireBreakpointChanged(bp);
661
+ }
662
+ removeDataBreakpoint(bp) {
663
+ const index = this.dataBreakpoints.indexOf(bp);
283
664
  if (index < 0) {
284
665
  return;
285
666
  }
286
- const removed = this.dataBreakpoints.splice(index);
667
+ const removed = this.dataBreakpoints.splice(index, 1);
287
668
  this.fireOnDidChangeMarkers(BreakpointManager_1.DATA_URI);
288
669
  this.onDidChangeDataBreakpointsEmitter.fire({ uri: BreakpointManager_1.DATA_URI, added: [], removed, changed: [] });
289
670
  }
290
- removeBreakpoints() {
291
- this.cleanAllMarkers();
292
- this.setFunctionBreakpoints([]);
293
- this.setInstructionBreakpoints([]);
294
- this.setDataBreakpoints([]);
295
- }
671
+ // ── Persistence ──
296
672
  async load() {
297
673
  const data = await this.storage.getData('breakpoints', {
298
674
  breakpointsEnabled: true,
@@ -307,33 +683,36 @@ let BreakpointManager = class BreakpointManager extends marker_manager_1.MarkerM
307
683
  this.setFunctionBreakpoints(data.functionBreakpoints);
308
684
  }
309
685
  if (data.exceptionBreakpoints) {
310
- this.setExceptionBreakpoints(data.exceptionBreakpoints);
686
+ this.exceptionBreakpoints = data.exceptionBreakpoints.map(bp => debug_exception_breakpoint_1.DebugExceptionBreakpoint.create(bp, this.getBreakpointOptions()));
687
+ this.fireOnDidChangeMarkers(BreakpointManager_1.EXCEPTION_URI);
311
688
  }
312
689
  if (data.instructionBreakpoints) {
313
690
  this.setInstructionBreakpoints(data.instructionBreakpoints);
314
691
  }
692
+ if (data.dataBreakpoints) {
693
+ this.setDataBreakpoints(data.dataBreakpoints);
694
+ }
315
695
  }
316
696
  save() {
317
697
  const data = {
318
698
  breakpointsEnabled: this._breakpointsEnabled,
319
699
  breakpoints: {}
320
700
  };
321
- const uris = this.getUris();
322
- for (const uri of uris) {
323
- data.breakpoints[uri] = this.findMarkers({ uri: new uri_1.default(uri) }).map(marker => marker.data);
701
+ for (const uri of this.getUris()) {
702
+ data.breakpoints[uri] = (this.sourceBreakpoints.get(uri) ?? []).map(bp => bp.origin);
324
703
  }
325
704
  if (this.functionBreakpoints.length) {
326
- data.functionBreakpoints = this.functionBreakpoints;
705
+ data.functionBreakpoints = this.functionBreakpoints.map(({ origin }) => origin);
327
706
  }
328
- if (this.exceptionBreakpoints.size) {
329
- data.exceptionBreakpoints = [...this.exceptionBreakpoints.values()];
707
+ if (this.exceptionBreakpoints.length) {
708
+ data.exceptionBreakpoints = this.exceptionBreakpoints.filter(candidate => candidate.isPersistentlyVisible()).map(({ origin }) => origin);
330
709
  }
331
710
  if (this.instructionBreakpoints.length) {
332
- data.instructionBreakpoints = this.instructionBreakpoints;
711
+ data.instructionBreakpoints = this.instructionBreakpoints.map(({ origin }) => origin);
333
712
  }
334
- const dataBreakpointsToStore = this.dataBreakpoints.filter(candidate => candidate.info.canPersist);
713
+ const dataBreakpointsToStore = this.dataBreakpoints.filter(candidate => candidate.origin.info.canPersist);
335
714
  if (dataBreakpointsToStore.length) {
336
- data.dataBreakpoints = dataBreakpointsToStore;
715
+ data.dataBreakpoints = dataBreakpointsToStore.map(({ origin }) => origin);
337
716
  }
338
717
  this.storage.setData('breakpoints', data);
339
718
  }
@@ -343,25 +722,29 @@ tslib_1.__decorate([
343
722
  (0, inversify_1.inject)(browser_1.StorageService),
344
723
  tslib_1.__metadata("design:type", Object)
345
724
  ], BreakpointManager.prototype, "storage", void 0);
725
+ tslib_1.__decorate([
726
+ (0, inversify_1.inject)(browser_1.LabelProvider),
727
+ tslib_1.__metadata("design:type", browser_1.LabelProvider)
728
+ ], BreakpointManager.prototype, "labelProvider", void 0);
729
+ tslib_1.__decorate([
730
+ (0, inversify_1.inject)(browser_1.OpenerService),
731
+ tslib_1.__metadata("design:type", Object)
732
+ ], BreakpointManager.prototype, "openerService", void 0);
733
+ tslib_1.__decorate([
734
+ (0, inversify_1.inject)(common_1.CommandService),
735
+ tslib_1.__metadata("design:type", Object)
736
+ ], BreakpointManager.prototype, "commandService", void 0);
737
+ tslib_1.__decorate([
738
+ (0, inversify_1.inject)(file_service_1.FileService),
739
+ tslib_1.__metadata("design:type", file_service_1.FileService)
740
+ ], BreakpointManager.prototype, "fileService", void 0);
741
+ tslib_1.__decorate([
742
+ (0, inversify_1.postConstruct)(),
743
+ tslib_1.__metadata("design:type", Function),
744
+ tslib_1.__metadata("design:paramtypes", []),
745
+ tslib_1.__metadata("design:returntype", void 0)
746
+ ], BreakpointManager.prototype, "init", null);
346
747
  exports.BreakpointManager = BreakpointManager = BreakpointManager_1 = tslib_1.__decorate([
347
748
  (0, inversify_1.injectable)()
348
749
  ], BreakpointManager);
349
- function diff(prevs, nexts, toKey) {
350
- const old = new Map(prevs.map(item => [toKey(item), item]));
351
- const current = new Map(nexts.map(item => [toKey(item), item]));
352
- const added = [];
353
- const changed = [];
354
- for (const [id, next] of current.entries()) {
355
- const prev = old.get(id);
356
- if (prev) {
357
- changed.push(prev);
358
- }
359
- else {
360
- added.push(next);
361
- }
362
- old.delete(id);
363
- }
364
- const removed = Array.from(old.values());
365
- return { added, removed, changed };
366
- }
367
750
  //# sourceMappingURL=breakpoint-manager.js.map