@jupyterlab/debugger 4.5.0-beta.0 → 4.5.0-rc.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.
- package/lib/displayregistry.d.ts +31 -0
- package/lib/displayregistry.js +39 -0
- package/lib/displayregistry.js.map +1 -0
- package/lib/handler.d.ts +11 -0
- package/lib/handler.js +13 -4
- package/lib/handler.js.map +1 -1
- package/lib/handlers/console.d.ts +7 -0
- package/lib/handlers/console.js +32 -0
- package/lib/handlers/console.js.map +1 -1
- package/lib/handlers/file.d.ts +7 -0
- package/lib/handlers/file.js +30 -1
- package/lib/handlers/file.js.map +1 -1
- package/lib/handlers/notebook.d.ts +7 -0
- package/lib/handlers/notebook.js +30 -0
- package/lib/handlers/notebook.js.map +1 -1
- package/lib/handlers/pausedoverlay.d.ts +37 -0
- package/lib/handlers/pausedoverlay.js +80 -0
- package/lib/handlers/pausedoverlay.js.map +1 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/model.d.ts +16 -1
- package/lib/model.js +10 -4
- package/lib/model.js.map +1 -1
- package/lib/panels/breakpoints/body.d.ts +0 -3
- package/lib/panels/breakpoints/body.js +8 -12
- package/lib/panels/breakpoints/body.js.map +1 -1
- package/lib/panels/breakpoints/model.d.ts +24 -1
- package/lib/panels/breakpoints/model.js +12 -1
- package/lib/panels/breakpoints/model.js.map +1 -1
- package/lib/panels/callstack/body.js +3 -11
- package/lib/panels/callstack/body.js.map +1 -1
- package/lib/panels/callstack/model.d.ts +33 -1
- package/lib/panels/callstack/model.js +15 -1
- package/lib/panels/callstack/model.js.map +1 -1
- package/lib/panels/sources/body.js +7 -6
- package/lib/panels/sources/body.js.map +1 -1
- package/lib/panels/sources/model.d.ts +15 -1
- package/lib/panels/sources/model.js +19 -0
- package/lib/panels/sources/model.js.map +1 -1
- package/lib/service.d.ts +11 -0
- package/lib/service.js +35 -13
- package/lib/service.js.map +1 -1
- package/lib/sidebar.d.ts +1 -1
- package/lib/tokens.d.ts +39 -1
- package/lib/tokens.js +4 -0
- package/lib/tokens.js.map +1 -1
- package/package.json +18 -17
- package/src/displayregistry.ts +59 -0
- package/src/handler.ts +26 -4
- package/src/handlers/console.ts +43 -0
- package/src/handlers/file.ts +41 -0
- package/src/handlers/notebook.ts +40 -0
- package/src/handlers/pausedoverlay.ts +112 -0
- package/src/index.ts +4 -1
- package/src/model.ts +27 -4
- package/src/panels/breakpoints/body.tsx +9 -12
- package/src/panels/breakpoints/index.ts +1 -0
- package/src/panels/breakpoints/model.ts +33 -2
- package/src/panels/callstack/body.tsx +2 -10
- package/src/panels/callstack/model.ts +49 -2
- package/src/panels/sources/body.ts +7 -5
- package/src/panels/sources/model.ts +28 -1
- package/src/service.ts +57 -11
- package/src/sidebar.ts +1 -1
- package/src/tokens.ts +49 -1
- package/style/base.css +36 -1
package/src/service.ts
CHANGED
|
@@ -20,6 +20,7 @@ import { Debugger } from './debugger';
|
|
|
20
20
|
import { VariablesModel } from './panels/variables/model';
|
|
21
21
|
|
|
22
22
|
import { IDebugger } from './tokens';
|
|
23
|
+
import { IDebuggerDisplayRegistry } from './tokens';
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
26
|
* A concrete implementation of the IDebugger interface.
|
|
@@ -39,7 +40,9 @@ export class DebuggerService implements IDebugger, IDisposable {
|
|
|
39
40
|
// runs a kernel with debugging ability
|
|
40
41
|
this._session = null;
|
|
41
42
|
this._specsManager = options.specsManager ?? null;
|
|
42
|
-
this._model = new Debugger.Model(
|
|
43
|
+
this._model = new Debugger.Model({
|
|
44
|
+
displayRegistry: options.displayRegistry
|
|
45
|
+
});
|
|
43
46
|
this._debuggerSources = options.debuggerSources ?? null;
|
|
44
47
|
this._trans = (options.translator || nullTranslator).load('jupyterlab');
|
|
45
48
|
}
|
|
@@ -425,7 +428,7 @@ export class DebuggerService implements IDebugger, IDisposable {
|
|
|
425
428
|
|
|
426
429
|
const reply = await this.session.restoreState();
|
|
427
430
|
const { body } = reply;
|
|
428
|
-
const
|
|
431
|
+
const kernelBreakpoints = this._mapBreakpoints(body.breakpoints);
|
|
429
432
|
const stoppedThreads = new Set(body.stoppedThreads);
|
|
430
433
|
|
|
431
434
|
this._model.hasRichVariableRendering = body.richRendering === true;
|
|
@@ -453,6 +456,28 @@ export class DebuggerService implements IDebugger, IDisposable {
|
|
|
453
456
|
? this.session?.connection?.name || '-'
|
|
454
457
|
: '-';
|
|
455
458
|
}
|
|
459
|
+
const breakpoints = this._migrateBreakpoints(
|
|
460
|
+
this._model.breakpoints.breakpoints
|
|
461
|
+
);
|
|
462
|
+
|
|
463
|
+
// Merge kernel breakpoints with existing breakpoints, avoiding duplicates
|
|
464
|
+
for (const [path, kernelBpList] of kernelBreakpoints) {
|
|
465
|
+
const existingBreakpoints = breakpoints.get(path) ?? [];
|
|
466
|
+
|
|
467
|
+
// Filter out kernel breakpoints that already exist at the same line
|
|
468
|
+
const newBreakpoints = kernelBpList.filter(
|
|
469
|
+
kernelBp =>
|
|
470
|
+
!existingBreakpoints.some(
|
|
471
|
+
existingBp => existingBp.line === kernelBp.line
|
|
472
|
+
)
|
|
473
|
+
);
|
|
474
|
+
|
|
475
|
+
// Merge existing and new breakpoints
|
|
476
|
+
breakpoints.set(path, [...existingBreakpoints, ...newBreakpoints]);
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
// restore in kernel AND model
|
|
480
|
+
await this._restoreBreakpoints(breakpoints);
|
|
456
481
|
|
|
457
482
|
if (this._debuggerSources) {
|
|
458
483
|
const filtered = this._filterBreakpoints(breakpoints);
|
|
@@ -571,6 +596,7 @@ export class DebuggerService implements IDebugger, IDisposable {
|
|
|
571
596
|
const localBreakpoints = breakpoints
|
|
572
597
|
.filter(({ line }) => typeof line === 'number')
|
|
573
598
|
.map(({ line }) => ({ line: line! }));
|
|
599
|
+
|
|
574
600
|
const remoteBreakpoints = this._mapBreakpoints(state.body.breakpoints);
|
|
575
601
|
|
|
576
602
|
// Set the local copy of breakpoints to reflect only editors that exist.
|
|
@@ -690,21 +716,36 @@ export class DebuggerService implements IDebugger, IDisposable {
|
|
|
690
716
|
await this._dumpCell(cell);
|
|
691
717
|
}
|
|
692
718
|
|
|
693
|
-
const breakpoints =
|
|
719
|
+
const breakpoints = this._migrateBreakpoints(state.breakpoints);
|
|
720
|
+
|
|
721
|
+
await this._restoreBreakpoints(breakpoints);
|
|
722
|
+
const config = await this.session!.sendRequest('configurationDone', {});
|
|
723
|
+
await this.restoreState(false);
|
|
724
|
+
return config.success;
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
/**
|
|
728
|
+
* Migrate breakpoints from previous path to new path when restoring service state
|
|
729
|
+
* @param breakpoints
|
|
730
|
+
* @returns
|
|
731
|
+
*/
|
|
732
|
+
private _migrateBreakpoints(
|
|
733
|
+
breakpoints: Map<string, IDebugger.IBreakpoint[]>
|
|
734
|
+
) {
|
|
735
|
+
const migratedBreakpoints = new Map<string, IDebugger.IBreakpoint[]>();
|
|
694
736
|
const kernel = this.session?.connection?.kernel?.name ?? '';
|
|
695
737
|
const { prefix, suffix } = this._config.getTmpFileParams(kernel);
|
|
696
|
-
for (const item of
|
|
738
|
+
for (const item of breakpoints) {
|
|
697
739
|
const [id, list] = item;
|
|
698
|
-
const
|
|
699
|
-
const codeHash =
|
|
740
|
+
const unSuffixedId = id.substring(0, id.length - suffix.length);
|
|
741
|
+
const codeHash = unSuffixedId.substring(
|
|
742
|
+
unSuffixedId.lastIndexOf('/') + 1
|
|
743
|
+
);
|
|
700
744
|
const newId = prefix.concat(codeHash).concat(suffix);
|
|
701
|
-
|
|
745
|
+
migratedBreakpoints.set(newId, list);
|
|
702
746
|
}
|
|
703
747
|
|
|
704
|
-
|
|
705
|
-
const config = await this.session!.sendRequest('configurationDone', {});
|
|
706
|
-
await this.restoreState(false);
|
|
707
|
-
return config.success;
|
|
748
|
+
return migratedBreakpoints;
|
|
708
749
|
}
|
|
709
750
|
|
|
710
751
|
/**
|
|
@@ -1045,5 +1086,10 @@ export namespace DebuggerService {
|
|
|
1045
1086
|
* The application language translator.
|
|
1046
1087
|
*/
|
|
1047
1088
|
translator?: ITranslator | null;
|
|
1089
|
+
|
|
1090
|
+
/**
|
|
1091
|
+
* The display registry.
|
|
1092
|
+
*/
|
|
1093
|
+
displayRegistry?: IDebuggerDisplayRegistry | null;
|
|
1048
1094
|
}
|
|
1049
1095
|
}
|
package/src/sidebar.ts
CHANGED
package/src/tokens.ts
CHANGED
|
@@ -19,6 +19,8 @@ import { DebugProtocol } from '@vscode/debugprotocol';
|
|
|
19
19
|
|
|
20
20
|
import { DebuggerHandler } from './handler';
|
|
21
21
|
|
|
22
|
+
import { IDebuggerSourceDisplayProvider } from './displayregistry';
|
|
23
|
+
|
|
22
24
|
/**
|
|
23
25
|
* An interface describing an application's visual debugger.
|
|
24
26
|
*/
|
|
@@ -122,7 +124,6 @@ export interface IDebugger {
|
|
|
122
124
|
* Request to set a variable in the global scope.
|
|
123
125
|
*
|
|
124
126
|
* @param name The name of the variable.
|
|
125
|
-
* @param value The value of the variable.
|
|
126
127
|
*/
|
|
127
128
|
copyToGlobals(name: string): Promise<void>;
|
|
128
129
|
|
|
@@ -886,6 +887,14 @@ export namespace IDebugger {
|
|
|
886
887
|
* @param breakpoints The list of breakpoints.
|
|
887
888
|
*/
|
|
888
889
|
setBreakpoints(id: string, breakpoints: IBreakpoint[]): void;
|
|
890
|
+
|
|
891
|
+
/**
|
|
892
|
+
* Function to get a display name for a breakpoint.
|
|
893
|
+
*
|
|
894
|
+
* @param breakpoint The breakpoint object.
|
|
895
|
+
* @returns The display name.
|
|
896
|
+
*/
|
|
897
|
+
getDisplayName(breakpoint: IBreakpoint): string;
|
|
889
898
|
}
|
|
890
899
|
|
|
891
900
|
/**
|
|
@@ -911,6 +920,14 @@ export namespace IDebugger {
|
|
|
911
920
|
* Signal emitted when the frames have changed.
|
|
912
921
|
*/
|
|
913
922
|
readonly framesChanged: ISignal<this, IDebugger.IStackFrame[]>;
|
|
923
|
+
|
|
924
|
+
/**
|
|
925
|
+
* Function to get a display name for a frame.
|
|
926
|
+
*
|
|
927
|
+
* @param frame The frame object.
|
|
928
|
+
* @returns The display name.
|
|
929
|
+
*/
|
|
930
|
+
getDisplayName?(frame: IDebugger.IStackFrame): string;
|
|
914
931
|
}
|
|
915
932
|
|
|
916
933
|
/**
|
|
@@ -1010,6 +1027,14 @@ export namespace IDebugger {
|
|
|
1010
1027
|
* Open a source in the main area.
|
|
1011
1028
|
*/
|
|
1012
1029
|
open(): void;
|
|
1030
|
+
|
|
1031
|
+
/**
|
|
1032
|
+
* Function to get a display name for a frame.
|
|
1033
|
+
*
|
|
1034
|
+
* @param frame The frame object.
|
|
1035
|
+
* @returns The display name.
|
|
1036
|
+
*/
|
|
1037
|
+
getDisplayName(frame: IDebugger.IStackFrame): string;
|
|
1013
1038
|
}
|
|
1014
1039
|
|
|
1015
1040
|
/**
|
|
@@ -1087,6 +1112,21 @@ export namespace IDebugger {
|
|
|
1087
1112
|
}
|
|
1088
1113
|
}
|
|
1089
1114
|
|
|
1115
|
+
/**
|
|
1116
|
+
* Interface token for the Debugger Display Registry service.
|
|
1117
|
+
*/
|
|
1118
|
+
export interface IDebuggerDisplayRegistry {
|
|
1119
|
+
/**
|
|
1120
|
+
* Register a display provider.
|
|
1121
|
+
*/
|
|
1122
|
+
register(provider: IDebuggerSourceDisplayProvider): void;
|
|
1123
|
+
|
|
1124
|
+
/**
|
|
1125
|
+
* Get a display name for a given source.
|
|
1126
|
+
*/
|
|
1127
|
+
getDisplayName(source: IDebugger.Source): string;
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1090
1130
|
/**
|
|
1091
1131
|
* The visual debugger token.
|
|
1092
1132
|
*/
|
|
@@ -1134,3 +1174,11 @@ export const IDebuggerSourceViewer = new Token<IDebugger.ISourceViewer>(
|
|
|
1134
1174
|
'@jupyterlab/debugger:IDebuggerSourceViewer',
|
|
1135
1175
|
'A debugger source viewer.'
|
|
1136
1176
|
);
|
|
1177
|
+
|
|
1178
|
+
/**
|
|
1179
|
+
* Debugger display registry token.
|
|
1180
|
+
*/
|
|
1181
|
+
export const IDebuggerDisplayRegistry = new Token<IDebuggerDisplayRegistry>(
|
|
1182
|
+
'@jupyterlab/debugger:IDebuggerDisplayRegistry',
|
|
1183
|
+
'A service for registering display labels for cells/files in the debugger.'
|
|
1184
|
+
);
|
package/style/base.css
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
.jp-left-truncated {
|
|
15
15
|
overflow: hidden;
|
|
16
16
|
text-overflow: ellipsis;
|
|
17
|
-
direction:
|
|
17
|
+
direction: ltr;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
#jp-debugger .jp-switch-label {
|
|
@@ -29,3 +29,38 @@
|
|
|
29
29
|
.jp-DebuggerBugButton[aria-pressed='true'] path {
|
|
30
30
|
fill: var(--jp-warn-color0);
|
|
31
31
|
}
|
|
32
|
+
|
|
33
|
+
.jp-DebuggerPausedOverlay {
|
|
34
|
+
position: absolute;
|
|
35
|
+
top: 8px;
|
|
36
|
+
left: 50%;
|
|
37
|
+
transform: translateX(-50%);
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
gap: 6px;
|
|
41
|
+
padding: 4px 8px;
|
|
42
|
+
border: 1px solid var(--jp-border-color2);
|
|
43
|
+
border-radius: 4px;
|
|
44
|
+
background: var(--jp-layout-color2);
|
|
45
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
46
|
+
z-index: 1000;
|
|
47
|
+
font-size: var(--jp-ui-font-size1);
|
|
48
|
+
color: var(--jp-ui-font-color1);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.jp-DebuggerPausedButton {
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
justify-content: center;
|
|
55
|
+
width: 24px;
|
|
56
|
+
height: 24px;
|
|
57
|
+
border: none;
|
|
58
|
+
border-radius: 3px;
|
|
59
|
+
background: transparent;
|
|
60
|
+
cursor: pointer;
|
|
61
|
+
padding: 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.jp-DebuggerPausedButton:hover {
|
|
65
|
+
background: var(--jp-layout-color3);
|
|
66
|
+
}
|