@jupyterlab/debugger 3.3.0-alpha.6 → 3.3.0-beta.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/debugger.d.ts +10 -2
- package/lib/debugger.js +12 -3
- package/lib/debugger.js.map +1 -1
- package/lib/handler.d.ts +32 -3
- package/lib/handler.js +70 -66
- package/lib/handler.js.map +1 -1
- package/lib/handlers/editor.d.ts +8 -0
- package/lib/handlers/editor.js +12 -0
- package/lib/handlers/editor.js.map +1 -1
- package/lib/handlers/file.d.ts +1 -0
- package/lib/handlers/file.js +6 -1
- package/lib/handlers/file.js.map +1 -1
- package/lib/handlers/notebook.js +12 -2
- package/lib/handlers/notebook.js.map +1 -1
- package/lib/icons.d.ts +2 -0
- package/lib/icons.js +10 -0
- package/lib/icons.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/model.d.ts +13 -1
- package/lib/model.js +13 -0
- package/lib/model.js.map +1 -1
- package/lib/panels/breakpoints/body.d.ts +1 -1
- package/lib/panels/breakpoints/body.js +1 -1
- package/lib/panels/breakpoints/body.js.map +1 -1
- package/lib/panels/breakpoints/header.d.ts +1 -1
- package/lib/panels/breakpoints/header.js +1 -1
- package/lib/panels/breakpoints/header.js.map +1 -1
- package/lib/panels/breakpoints/index.d.ts +18 -0
- package/lib/panels/breakpoints/index.js +11 -5
- package/lib/panels/breakpoints/index.js.map +1 -1
- package/lib/panels/callstack/body.d.ts +1 -1
- package/lib/panels/callstack/body.js +2 -2
- package/lib/panels/callstack/body.js.map +1 -1
- package/lib/panels/callstack/header.d.ts +1 -1
- package/lib/panels/callstack/header.js +1 -1
- package/lib/panels/callstack/header.js.map +1 -1
- package/lib/panels/callstack/index.js +1 -1
- package/lib/panels/callstack/index.js.map +1 -1
- package/lib/panels/callstack/model.d.ts +3 -3
- package/lib/panels/callstack/model.js +3 -1
- package/lib/panels/callstack/model.js.map +1 -1
- package/lib/panels/kernelSources/body.d.ts +47 -0
- package/lib/panels/kernelSources/body.js +86 -0
- package/lib/panels/kernelSources/body.js.map +1 -0
- package/lib/panels/kernelSources/filter.d.ts +13 -0
- package/lib/panels/kernelSources/filter.js +17 -0
- package/lib/panels/kernelSources/filter.js.map +1 -0
- package/lib/panels/kernelSources/header.d.ts +19 -0
- package/lib/panels/kernelSources/header.js +33 -0
- package/lib/panels/kernelSources/header.js.map +1 -0
- package/lib/panels/kernelSources/index.d.ts +39 -0
- package/lib/panels/kernelSources/index.js +59 -0
- package/lib/panels/kernelSources/index.js.map +1 -0
- package/lib/panels/kernelSources/model.d.ts +56 -0
- package/lib/panels/kernelSources/model.js +86 -0
- package/lib/panels/kernelSources/model.js.map +1 -0
- package/lib/panels/sources/header.d.ts +1 -1
- package/lib/panels/sources/header.js +1 -1
- package/lib/panels/sources/header.js.map +1 -1
- package/lib/panels/sources/index.js +1 -1
- package/lib/panels/sources/index.js.map +1 -1
- package/lib/panels/sources/model.d.ts +2 -2
- package/lib/panels/variables/grid.js +58 -3
- package/lib/panels/variables/grid.js.map +1 -1
- package/lib/panels/variables/header.d.ts +1 -1
- package/lib/panels/variables/header.js +1 -1
- package/lib/panels/variables/header.js.map +1 -1
- package/lib/panels/variables/index.js +8 -2
- package/lib/panels/variables/index.js.map +1 -1
- package/lib/panels/variables/mimerenderer.d.ts +44 -0
- package/lib/panels/variables/mimerenderer.js +75 -0
- package/lib/panels/variables/mimerenderer.js.map +1 -0
- package/lib/panels/variables/model.d.ts +3 -0
- package/lib/panels/variables/model.js +7 -0
- package/lib/panels/variables/model.js.map +1 -1
- package/lib/panels/variables/scope.d.ts +1 -1
- package/lib/panels/variables/scope.js +2 -1
- package/lib/panels/variables/scope.js.map +1 -1
- package/lib/panels/variables/tree.d.ts +14 -1
- package/lib/panels/variables/tree.js +47 -9
- package/lib/panels/variables/tree.js.map +1 -1
- package/lib/service.d.ts +25 -1
- package/lib/service.js +122 -6
- package/lib/service.js.map +1 -1
- package/lib/session.d.ts +23 -1
- package/lib/session.js +39 -5
- package/lib/session.js.map +1 -1
- package/lib/sidebar.d.ts +9 -0
- package/lib/sidebar.js +9 -1
- package/lib/sidebar.js.map +1 -1
- package/lib/tokens.d.ts +166 -11
- package/lib/tokens.js +4 -0
- package/lib/tokens.js.map +1 -1
- package/package.json +21 -21
- package/style/base.css +5 -0
- package/style/icons/open-kernel-source.svg +6 -0
- package/style/icons/pause.svg +6 -0
- package/style/icons.css +10 -0
- package/style/kernelSources.css +42 -0
- package/style/variables.css +46 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { MainAreaWidget } from '@jupyterlab/apputils';
|
|
2
|
+
import { MimeModel } from '@jupyterlab/rendermime';
|
|
3
|
+
import { nullTranslator } from '@jupyterlab/translation';
|
|
4
|
+
import { PromiseDelegate } from '@lumino/coreutils';
|
|
5
|
+
import { Panel } from '@lumino/widgets';
|
|
6
|
+
import { murmur2 } from '../../hash';
|
|
7
|
+
/**
|
|
8
|
+
* Debugger variable mime type renderer
|
|
9
|
+
*/
|
|
10
|
+
export class VariableMimeRenderer extends MainAreaWidget {
|
|
11
|
+
/**
|
|
12
|
+
* Instantiate a new VariableMimeRenderer.
|
|
13
|
+
*/
|
|
14
|
+
constructor(options) {
|
|
15
|
+
const { dataLoader, rendermime, translator } = options;
|
|
16
|
+
const content = new Panel();
|
|
17
|
+
const loaded = new PromiseDelegate();
|
|
18
|
+
super({
|
|
19
|
+
content,
|
|
20
|
+
reveal: Promise.all([dataLoader, loaded.promise])
|
|
21
|
+
});
|
|
22
|
+
this.trans = (translator !== null && translator !== void 0 ? translator : nullTranslator).load('jupyterlab');
|
|
23
|
+
this.dataLoader = dataLoader;
|
|
24
|
+
this.renderMime = rendermime;
|
|
25
|
+
this._dataHash = null;
|
|
26
|
+
this.refresh()
|
|
27
|
+
.then(() => {
|
|
28
|
+
loaded.resolve();
|
|
29
|
+
})
|
|
30
|
+
.catch(reason => loaded.reject(reason));
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Refresh the variable view
|
|
34
|
+
*/
|
|
35
|
+
async refresh(force = false) {
|
|
36
|
+
let data = await this.dataLoader();
|
|
37
|
+
if (Object.keys(data.data).length === 0) {
|
|
38
|
+
data = {
|
|
39
|
+
data: {
|
|
40
|
+
'text/plain': this.trans.__('The variable is undefined in the active context.')
|
|
41
|
+
},
|
|
42
|
+
metadata: {}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
if (data.data) {
|
|
46
|
+
const hash = murmur2(JSON.stringify(data), 17);
|
|
47
|
+
if (force || this._dataHash !== hash) {
|
|
48
|
+
if (this.content.layout) {
|
|
49
|
+
this.content.widgets.forEach(w => {
|
|
50
|
+
this.content.layout.removeWidget(w);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
// We trust unconditionally the data as the user is required to
|
|
54
|
+
// execute the code to load a particular variable in memory
|
|
55
|
+
const mimeType = this.renderMime.preferredMimeType(data.data, 'any');
|
|
56
|
+
if (mimeType) {
|
|
57
|
+
const widget = this.renderMime.createRenderer(mimeType);
|
|
58
|
+
const model = new MimeModel(Object.assign(Object.assign({}, data), { trusted: true }));
|
|
59
|
+
this._dataHash = hash;
|
|
60
|
+
await widget.renderModel(model);
|
|
61
|
+
this.content.addWidget(widget);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
this._dataHash = null;
|
|
65
|
+
return Promise.reject('Unable to determine the preferred mime type.');
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
this._dataHash = null;
|
|
71
|
+
return Promise.reject('Unable to get a view on the variable.');
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=mimerenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mimerenderer.js","sourceRoot":"","sources":["../../../src/panels/variables/mimerenderer.ts"],"names":[],"mappings":"AAAA,OA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,SAAS,GAAG,IAAI,CAAC;oBACtB,OAAO,OAAO,CAAC,MAAM,CAAC,8CAA8C,CAAC,CAAC;iBACvE;aACF;SACF;aAAM;YACL,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YACtB,OAAO,OAAO,CAAC,MAAM,CAAC,uCAAuC,CAAC,CAAC;SAChE;IACH,CAAC;CAMF"}
|
|
@@ -20,12 +20,15 @@ export declare class VariablesModel implements IDebugger.Model.IVariables {
|
|
|
20
20
|
* Signal emitted when the current variable has been expanded.
|
|
21
21
|
*/
|
|
22
22
|
get variableExpanded(): ISignal<this, IDebugger.IVariable>;
|
|
23
|
+
get selectedVariable(): IDebugger.IVariableSelection | null;
|
|
24
|
+
set selectedVariable(selection: IDebugger.IVariableSelection | null);
|
|
23
25
|
/**
|
|
24
26
|
* Expand a variable.
|
|
25
27
|
*
|
|
26
28
|
* @param variable The variable to expand.
|
|
27
29
|
*/
|
|
28
30
|
expandVariable(variable: IDebugger.IVariable): void;
|
|
31
|
+
private _selectedVariable;
|
|
29
32
|
private _state;
|
|
30
33
|
private _variableExpanded;
|
|
31
34
|
private _changed;
|
|
@@ -6,6 +6,7 @@ import { Signal } from '@lumino/signaling';
|
|
|
6
6
|
*/
|
|
7
7
|
export class VariablesModel {
|
|
8
8
|
constructor() {
|
|
9
|
+
this._selectedVariable = null;
|
|
9
10
|
this._state = [];
|
|
10
11
|
this._variableExpanded = new Signal(this);
|
|
11
12
|
this._changed = new Signal(this);
|
|
@@ -35,6 +36,12 @@ export class VariablesModel {
|
|
|
35
36
|
get variableExpanded() {
|
|
36
37
|
return this._variableExpanded;
|
|
37
38
|
}
|
|
39
|
+
get selectedVariable() {
|
|
40
|
+
return this._selectedVariable;
|
|
41
|
+
}
|
|
42
|
+
set selectedVariable(selection) {
|
|
43
|
+
this._selectedVariable = selection;
|
|
44
|
+
}
|
|
38
45
|
/**
|
|
39
46
|
* Expand a variable.
|
|
40
47
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/panels/variables/model.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAW,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAIpD;;GAEG;AACH,MAAM,OAAO,cAAc;IAA3B;
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/panels/variables/model.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAW,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAIpD;;GAEG;AACH,MAAM,OAAO,cAAc;IAA3B;QA8CU,sBAAiB,GAAwC,IAAI,CAAC;QAC9D,WAAM,GAAuB,EAAE,CAAC;QAChC,sBAAiB,GAAG,IAAI,MAAM,CAA4B,IAAI,CAAC,CAAC;QAChE,aAAQ,GAAG,IAAI,MAAM,CAAa,IAAI,CAAC,CAAC;IAClD,CAAC;IAjDC;;OAEG;IACH,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,IAAI,MAAM,CAAC,MAA0B;QACnC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,IAAI,gBAAgB;QAClB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAChC,CAAC;IAED,IAAI,gBAAgB;QAClB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAChC,CAAC;IACD,IAAI,gBAAgB,CAAC,SAA8C;QACjE,IAAI,CAAC,iBAAiB,GAAG,SAAS,CAAC;IACrC,CAAC;IAED;;;;OAIG;IACH,cAAc,CAAC,QAA6B;QAC1C,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC;CAMF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { ReactWidget } from '@jupyterlab/apputils';
|
|
2
3
|
import { ITranslator } from '@jupyterlab/translation';
|
|
3
|
-
import { ReactWidget } from '@jupyterlab/ui-components';
|
|
4
4
|
import { IDebugger } from '../../tokens';
|
|
5
5
|
import { VariablesBodyGrid } from './grid';
|
|
6
6
|
import { VariablesBodyTree } from './tree';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { ReactWidget, UseSignal } from '@jupyterlab/apputils';
|
|
1
2
|
import { nullTranslator } from '@jupyterlab/translation';
|
|
2
|
-
import { HTMLSelect
|
|
3
|
+
import { HTMLSelect } from '@jupyterlab/ui-components';
|
|
3
4
|
import React, { useState } from 'react';
|
|
4
5
|
/**
|
|
5
6
|
* A React component to handle scope changes.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope.js","sourceRoot":"","sources":["../../../src/panels/variables/scope.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EAEf,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"scope.js","sourceRoot":"","sources":["../../../src/panels/variables/scope.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAE9D,OAAO,EAEL,cAAc,EAEf,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEvD,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAQxC;;;;;;;;GAQG;AACH,MAAM,sBAAsB,GAAG,CAAC,EAC9B,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,KAAK,EAMN,EAAe,EAAE;IAChB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;IACxC,MAAM,MAA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AC,CAClB,oBAAC,sBAAsB,IACrB,KAAK,EAAE,IAAI,CAAC,MAAM,EAClB,KAAK,EAAE,IAAI,CAAC,MAAM,EAClB,IAAI,EAAE,IAAI,CAAC,KAAK,EAChB,IAAI,EAAE,IAAI,CAAC,KAAK,GAChB,CACH,CACS,CACb,CAAC;IACJ,CAAC;CAMF"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ReactWidget } from '@jupyterlab/
|
|
2
|
+
import { ReactWidget } from '@jupyterlab/apputils';
|
|
3
|
+
import { ITranslator } from '@jupyterlab/translation';
|
|
4
|
+
import { CommandRegistry } from '@lumino/commands';
|
|
3
5
|
import { IDebugger } from '../../tokens';
|
|
4
6
|
/**
|
|
5
7
|
* The body for tree of variables.
|
|
@@ -29,10 +31,13 @@ export declare class VariablesBodyTree extends ReactWidget {
|
|
|
29
31
|
* @param model The variables model.
|
|
30
32
|
*/
|
|
31
33
|
private _updateScopes;
|
|
34
|
+
protected model: IDebugger.Model.IVariables;
|
|
35
|
+
private _commands;
|
|
32
36
|
private _scope;
|
|
33
37
|
private _scopes;
|
|
34
38
|
private _filter;
|
|
35
39
|
private _service;
|
|
40
|
+
private _translator;
|
|
36
41
|
}
|
|
37
42
|
/**
|
|
38
43
|
* A namespace for VariablesBodyTree `statics`.
|
|
@@ -50,6 +55,14 @@ declare namespace VariablesBodyTree {
|
|
|
50
55
|
* The debugger service.
|
|
51
56
|
*/
|
|
52
57
|
service: IDebugger;
|
|
58
|
+
/**
|
|
59
|
+
* The commands registry.
|
|
60
|
+
*/
|
|
61
|
+
commands: CommandRegistry;
|
|
62
|
+
/**
|
|
63
|
+
* The application language translator
|
|
64
|
+
*/
|
|
65
|
+
translator?: ITranslator;
|
|
53
66
|
}
|
|
54
67
|
}
|
|
55
68
|
export {};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
// Copyright (c) Jupyter Development Team.
|
|
2
2
|
// Distributed under the terms of the Modified BSD License.
|
|
3
|
-
import {
|
|
3
|
+
import { ReactWidget } from '@jupyterlab/apputils';
|
|
4
|
+
import { nullTranslator } from '@jupyterlab/translation';
|
|
5
|
+
import { caretDownEmptyIcon, searchIcon } from '@jupyterlab/ui-components';
|
|
4
6
|
import { ArrayExt } from '@lumino/algorithm';
|
|
5
7
|
import React, { useEffect, useState } from 'react';
|
|
6
8
|
import { convertType } from '.';
|
|
9
|
+
import { Debugger } from '../../debugger';
|
|
7
10
|
/**
|
|
8
11
|
* The body for tree of variables.
|
|
9
12
|
*/
|
|
@@ -18,8 +21,10 @@ export class VariablesBodyTree extends ReactWidget {
|
|
|
18
21
|
this._scope = '';
|
|
19
22
|
this._scopes = [];
|
|
20
23
|
this._filter = new Set();
|
|
24
|
+
this._commands = options.commands;
|
|
21
25
|
this._service = options.service;
|
|
22
|
-
|
|
26
|
+
this._translator = options.translator;
|
|
27
|
+
const model = (this.model = options.model);
|
|
23
28
|
model.changed.connect(this._updateScopes, this);
|
|
24
29
|
this.addClass('jp-DebuggerVariables-body');
|
|
25
30
|
}
|
|
@@ -29,7 +34,9 @@ export class VariablesBodyTree extends ReactWidget {
|
|
|
29
34
|
render() {
|
|
30
35
|
var _a;
|
|
31
36
|
const scope = (_a = this._scopes.find(scope => scope.name === this._scope)) !== null && _a !== void 0 ? _a : this._scopes[0];
|
|
32
|
-
return scope ? (React.createElement(VariablesComponent, { key: scope.name, service: this._service, data: scope.variables, filter: this._filter
|
|
37
|
+
return scope ? (React.createElement(VariablesComponent, { key: scope.name, commands: this._commands, service: this._service, data: scope.variables, filter: this._filter, translator: this._translator, handleSelectVariable: variable => {
|
|
38
|
+
this.model.selectedVariable = variable;
|
|
39
|
+
} })) : (React.createElement("div", null));
|
|
33
40
|
}
|
|
34
41
|
/**
|
|
35
42
|
* Set the variable filter list.
|
|
@@ -66,14 +73,15 @@ export class VariablesBodyTree extends ReactWidget {
|
|
|
66
73
|
* @param props.service The debugger service.
|
|
67
74
|
* @param props.filter Optional variable filter list.
|
|
68
75
|
*/
|
|
69
|
-
const VariablesComponent = (
|
|
76
|
+
const VariablesComponent = (props) => {
|
|
77
|
+
const { commands, data, service, filter, translator, handleSelectVariable } = props;
|
|
70
78
|
const [variables, setVariables] = useState(data);
|
|
71
79
|
useEffect(() => {
|
|
72
80
|
setVariables(data);
|
|
73
81
|
}, [data]);
|
|
74
82
|
return (React.createElement("ul", null, variables === null || variables === void 0 ? void 0 : variables.filter(variable => !(filter || new Set()).has(variable.evaluateName || '')).map(variable => {
|
|
75
|
-
const key = `${variable.name}-${variable.evaluateName}-${variable.type}-${variable.value}`;
|
|
76
|
-
return (React.createElement(VariableComponent, { key: key, data: variable, service: service, filter: filter }));
|
|
83
|
+
const key = `${variable.name}-${variable.evaluateName}-${variable.type}-${variable.value}-${variable.variablesReference}`;
|
|
84
|
+
return (React.createElement(VariableComponent, { key: key, commands: commands, data: variable, service: service, filter: filter, translator: translator, onSelect: handleSelectVariable }));
|
|
77
85
|
})));
|
|
78
86
|
};
|
|
79
87
|
/**
|
|
@@ -84,7 +92,8 @@ const VariablesComponent = ({ data, service, filter }) => {
|
|
|
84
92
|
* @param props.service The debugger service.
|
|
85
93
|
* @param props.filter Optional variable filter list.
|
|
86
94
|
*/
|
|
87
|
-
const VariableComponent = (
|
|
95
|
+
const VariableComponent = (props) => {
|
|
96
|
+
const { commands, data, service, filter, translator, onSelect } = props;
|
|
88
97
|
const [variable] = useState(data);
|
|
89
98
|
const [expanded, setExpanded] = useState();
|
|
90
99
|
const [variables, setVariables] = useState();
|
|
@@ -94,7 +103,9 @@ const VariableComponent = ({ data, service, filter }) => {
|
|
|
94
103
|
const styleType = {
|
|
95
104
|
color: 'var(--jp-mirror-editor-string-color)'
|
|
96
105
|
};
|
|
106
|
+
const onSelection = onSelect !== null && onSelect !== void 0 ? onSelect : (() => void 0);
|
|
97
107
|
const expandable = variable.variablesReference !== 0 || variable.type === 'function';
|
|
108
|
+
const trans = (translator !== null && translator !== void 0 ? translator : nullTranslator).load('jupyterlab');
|
|
98
109
|
const onVariableClicked = async (e) => {
|
|
99
110
|
if (!expandable) {
|
|
100
111
|
return;
|
|
@@ -104,11 +115,38 @@ const VariableComponent = ({ data, service, filter }) => {
|
|
|
104
115
|
setExpanded(!expanded);
|
|
105
116
|
setVariables(variables);
|
|
106
117
|
};
|
|
107
|
-
return (React.createElement("li", { onClick: (e) => onVariableClicked(e)
|
|
118
|
+
return (React.createElement("li", { onClick: (e) => onVariableClicked(e), onMouseDown: () => {
|
|
119
|
+
onSelection(variable);
|
|
120
|
+
} },
|
|
108
121
|
React.createElement(caretDownEmptyIcon.react, { visibility: expandable ? 'visible' : 'hidden', stylesheet: "menuItem", tag: "span", transform: expanded ? 'rotate(0deg)' : 'rotate(-90deg)' }),
|
|
109
122
|
React.createElement("span", { style: styleName }, variable.name),
|
|
110
123
|
React.createElement("span", null, ": "),
|
|
111
124
|
React.createElement("span", { style: styleType }, convertType(variable)),
|
|
112
|
-
|
|
125
|
+
React.createElement("span", { className: "jp-DebuggerVariables-hspacer" }),
|
|
126
|
+
service.model.hasRichVariableRendering &&
|
|
127
|
+
// Don't add rich display for special entries
|
|
128
|
+
// debugpy: https://github.com/microsoft/debugpy/blob/cf0d684566edc339545b161da7c3dfc48af7c7d5/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_utils.py#L359
|
|
129
|
+
![
|
|
130
|
+
'special variables',
|
|
131
|
+
'protected variables',
|
|
132
|
+
'function variables',
|
|
133
|
+
'class variables'
|
|
134
|
+
].includes(variable.name) && (React.createElement("button", { className: "jp-DebuggerVariables-renderVariable", disabled: !commands.isEnabled(Debugger.CommandIDs.renderMimeVariable, {
|
|
135
|
+
name: variable.name,
|
|
136
|
+
variablesReference: variable.variablesReference
|
|
137
|
+
}), onClick: e => {
|
|
138
|
+
e.stopPropagation();
|
|
139
|
+
onSelection(variable);
|
|
140
|
+
commands
|
|
141
|
+
.execute(Debugger.CommandIDs.renderMimeVariable, {
|
|
142
|
+
name: variable.name,
|
|
143
|
+
variablesReference: variable.variablesReference
|
|
144
|
+
})
|
|
145
|
+
.catch(reason => {
|
|
146
|
+
console.error(`Failed to render variable ${variable.name}`, reason);
|
|
147
|
+
});
|
|
148
|
+
}, title: trans.__('Render variable') },
|
|
149
|
+
React.createElement(searchIcon.react, { stylesheet: "menuItem", tag: "span" }))),
|
|
150
|
+
expanded && variables && (React.createElement(VariablesComponent, { key: variable.name, commands: commands, data: variables, service: service, filter: filter, translator: translator }))));
|
|
113
151
|
};
|
|
114
152
|
//# sourceMappingURL=tree.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree.js","sourceRoot":"","sources":["../../../src/panels/variables/tree.tsx"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAE,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"tree.js","sourceRoot":"","sources":["../../../src/panels/variables/tree.tsx"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAe,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAE,MAAM,GAAG,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAI1C;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,WAAW;IAChD;;;;OAIG;IACH,YAAY,OAAmC;QAC7C,KAAK,EAAE,CAAC;QAkEF,WAAM,GAAG,EAAE,CAAC;QACZ,YAAO,GAAuB,EAAE,CAAC;QACjC,YAAO,GAAG,IAAI,GAAG,EAAU,CAAC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;qBACL,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,kBAAkB,EAAE;oBAC/C,IAAI,EAAE,QAAQ,CAAC,IAAI;oBACnB,kBAAkB,EAAE,QAAQ,CAAC,kBAAkB;iBACzC,CAAC;qBACR,KAAK,CAAC,MAAM,CAAC,EAAE;oBACd,OAAO,CAAC,KAAK,CACX,6BAA6B,QAAQ,CAAC,IAAI,EAAE,EAC5C,MAAM,CACP,CAAC;gBACJ,CAAC,CAAC,CAAC;YACP,CAAC,EACD,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAAC;YAElC,oBAAC,UAAU,CAAC,KAAK,IAAC,UAAU,EAAC,UAAU,EAAC,GAAG,EAAC,MAAM,GAAG,CAC9C,CACV;QAEF,QAAQ,IAAI,SAAS,IAAI,CACxB,oBAAC,kBAAkB,IACjB,GAAG,EAAE,QAAQ,CAAC,IAAI,EAClB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,GACtB,CACH,CACE,CACN,CAAC;AACJ,CAAC,CAAC"}
|
package/lib/service.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { KernelSpec, Session } from '@jupyterlab/services';
|
|
2
2
|
import { IDisposable } from '@lumino/disposable';
|
|
3
3
|
import { ISignal } from '@lumino/signaling';
|
|
4
|
-
import { DebugProtocol } from 'vscode
|
|
4
|
+
import { DebugProtocol } from '@vscode/debugprotocol';
|
|
5
5
|
import { IDebugger } from './tokens';
|
|
6
6
|
/**
|
|
7
7
|
* A concrete implementation of the IDebugger interface.
|
|
@@ -25,6 +25,10 @@ export declare class DebuggerService implements IDebugger, IDisposable {
|
|
|
25
25
|
* Whether the current debugger is started.
|
|
26
26
|
*/
|
|
27
27
|
get isStarted(): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Whether the current debugger is pausing on exceptions.
|
|
30
|
+
*/
|
|
31
|
+
get isPausingOnExceptions(): boolean;
|
|
28
32
|
/**
|
|
29
33
|
* Returns the debugger service's model.
|
|
30
34
|
*/
|
|
@@ -87,6 +91,14 @@ export declare class DebuggerService implements IDebugger, IDisposable {
|
|
|
87
91
|
* Makes the current thread run again for one step.
|
|
88
92
|
*/
|
|
89
93
|
next(): Promise<void>;
|
|
94
|
+
/**
|
|
95
|
+
* Request rich representation of a variable.
|
|
96
|
+
*
|
|
97
|
+
* @param variableName The variable name to request
|
|
98
|
+
* @param frameId The current frame id in which to request the variable
|
|
99
|
+
* @returns The mime renderer data model
|
|
100
|
+
*/
|
|
101
|
+
inspectRichVariable(variableName: string, frameId?: number): Promise<IDebugger.IRichVariable>;
|
|
90
102
|
/**
|
|
91
103
|
* Request variables for a given variable reference.
|
|
92
104
|
*
|
|
@@ -134,6 +146,17 @@ export declare class DebuggerService implements IDebugger, IDisposable {
|
|
|
134
146
|
* @param path - Optional path to the file where to set the breakpoints.
|
|
135
147
|
*/
|
|
136
148
|
updateBreakpoints(code: string, breakpoints: IDebugger.IBreakpoint[], path?: string): Promise<void>;
|
|
149
|
+
/**
|
|
150
|
+
* Determines if pausing on exceptions is supported by the kernel
|
|
151
|
+
*
|
|
152
|
+
*/
|
|
153
|
+
pauseOnExceptionsIsValid(): boolean;
|
|
154
|
+
/**
|
|
155
|
+
* Enable or disable pausing on exceptions.
|
|
156
|
+
*
|
|
157
|
+
* @param enable - Whether to enbale or disable pausing on exceptions.
|
|
158
|
+
*/
|
|
159
|
+
pauseOnExceptions(enable: boolean): Promise<void>;
|
|
137
160
|
/**
|
|
138
161
|
* Get the debugger state
|
|
139
162
|
*
|
|
@@ -215,6 +238,7 @@ export declare class DebuggerService implements IDebugger, IDisposable {
|
|
|
215
238
|
* @param frame The frame.
|
|
216
239
|
*/
|
|
217
240
|
private _onCurrentFrameChanged;
|
|
241
|
+
displayModules(): Promise<void>;
|
|
218
242
|
/**
|
|
219
243
|
* Handle a variable expanded event and request variables from the kernel.
|
|
220
244
|
*
|
package/lib/service.js
CHANGED
|
@@ -46,6 +46,20 @@ export class DebuggerService {
|
|
|
46
46
|
var _a, _b;
|
|
47
47
|
return (_b = (_a = this._session) === null || _a === void 0 ? void 0 : _a.isStarted) !== null && _b !== void 0 ? _b : false;
|
|
48
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Whether the current debugger is pausing on exceptions.
|
|
51
|
+
*/
|
|
52
|
+
get isPausingOnExceptions() {
|
|
53
|
+
var _a, _b, _c, _d, _e, _f;
|
|
54
|
+
const kernel = (_d = (_c = (_b = (_a = this.session) === null || _a === void 0 ? void 0 : _a.connection) === null || _b === void 0 ? void 0 : _b.kernel) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : '';
|
|
55
|
+
if (kernel) {
|
|
56
|
+
const tmpFileParams = this._config.getTmpFileParams(kernel);
|
|
57
|
+
if (tmpFileParams) {
|
|
58
|
+
return ((_f = (_e = this._session) === null || _e === void 0 ? void 0 : _e.pausingOnExceptions.includes(tmpFileParams.prefix)) !== null && _f !== void 0 ? _f : false);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
49
63
|
/**
|
|
50
64
|
* Returns the debugger service's model.
|
|
51
65
|
*/
|
|
@@ -233,6 +247,28 @@ export class DebuggerService {
|
|
|
233
247
|
console.error('Error:', err.message);
|
|
234
248
|
}
|
|
235
249
|
}
|
|
250
|
+
/**
|
|
251
|
+
* Request rich representation of a variable.
|
|
252
|
+
*
|
|
253
|
+
* @param variableName The variable name to request
|
|
254
|
+
* @param frameId The current frame id in which to request the variable
|
|
255
|
+
* @returns The mime renderer data model
|
|
256
|
+
*/
|
|
257
|
+
async inspectRichVariable(variableName, frameId) {
|
|
258
|
+
if (!this.session) {
|
|
259
|
+
throw new Error('No active debugger session');
|
|
260
|
+
}
|
|
261
|
+
const reply = await this.session.sendRequest('richInspectVariables', {
|
|
262
|
+
variableName,
|
|
263
|
+
frameId
|
|
264
|
+
});
|
|
265
|
+
if (reply.success) {
|
|
266
|
+
return reply.body;
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
throw new Error(reply.message);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
236
272
|
/**
|
|
237
273
|
* Request variables for a given variable reference.
|
|
238
274
|
*
|
|
@@ -245,7 +281,12 @@ export class DebuggerService {
|
|
|
245
281
|
const reply = await this.session.sendRequest('variables', {
|
|
246
282
|
variablesReference
|
|
247
283
|
});
|
|
248
|
-
|
|
284
|
+
if (reply.success) {
|
|
285
|
+
return reply.body.variables;
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
throw new Error(reply.message);
|
|
289
|
+
}
|
|
249
290
|
}
|
|
250
291
|
/**
|
|
251
292
|
* Requests all the defined variables and display them in the
|
|
@@ -286,8 +327,9 @@ export class DebuggerService {
|
|
|
286
327
|
}
|
|
287
328
|
const reply = await this.session.restoreState();
|
|
288
329
|
const { body } = reply;
|
|
289
|
-
const breakpoints = this._mapBreakpoints(
|
|
290
|
-
const stoppedThreads = new Set(
|
|
330
|
+
const breakpoints = this._mapBreakpoints(body.breakpoints);
|
|
331
|
+
const stoppedThreads = new Set(body.stoppedThreads);
|
|
332
|
+
this._model.hasRichVariableRendering = body.richRendering === true;
|
|
291
333
|
this._config.setHashParams({
|
|
292
334
|
kernel: (_d = (_c = (_b = (_a = this.session) === null || _a === void 0 ? void 0 : _a.connection) === null || _b === void 0 ? void 0 : _b.kernel) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : '',
|
|
293
335
|
method: body.hashMethod,
|
|
@@ -412,6 +454,69 @@ export class DebuggerService {
|
|
|
412
454
|
this._model.breakpoints.setBreakpoints(path, updatedBreakpoints);
|
|
413
455
|
await this.session.sendRequest('configurationDone', {});
|
|
414
456
|
}
|
|
457
|
+
/**
|
|
458
|
+
* Determines if pausing on exceptions is supported by the kernel
|
|
459
|
+
*
|
|
460
|
+
*/
|
|
461
|
+
pauseOnExceptionsIsValid() {
|
|
462
|
+
var _a;
|
|
463
|
+
if (this.isStarted) {
|
|
464
|
+
if ((_a = this.session) === null || _a === void 0 ? void 0 : _a.exceptionBreakpointFilters) {
|
|
465
|
+
return true;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
return false;
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Enable or disable pausing on exceptions.
|
|
472
|
+
*
|
|
473
|
+
* @param enable - Whether to enbale or disable pausing on exceptions.
|
|
474
|
+
*/
|
|
475
|
+
async pauseOnExceptions(enable) {
|
|
476
|
+
var _a, _b, _c, _d, _e;
|
|
477
|
+
if (!((_a = this.session) === null || _a === void 0 ? void 0 : _a.isStarted)) {
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
const kernel = (_e = (_d = (_c = (_b = this.session) === null || _b === void 0 ? void 0 : _b.connection) === null || _c === void 0 ? void 0 : _c.kernel) === null || _d === void 0 ? void 0 : _d.name) !== null && _e !== void 0 ? _e : '';
|
|
481
|
+
if (!kernel) {
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
const tmpFileParams = this._config.getTmpFileParams(kernel);
|
|
485
|
+
if (!tmpFileParams) {
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
let prefix = tmpFileParams.prefix;
|
|
489
|
+
const exceptionBreakpointFilters = this.session.exceptionBreakpointFilters;
|
|
490
|
+
let pauseOnExceptionKernels = this.session.pausingOnExceptions;
|
|
491
|
+
if (enable) {
|
|
492
|
+
if (!this.session.pausingOnExceptions.includes(prefix)) {
|
|
493
|
+
pauseOnExceptionKernels.push(prefix);
|
|
494
|
+
this.session.pausingOnExceptions = pauseOnExceptionKernels;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
else {
|
|
498
|
+
let prefixIndex = this.session.pausingOnExceptions.indexOf(prefix);
|
|
499
|
+
if (prefixIndex > -1) {
|
|
500
|
+
this.session.pausingOnExceptions = pauseOnExceptionKernels.splice(prefixIndex, 1);
|
|
501
|
+
this.session.pausingOnExceptions = pauseOnExceptionKernels;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
const filters = [];
|
|
505
|
+
const exceptionOptions = [];
|
|
506
|
+
const breakMode = enable ? 'userUnhandled' : 'never';
|
|
507
|
+
for (let filterDict of exceptionBreakpointFilters !== null && exceptionBreakpointFilters !== void 0 ? exceptionBreakpointFilters : []) {
|
|
508
|
+
filters.push(filterDict.filter);
|
|
509
|
+
exceptionOptions.push({
|
|
510
|
+
path: [{ names: this.session.exceptionPaths }],
|
|
511
|
+
breakMode: breakMode
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
const options = {
|
|
515
|
+
filters: filters,
|
|
516
|
+
exceptionOptions: exceptionOptions
|
|
517
|
+
};
|
|
518
|
+
await this.session.sendRequest('setExceptionBreakpoints', options);
|
|
519
|
+
}
|
|
415
520
|
/**
|
|
416
521
|
* Get the debugger state
|
|
417
522
|
*
|
|
@@ -428,8 +533,8 @@ export class DebuggerService {
|
|
|
428
533
|
path: (_g = (_f = (_e = this._session) === null || _e === void 0 ? void 0 : _e.connection) === null || _f === void 0 ? void 0 : _f.path) !== null && _g !== void 0 ? _g : '',
|
|
429
534
|
source: id
|
|
430
535
|
});
|
|
431
|
-
const
|
|
432
|
-
cells = cells.concat(
|
|
536
|
+
const tmp_cells = editorList.map(e => e.model.value.text);
|
|
537
|
+
cells = cells.concat(tmp_cells);
|
|
433
538
|
}
|
|
434
539
|
return { cells, breakpoints };
|
|
435
540
|
}
|
|
@@ -629,6 +734,18 @@ export class DebuggerService {
|
|
|
629
734
|
const variableScopes = this._convertScopes(scopes, variables);
|
|
630
735
|
this._model.variables.scopes = variableScopes;
|
|
631
736
|
}
|
|
737
|
+
async displayModules() {
|
|
738
|
+
if (!this.session) {
|
|
739
|
+
throw new Error('No active debugger session');
|
|
740
|
+
}
|
|
741
|
+
const modules = await this.session.sendRequest('modules', {});
|
|
742
|
+
this._model.kernelSources.kernelSources = modules.body.modules.map(module => {
|
|
743
|
+
return {
|
|
744
|
+
name: module.name,
|
|
745
|
+
path: module.path
|
|
746
|
+
};
|
|
747
|
+
});
|
|
748
|
+
}
|
|
632
749
|
/**
|
|
633
750
|
* Handle a variable expanded event and request variables from the kernel.
|
|
634
751
|
*
|
|
@@ -677,7 +794,6 @@ export class DebuggerService {
|
|
|
677
794
|
*/
|
|
678
795
|
async _restoreBreakpoints(breakpoints) {
|
|
679
796
|
for (const [source, points] of breakpoints) {
|
|
680
|
-
console.log(source);
|
|
681
797
|
await this._setBreakpoints(points
|
|
682
798
|
.filter(({ line }) => typeof line === 'number')
|
|
683
799
|
.map(({ line }) => ({ line: line })), source);
|