@jupyterlab/debugger-extension 4.0.0-alpha.2 → 4.0.0-alpha.20

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.
package/lib/index.js CHANGED
@@ -5,9 +5,9 @@
5
5
  * @module debugger-extension
6
6
  */
7
7
  import { ILabShell, ILayoutRestorer } from '@jupyterlab/application';
8
- import { ICommandPalette, IThemeManager, MainAreaWidget, sessionContextDialogs, WidgetTracker } from '@jupyterlab/apputils';
8
+ import { Clipboard, ICommandPalette, InputDialog, IThemeManager, MainAreaWidget, sessionContextDialogs, WidgetTracker } from '@jupyterlab/apputils';
9
+ import { CodeCell } from '@jupyterlab/cells';
9
10
  import { IEditorServices } from '@jupyterlab/codeeditor';
10
- import { CodeMirrorEditor } from '@jupyterlab/codemirror';
11
11
  import { ConsolePanel, IConsoleTracker } from '@jupyterlab/console';
12
12
  import { PageConfig, PathExt } from '@jupyterlab/coreutils';
13
13
  import { Debugger, IDebugger, IDebuggerConfig, IDebuggerHandler, IDebuggerSidebar, IDebuggerSources } from '@jupyterlab/debugger';
@@ -18,6 +18,13 @@ import { INotebookTracker, NotebookActions, NotebookPanel } from '@jupyterlab/no
18
18
  import { standardRendererFactories as initialFactories, IRenderMimeRegistry, RenderMimeRegistry } from '@jupyterlab/rendermime';
19
19
  import { ISettingRegistry } from '@jupyterlab/settingregistry';
20
20
  import { ITranslator } from '@jupyterlab/translation';
21
+ function notifyCommands(app) {
22
+ Object.values(Debugger.CommandIDs).forEach(command => {
23
+ if (app.commands.hasCommand(command)) {
24
+ app.commands.notifyCommandChanged(command);
25
+ }
26
+ });
27
+ }
21
28
  /**
22
29
  * A plugin that provides visual debugging support for consoles.
23
30
  */
@@ -36,23 +43,23 @@ const consoles = {
36
43
  const { sessionContext } = widget;
37
44
  await sessionContext.ready;
38
45
  await handler.updateContext(widget, sessionContext);
39
- app.commands.notifyCommandChanged();
46
+ notifyCommands(app);
40
47
  };
41
48
  if (labShell) {
42
- labShell.currentChanged.connect(async (_, update) => {
49
+ labShell.currentChanged.connect((_, update) => {
43
50
  const widget = update.newValue;
44
- if (!(widget instanceof ConsolePanel)) {
45
- return;
51
+ if (widget instanceof ConsolePanel) {
52
+ void updateHandlerAndCommands(widget);
53
+ }
54
+ });
55
+ }
56
+ else {
57
+ consoleTracker.currentChanged.connect((_, consolePanel) => {
58
+ if (consolePanel) {
59
+ void updateHandlerAndCommands(consolePanel);
46
60
  }
47
- await updateHandlerAndCommands(widget);
48
61
  });
49
- return;
50
62
  }
51
- consoleTracker.currentChanged.connect(async (_, consolePanel) => {
52
- if (consolePanel) {
53
- void updateHandlerAndCommands(consolePanel);
54
- }
55
- });
56
63
  }
57
64
  };
58
65
  /**
@@ -87,28 +94,30 @@ const files = {
87
94
  activeSessions[model.id] = session;
88
95
  }
89
96
  await handler.update(widget, session);
90
- app.commands.notifyCommandChanged();
97
+ notifyCommands(app);
91
98
  }
92
99
  catch (_a) {
93
100
  return;
94
101
  }
95
102
  };
96
103
  if (labShell) {
97
- labShell.currentChanged.connect(async (_, update) => {
104
+ labShell.currentChanged.connect((_, update) => {
98
105
  const widget = update.newValue;
99
- if (!(widget instanceof DocumentWidget)) {
100
- return;
106
+ if (widget instanceof DocumentWidget) {
107
+ const { content } = widget;
108
+ if (content instanceof FileEditor) {
109
+ void updateHandlerAndCommands(widget);
110
+ }
101
111
  }
102
- const content = widget.content;
103
- if (!(content instanceof FileEditor)) {
104
- return;
112
+ });
113
+ }
114
+ else {
115
+ editorTracker.currentChanged.connect((_, documentWidget) => {
116
+ if (documentWidget) {
117
+ void updateHandlerAndCommands(documentWidget);
105
118
  }
106
- await updateHandlerAndCommands(widget);
107
119
  });
108
120
  }
109
- editorTracker.currentChanged.connect(async (_, documentWidget) => {
110
- await updateHandlerAndCommands(documentWidget);
111
- });
112
121
  }
113
122
  };
114
123
  /**
@@ -130,40 +139,45 @@ const notebooks = {
130
139
  app.commands.addCommand(Debugger.CommandIDs.restartDebug, {
131
140
  label: trans.__('Restart Kernel and Debug…'),
132
141
  caption: trans.__('Restart Kernel and Debug…'),
133
- isEnabled: () => {
134
- return service.isStarted;
135
- },
142
+ isEnabled: () => service.isStarted,
136
143
  execute: async () => {
137
144
  const state = service.getDebuggerState();
138
- console.log(state.cells);
139
- const { context, content } = notebookTracker.currentWidget;
140
145
  await service.stop();
141
- const restarted = await sessionContextDialogs.restart(context.sessionContext);
142
- if (restarted) {
143
- await service.restoreDebuggerState(state);
144
- await handler.updateWidget(notebookTracker.currentWidget, notebookTracker.currentWidget.sessionContext.session);
145
- await NotebookActions.runAll(content, context.sessionContext);
146
+ const widget = notebookTracker.currentWidget;
147
+ if (!widget) {
148
+ return;
146
149
  }
150
+ const { content, sessionContext } = widget;
151
+ const restarted = await sessionContextDialogs.restart(sessionContext);
152
+ if (!restarted) {
153
+ return;
154
+ }
155
+ await service.restoreDebuggerState(state);
156
+ await handler.updateWidget(widget, sessionContext.session);
157
+ await NotebookActions.runAll(content, sessionContext);
147
158
  }
148
159
  });
149
160
  const updateHandlerAndCommands = async (widget) => {
150
- const { sessionContext } = widget;
151
- await sessionContext.ready;
152
- await handler.updateContext(widget, sessionContext);
153
- app.commands.notifyCommandChanged();
161
+ if (widget) {
162
+ const { sessionContext } = widget;
163
+ await sessionContext.ready;
164
+ await handler.updateContext(widget, sessionContext);
165
+ }
166
+ notifyCommands(app);
154
167
  };
155
168
  if (labShell) {
156
- labShell.currentChanged.connect(async (_, update) => {
169
+ labShell.currentChanged.connect((_, update) => {
157
170
  const widget = update.newValue;
158
- if (!(widget instanceof NotebookPanel)) {
159
- return;
171
+ if (widget instanceof NotebookPanel) {
172
+ void updateHandlerAndCommands(widget);
160
173
  }
161
- await updateHandlerAndCommands(widget);
162
174
  });
163
175
  }
164
176
  else {
165
- notebookTracker.currentChanged.connect(async (_, notebookPanel) => {
166
- await updateHandlerAndCommands(notebookPanel);
177
+ notebookTracker.currentChanged.connect((_, notebookPanel) => {
178
+ if (notebookPanel) {
179
+ void updateHandlerAndCommands(notebookPanel);
180
+ }
167
181
  });
168
182
  }
169
183
  if (palette) {
@@ -172,9 +186,6 @@ const notebooks = {
172
186
  command: Debugger.CommandIDs.restartDebug
173
187
  });
174
188
  }
175
- notebookTracker.currentChanged.connect(async (_, notebookPanel) => {
176
- await updateHandlerAndCommands(notebookPanel);
177
- });
178
189
  return handler;
179
190
  }
180
191
  };
@@ -229,9 +240,9 @@ const sources = {
229
240
  const variables = {
230
241
  id: '@jupyterlab/debugger-extension:variables',
231
242
  autoStart: true,
232
- requires: [IDebugger, IDebuggerHandler, ITranslator, IDebuggerSidebar],
243
+ requires: [IDebugger, IDebuggerHandler, ITranslator],
233
244
  optional: [IThemeManager, IRenderMimeRegistry],
234
- activate: (app, service, handler, translator, sidebar, themeManager, rendermime) => {
245
+ activate: (app, service, handler, translator, themeManager, rendermime) => {
235
246
  const trans = translator.load('jupyterlab');
236
247
  const { commands, shell } = app;
237
248
  const tracker = new WidgetTracker({
@@ -248,17 +259,17 @@ const variables = {
248
259
  isEnabled: args => {
249
260
  var _a, _b, _c, _d;
250
261
  return !!((_a = service.session) === null || _a === void 0 ? void 0 : _a.isStarted) &&
251
- ((_d = (_b = args.variableReference) !== null && _b !== void 0 ? _b : (_c = sidebar.variables.latestSelection) === null || _c === void 0 ? void 0 : _c.variablesReference) !== null && _d !== void 0 ? _d : 0) > 0;
262
+ Number((_d = (_b = args.variableReference) !== null && _b !== void 0 ? _b : (_c = service.model.variables.selectedVariable) === null || _c === void 0 ? void 0 : _c.variablesReference) !== null && _d !== void 0 ? _d : 0) > 0;
252
263
  },
253
264
  execute: async (args) => {
254
265
  var _a, _b, _c, _d;
255
266
  let { variableReference, name } = args;
256
267
  if (!variableReference) {
257
268
  variableReference =
258
- (_a = sidebar.variables.latestSelection) === null || _a === void 0 ? void 0 : _a.variablesReference;
269
+ (_a = service.model.variables.selectedVariable) === null || _a === void 0 ? void 0 : _a.variablesReference;
259
270
  }
260
271
  if (!name) {
261
- name = (_b = sidebar.variables.latestSelection) === null || _b === void 0 ? void 0 : _b.name;
272
+ name = (_b = service.model.variables.selectedVariable) === null || _b === void 0 ? void 0 : _b.name;
262
273
  }
263
274
  const id = `jp-debugger-variable-${name}`;
264
275
  if (!name ||
@@ -291,7 +302,8 @@ const variables = {
291
302
  model.changed.connect(disposeWidget);
292
303
  shell.add(widget, 'main', {
293
304
  mode: tracker.currentWidget ? 'split-right' : 'split-bottom',
294
- activate: false
305
+ activate: false,
306
+ type: 'Debugger Variables'
295
307
  });
296
308
  }
297
309
  });
@@ -302,10 +314,10 @@ const variables = {
302
314
  isVisible: () => service.model.hasRichVariableRendering &&
303
315
  (rendermime !== null || handler.activeWidget instanceof NotebookPanel),
304
316
  execute: args => {
305
- var _a, _b, _c, _d;
317
+ var _a, _b, _c, _d, _e, _f, _g, _h;
306
318
  let { name, frameId } = args;
307
319
  if (!name) {
308
- name = (_a = sidebar.variables.latestSelection) === null || _a === void 0 ? void 0 : _a.name;
320
+ name = (_a = service.model.variables.selectedVariable) === null || _a === void 0 ? void 0 : _a.name;
309
321
  }
310
322
  if (!frameId) {
311
323
  frameId = (_b = service.model.callstack.frame) === null || _b === void 0 ? void 0 : _b.id;
@@ -317,33 +329,62 @@ const variables = {
317
329
  if (!activeRendermime) {
318
330
  return;
319
331
  }
320
- const id = `jp-debugger-variable-mime-${name}`;
332
+ const id = `jp-debugger-variable-mime-${name}-${(_d = (_c = service.session) === null || _c === void 0 ? void 0 : _c.connection) === null || _d === void 0 ? void 0 : _d.path.replace('/', '-')}`;
321
333
  if (!name || // Name is mandatory
322
334
  trackerMime.find(widget => widget.id === id) || // Widget already exists
323
335
  (!frameId && service.hasStoppedThreads()) // frame id missing on breakpoint
324
336
  ) {
325
337
  return;
326
338
  }
339
+ const variablesModel = service.model.variables;
327
340
  const widget = new Debugger.VariableRenderer({
328
- dataLoader: service.inspectRichVariable(name, frameId),
329
- rendermime: activeRendermime
341
+ dataLoader: () => service.inspectRichVariable(name, frameId),
342
+ rendermime: activeRendermime,
343
+ translator
330
344
  });
331
- widget.addClass('jp-DebuggerVariables');
345
+ widget.addClass('jp-DebuggerRichVariable');
332
346
  widget.id = id;
333
347
  widget.title.icon = Debugger.Icons.variableIcon;
334
- widget.title.label = `${(_d = (_c = service.session) === null || _c === void 0 ? void 0 : _c.connection) === null || _d === void 0 ? void 0 : _d.name} - ${name}`;
348
+ widget.title.label = `${name} - ${(_f = (_e = service.session) === null || _e === void 0 ? void 0 : _e.connection) === null || _f === void 0 ? void 0 : _f.name}`;
349
+ widget.title.caption = `${name} - ${(_h = (_g = service.session) === null || _g === void 0 ? void 0 : _g.connection) === null || _h === void 0 ? void 0 : _h.path}`;
335
350
  void trackerMime.add(widget);
336
351
  const disposeWidget = () => {
337
352
  widget.dispose();
338
- service.model.variables.changed.disconnect(disposeWidget);
353
+ variablesModel.changed.disconnect(refreshWidget);
354
+ activeWidget === null || activeWidget === void 0 ? void 0 : activeWidget.disposed.disconnect(disposeWidget);
355
+ };
356
+ const refreshWidget = () => {
357
+ // Refresh the widget only if the active element is the same.
358
+ if (handler.activeWidget === activeWidget) {
359
+ void widget.refresh();
360
+ }
339
361
  };
340
- service.model.variables.changed.connect(disposeWidget);
362
+ widget.disposed.connect(disposeWidget);
363
+ variablesModel.changed.connect(refreshWidget);
364
+ activeWidget === null || activeWidget === void 0 ? void 0 : activeWidget.disposed.connect(disposeWidget);
341
365
  shell.add(widget, 'main', {
342
366
  mode: trackerMime.currentWidget ? 'split-right' : 'split-bottom',
343
- activate: false
367
+ activate: false,
368
+ type: 'Debugger Variables'
344
369
  });
345
370
  }
346
371
  });
372
+ commands.addCommand(CommandIDs.copyToClipboard, {
373
+ label: trans.__('Copy to Clipboard'),
374
+ caption: trans.__('Copy text representation of the value to clipboard'),
375
+ isEnabled: () => {
376
+ var _a, _b;
377
+ return (!!((_a = service.session) === null || _a === void 0 ? void 0 : _a.isStarted) &&
378
+ !!((_b = service.model.variables.selectedVariable) === null || _b === void 0 ? void 0 : _b.value));
379
+ },
380
+ isVisible: () => handler.activeWidget instanceof NotebookPanel,
381
+ execute: async () => {
382
+ const value = service.model.variables.selectedVariable.value;
383
+ if (value) {
384
+ Clipboard.copyToSystem(value);
385
+ }
386
+ }
387
+ });
347
388
  }
348
389
  };
349
390
  /**
@@ -367,9 +408,14 @@ const sidebar = {
367
408
  stepOut: CommandIDs.stepOut,
368
409
  evaluate: CommandIDs.evaluate
369
410
  };
411
+ const breakpointsCommands = {
412
+ registry: commands,
413
+ pauseOnExceptions: CommandIDs.pauseOnExceptions
414
+ };
370
415
  const sidebar = new Debugger.Sidebar({
371
416
  service,
372
417
  callstackCommands,
418
+ breakpointsCommands,
373
419
  editorServices,
374
420
  themeManager,
375
421
  translator
@@ -383,6 +429,9 @@ const sidebar = {
383
429
  if (kernel && filters[kernel]) {
384
430
  sidebar.variables.filter = new Set(filters[kernel]);
385
431
  }
432
+ const kernelSourcesFilter = setting.get('defaultKernelSourcesFilter')
433
+ .composite;
434
+ sidebar.kernelSources.filter = kernelSourcesFilter;
386
435
  };
387
436
  updateSettings();
388
437
  setting.changed.connect(updateSettings);
@@ -402,10 +451,11 @@ const main = {
402
451
  IDebuggerSources,
403
452
  ILabShell,
404
453
  ILayoutRestorer,
405
- ILoggerRegistry
454
+ ILoggerRegistry,
455
+ ISettingRegistry
406
456
  ],
407
457
  autoStart: true,
408
- activate: async (app, service, sidebar, editorServices, translator, palette, debuggerSources, labShell, restorer, loggerRegistry) => {
458
+ activate: async (app, service, sidebar, editorServices, translator, palette, debuggerSources, labShell, restorer, loggerRegistry, settingRegistry) => {
409
459
  var _a;
410
460
  const trans = translator.load('jupyterlab');
411
461
  const { commands, shell, serviceManager } = app;
@@ -435,7 +485,7 @@ const main = {
435
485
  }
436
486
  const info = (await kernel.info).language_info;
437
487
  const name = info.name;
438
- const mimeType = (_c = editorServices === null || editorServices === void 0 ? void 0 : editorServices.mimeTypeService.getMimeTypeByLanguage({ name })) !== null && _c !== void 0 ? _c : '';
488
+ const mimeType = (_c = editorServices.mimeTypeService.getMimeTypeByLanguage({ name })) !== null && _c !== void 0 ? _c : '';
439
489
  return mimeType;
440
490
  };
441
491
  const rendermime = new RenderMimeRegistry({ initialFactories });
@@ -443,9 +493,7 @@ const main = {
443
493
  label: trans.__('Evaluate Code'),
444
494
  caption: trans.__('Evaluate Code'),
445
495
  icon: Debugger.Icons.evaluateIcon,
446
- isEnabled: () => {
447
- return service.hasStoppedThreads();
448
- },
496
+ isEnabled: () => service.hasStoppedThreads(),
449
497
  execute: async () => {
450
498
  var _a, _b, _c;
451
499
  const mimeType = await getMimeType();
@@ -454,6 +502,9 @@ const main = {
454
502
  okLabel: trans.__('Evaluate'),
455
503
  cancelLabel: trans.__('Cancel'),
456
504
  mimeType,
505
+ contentFactory: new CodeCell.ContentFactory({
506
+ editorFactory: options => editorServices.factoryService.newInlineEditor(options)
507
+ }),
457
508
  rendermime
458
509
  });
459
510
  const code = result.value;
@@ -477,36 +528,47 @@ const main = {
477
528
  }
478
529
  });
479
530
  commands.addCommand(CommandIDs.debugContinue, {
480
- label: trans.__('Continue'),
481
- caption: trans.__('Continue'),
482
- icon: Debugger.Icons.continueIcon,
483
- isEnabled: () => {
484
- return service.hasStoppedThreads();
531
+ label: () => {
532
+ return service.hasStoppedThreads()
533
+ ? trans.__('Continue')
534
+ : trans.__('Pause');
535
+ },
536
+ caption: () => {
537
+ return service.hasStoppedThreads()
538
+ ? trans.__('Continue')
539
+ : trans.__('Pause');
540
+ },
541
+ icon: () => {
542
+ return service.hasStoppedThreads()
543
+ ? Debugger.Icons.continueIcon
544
+ : Debugger.Icons.pauseIcon;
485
545
  },
546
+ isEnabled: () => { var _a, _b; return (_b = (_a = service.session) === null || _a === void 0 ? void 0 : _a.isStarted) !== null && _b !== void 0 ? _b : false; },
486
547
  execute: async () => {
487
- await service.continue();
488
- commands.notifyCommandChanged();
548
+ if (service.hasStoppedThreads()) {
549
+ await service.continue();
550
+ }
551
+ else {
552
+ await service.pause();
553
+ }
554
+ commands.notifyCommandChanged(CommandIDs.debugContinue);
489
555
  }
490
556
  });
491
557
  commands.addCommand(CommandIDs.terminate, {
492
558
  label: trans.__('Terminate'),
493
559
  caption: trans.__('Terminate'),
494
560
  icon: Debugger.Icons.terminateIcon,
495
- isEnabled: () => {
496
- return service.hasStoppedThreads();
497
- },
561
+ isEnabled: () => service.hasStoppedThreads(),
498
562
  execute: async () => {
499
563
  await service.restart();
500
- commands.notifyCommandChanged();
564
+ notifyCommands(app);
501
565
  }
502
566
  });
503
567
  commands.addCommand(CommandIDs.next, {
504
568
  label: trans.__('Next'),
505
569
  caption: trans.__('Next'),
506
570
  icon: Debugger.Icons.stepOverIcon,
507
- isEnabled: () => {
508
- return service.hasStoppedThreads();
509
- },
571
+ isEnabled: () => service.hasStoppedThreads(),
510
572
  execute: async () => {
511
573
  await service.next();
512
574
  }
@@ -515,9 +577,7 @@ const main = {
515
577
  label: trans.__('Step In'),
516
578
  caption: trans.__('Step In'),
517
579
  icon: Debugger.Icons.stepIntoIcon,
518
- isEnabled: () => {
519
- return service.hasStoppedThreads();
520
- },
580
+ isEnabled: () => service.hasStoppedThreads(),
521
581
  execute: async () => {
522
582
  await service.stepIn();
523
583
  }
@@ -526,28 +586,71 @@ const main = {
526
586
  label: trans.__('Step Out'),
527
587
  caption: trans.__('Step Out'),
528
588
  icon: Debugger.Icons.stepOutIcon,
529
- isEnabled: () => {
530
- return service.hasStoppedThreads();
531
- },
589
+ isEnabled: () => service.hasStoppedThreads(),
532
590
  execute: async () => {
533
591
  await service.stepOut();
534
592
  }
535
593
  });
594
+ commands.addCommand(CommandIDs.pauseOnExceptions, {
595
+ label: args => args.filter || 'Breakpoints on exception',
596
+ caption: args => args.description,
597
+ isToggled: args => { var _a; return ((_a = service.session) === null || _a === void 0 ? void 0 : _a.isPausingOnException(args.filter)) || false; },
598
+ isEnabled: () => service.pauseOnExceptionsIsValid(),
599
+ execute: async (args) => {
600
+ var _a, _b, _c;
601
+ if (args === null || args === void 0 ? void 0 : args.filter) {
602
+ let filter = args.filter;
603
+ await service.pauseOnExceptionsFilter(filter);
604
+ }
605
+ else {
606
+ let items = [];
607
+ (_b = (_a = service.session) === null || _a === void 0 ? void 0 : _a.exceptionBreakpointFilters) === null || _b === void 0 ? void 0 : _b.forEach(availableFilter => {
608
+ items.push(availableFilter.filter);
609
+ });
610
+ const result = await InputDialog.getMultipleItems({
611
+ title: trans.__('Select a filter for breakpoints on exception'),
612
+ items: items,
613
+ defaults: ((_c = service.session) === null || _c === void 0 ? void 0 : _c.currentExceptionFilters) || []
614
+ });
615
+ let filters = result.button.accept ? result.value : null;
616
+ if (filters !== null) {
617
+ await service.pauseOnExceptions(filters);
618
+ }
619
+ }
620
+ }
621
+ });
622
+ let autoCollapseSidebar = false;
623
+ if (settingRegistry) {
624
+ const setting = await settingRegistry.load(main.id);
625
+ const updateSettings = () => {
626
+ autoCollapseSidebar = setting.get('autoCollapseDebuggerSidebar')
627
+ .composite;
628
+ };
629
+ updateSettings();
630
+ setting.changed.connect(updateSettings);
631
+ }
536
632
  service.eventMessage.connect((_, event) => {
537
- commands.notifyCommandChanged();
633
+ notifyCommands(app);
538
634
  if (labShell && event.event === 'initialized') {
539
635
  labShell.activateById(sidebar.id);
540
636
  }
637
+ else if (labShell &&
638
+ sidebar.isVisible &&
639
+ event.event === 'terminated' &&
640
+ autoCollapseSidebar) {
641
+ labShell.collapseRight();
642
+ }
541
643
  });
542
644
  service.sessionChanged.connect(_ => {
543
- commands.notifyCommandChanged();
645
+ notifyCommands(app);
544
646
  });
545
647
  if (restorer) {
546
648
  restorer.add(sidebar, 'debugger-sidebar');
547
649
  }
548
650
  sidebar.node.setAttribute('role', 'region');
549
651
  sidebar.node.setAttribute('aria-label', trans.__('Debugger section'));
550
- shell.add(sidebar, 'right');
652
+ sidebar.title.caption = trans.__('Debugger');
653
+ shell.add(sidebar, 'right', { type: 'Debugger' });
551
654
  commands.addCommand(CommandIDs.showPanel, {
552
655
  label: translator.load('jupyterlab').__('Debugger Panel'),
553
656
  execute: () => {
@@ -562,7 +665,8 @@ const main = {
562
665
  CommandIDs.next,
563
666
  CommandIDs.stepIn,
564
667
  CommandIDs.stepOut,
565
- CommandIDs.evaluate
668
+ CommandIDs.evaluate,
669
+ CommandIDs.pauseOnExceptions
566
670
  ].forEach(command => {
567
671
  palette.addItem({ command, category });
568
672
  });
@@ -583,11 +687,16 @@ const main = {
583
687
  })
584
688
  .forEach(editor => {
585
689
  requestAnimationFrame(() => {
586
- Debugger.EditorHandler.showCurrentLine(editor, frame.line);
690
+ void editor.reveal().then(() => {
691
+ const edit = editor.get();
692
+ if (edit) {
693
+ Debugger.EditorHandler.showCurrentLine(edit, frame.line);
694
+ }
695
+ });
587
696
  });
588
697
  });
589
698
  };
590
- const onCurrentSourceOpened = (_, source, breakpoint) => {
699
+ const onSourceOpened = (_, source, breakpoint) => {
591
700
  var _a, _b, _c, _d, _e, _f, _g;
592
701
  if (!source) {
593
702
  return;
@@ -602,18 +711,13 @@ const main = {
602
711
  if (results.length > 0) {
603
712
  if (breakpoint && typeof breakpoint.line !== 'undefined') {
604
713
  results.forEach(editor => {
605
- if (editor instanceof CodeMirrorEditor) {
606
- editor.scrollIntoViewCentered({
607
- line: breakpoint.line - 1,
608
- ch: breakpoint.column || 0
609
- });
610
- }
611
- else {
612
- editor.revealPosition({
714
+ void editor.reveal().then(() => {
715
+ var _a;
716
+ (_a = editor.get()) === null || _a === void 0 ? void 0 : _a.revealPosition({
613
717
  line: breakpoint.line - 1,
614
718
  column: breakpoint.column || 0
615
719
  });
616
- }
720
+ });
617
721
  });
618
722
  }
619
723
  return;
@@ -626,8 +730,10 @@ const main = {
626
730
  const editor = editorWrapper.editor;
627
731
  const editorHandler = new Debugger.EditorHandler({
628
732
  debuggerService: service,
629
- editor,
630
- path
733
+ editorReady: () => Promise.resolve(editor),
734
+ getEditor: () => editor,
735
+ path,
736
+ src: editor.model.sharedModel
631
737
  });
632
738
  editorWrapper.disposed.connect(() => editorHandler.dispose());
633
739
  debuggerSources.open({
@@ -640,8 +746,15 @@ const main = {
640
746
  Debugger.EditorHandler.showCurrentLine(editor, frame.line);
641
747
  }
642
748
  };
749
+ const onKernelSourceOpened = (_, source, breakpoint) => {
750
+ if (!source) {
751
+ return;
752
+ }
753
+ onSourceOpened(null, source, breakpoint);
754
+ };
643
755
  model.callstack.currentFrameChanged.connect(onCurrentFrameChanged);
644
- model.sources.currentSourceOpened.connect(onCurrentSourceOpened);
756
+ model.sources.currentSourceOpened.connect(onSourceOpened);
757
+ model.kernelSources.kernelSourceOpened.connect(onKernelSourceOpened);
645
758
  model.breakpoints.clicked.connect(async (_, breakpoint) => {
646
759
  var _a;
647
760
  const path = (_a = breakpoint.source) === null || _a === void 0 ? void 0 : _a.path;
@@ -649,7 +762,7 @@ const main = {
649
762
  sourceReference: 0,
650
763
  path
651
764
  });
652
- onCurrentSourceOpened(null, source, breakpoint);
765
+ onSourceOpened(null, source, breakpoint);
653
766
  });
654
767
  }
655
768
  }