@codingame/monaco-vscode-notebook-service-override 25.1.2 → 26.0.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/index.js +2 -2
- package/package.json +3 -3
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +112 -94
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +95 -96
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticEditorContrib.js +28 -19
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticsActions.js +15 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib.js +22 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +25 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +37 -44
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +211 -115
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +16 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +5 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +57 -49
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +24 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +78 -76
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +14 -15
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +43 -28
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +65 -34
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +19 -16
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +6 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +15 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +28 -16
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookMulticursor.js +211 -170
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookSelectionHighlight.js +11 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +158 -156
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookInlineVariables.js +109 -105
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +28 -22
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +26 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +23 -16
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +72 -40
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +233 -186
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +22 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +239 -151
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +85 -86
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +25 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +13 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +8 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.js +218 -196
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +258 -255
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +106 -98
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/notebookIndentationActions.js +63 -49
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +55 -64
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/variablesActions.js +21 -25
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +149 -129
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.d.ts +57 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.js +286 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.js +82 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +452 -363
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityHelp.js +44 -61
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibleView.js +9 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +203 -207
- package/vscode/src/vs/workbench/contrib/notebook/browser/outputEditor/notebookOutputEditor.js +148 -104
- package/vscode/src/vs/workbench/contrib/notebook/browser/outputEditor/notebookOutputEditorInput.js +19 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/replEditorAccessibleView.js +9 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookCellStatusBarServiceImpl.js +9 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +34 -22
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +29 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +70 -52
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +31 -19
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +78 -41
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +37 -27
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +9 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +8 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +214 -119
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +38 -36
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSource.js +24 -25
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSourceFactory.js +2 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.js +26 -15
- package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +35 -15
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +468 -258
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.d.ts +33 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +113 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +74 -58
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +7 -10
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookCellMatching.js +72 -16
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookWebWorker.js +70 -51
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/repl.contribution.js +195 -149
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorAccessibilityHelp.js +60 -81
- package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +7 -12
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +104 -66
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +115 -77
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +42 -26
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.js +19 -12
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.d.ts +0 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +0 -198
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.d.ts +0 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.js +0 -333
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.js +0 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +0 -261
|
@@ -32,10 +32,23 @@ class InlineSegment {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
let NotebookInlineVariablesController = class NotebookInlineVariablesController extends Disposable {
|
|
35
|
-
static {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
static {
|
|
36
|
+
NotebookInlineVariablesController_1 = this;
|
|
37
|
+
}
|
|
38
|
+
static {
|
|
39
|
+
this.id = "notebook.inlineVariablesController";
|
|
40
|
+
}
|
|
41
|
+
static {
|
|
42
|
+
this.MAX_CELL_LINES = 5000;
|
|
43
|
+
}
|
|
44
|
+
constructor(
|
|
45
|
+
notebookEditor,
|
|
46
|
+
notebookKernelService,
|
|
47
|
+
notebookExecutionStateService,
|
|
48
|
+
languageFeaturesService,
|
|
49
|
+
configurationService,
|
|
50
|
+
debugService
|
|
51
|
+
) {
|
|
39
52
|
super();
|
|
40
53
|
this.notebookEditor = notebookEditor;
|
|
41
54
|
this.notebookKernelService = notebookKernelService;
|
|
@@ -46,22 +59,24 @@ let NotebookInlineVariablesController = class NotebookInlineVariablesController
|
|
|
46
59
|
this.cellDecorationIds = ( new Map());
|
|
47
60
|
this.cellContentListeners = ( new ResourceMap());
|
|
48
61
|
this.currentCancellationTokenSources = ( new ResourceMap());
|
|
49
|
-
this._register(this.notebookExecutionStateService.onDidChangeExecution(async
|
|
62
|
+
this._register(this.notebookExecutionStateService.onDidChangeExecution(async e => {
|
|
50
63
|
const inlineValuesSetting = this.configurationService.getValue(NotebookSetting.notebookInlineValues);
|
|
51
|
-
if (inlineValuesSetting ===
|
|
64
|
+
if (inlineValuesSetting === "off") {
|
|
52
65
|
return;
|
|
53
66
|
}
|
|
54
67
|
if (e.type === NotebookExecutionType.cell) {
|
|
55
68
|
await this.updateInlineVariables(e);
|
|
56
69
|
}
|
|
57
70
|
}));
|
|
58
|
-
this._register(
|
|
59
|
-
|
|
60
|
-
if (
|
|
61
|
-
this.
|
|
71
|
+
this._register(
|
|
72
|
+
Event.runAndSubscribe(this.configurationService.onDidChangeConfiguration, e => {
|
|
73
|
+
if (!e || e.affectsConfiguration(NotebookSetting.notebookInlineValues)) {
|
|
74
|
+
if (this.configurationService.getValue(NotebookSetting.notebookInlineValues) === "off") {
|
|
75
|
+
this.clearNotebookInlineDecorations();
|
|
76
|
+
}
|
|
62
77
|
}
|
|
63
|
-
}
|
|
64
|
-
|
|
78
|
+
})
|
|
79
|
+
);
|
|
65
80
|
}
|
|
66
81
|
async updateInlineVariables(event) {
|
|
67
82
|
if (event.changed) {
|
|
@@ -90,7 +105,7 @@ let NotebookInlineVariablesController = class NotebookInlineVariablesController
|
|
|
90
105
|
}
|
|
91
106
|
const inlineValuesSetting = this.configurationService.getValue(NotebookSetting.notebookInlineValues);
|
|
92
107
|
const hasInlineValueProvider = ( this.languageFeaturesService.inlineValuesProvider.has(model));
|
|
93
|
-
if (inlineValuesSetting ===
|
|
108
|
+
if (inlineValuesSetting === "off" || (inlineValuesSetting === "auto" && !hasInlineValueProvider)) {
|
|
94
109
|
return;
|
|
95
110
|
}
|
|
96
111
|
this.clearCellInlineDecorations(cell);
|
|
@@ -105,89 +120,91 @@ let NotebookInlineVariablesController = class NotebookInlineVariablesController
|
|
|
105
120
|
const providers = this.languageFeaturesService.inlineValuesProvider.ordered(model).reverse();
|
|
106
121
|
const lineDecorations = ( new Map());
|
|
107
122
|
const fullCellRange = ( new Range(1, 1, lastLine, lastColumn));
|
|
108
|
-
const promises = providers.flatMap(
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
const kernel = this.notebookKernelService.getMatchingKernel(notebook);
|
|
117
|
-
const kernelVars = [];
|
|
118
|
-
if (( result.some(iv => iv.type === 'variable'))) {
|
|
119
|
-
if (!this.notebookEditor.hasModel()) {
|
|
123
|
+
const promises = providers.flatMap(
|
|
124
|
+
provider => Promise.resolve(provider.provideInlineValues(model, fullCellRange, ctx, token)).then(async result => {
|
|
125
|
+
if (!result) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const notebook = this.notebookEditor.textModel;
|
|
129
|
+
if (!notebook) {
|
|
120
130
|
return;
|
|
121
131
|
}
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
132
|
+
const kernel = this.notebookKernelService.getMatchingKernel(notebook);
|
|
133
|
+
const kernelVars = [];
|
|
134
|
+
if (( result.some(iv => iv.type === "variable"))) {
|
|
135
|
+
if (!this.notebookEditor.hasModel()) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const variables = kernel.selected?.provideVariables(event.notebook, undefined, "named", 0, token);
|
|
139
|
+
if (variables) {
|
|
140
|
+
for await (const v of variables) {
|
|
141
|
+
kernelVars.push(v);
|
|
142
|
+
}
|
|
126
143
|
}
|
|
127
144
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
case 'text':
|
|
145
|
+
for (const iv of result) {
|
|
146
|
+
let text = undefined;
|
|
147
|
+
switch (iv.type) {
|
|
148
|
+
case "text":
|
|
133
149
|
text = iv.text;
|
|
134
150
|
break;
|
|
135
|
-
case
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
151
|
+
case "variable":
|
|
152
|
+
{
|
|
153
|
+
const name = iv.variableName;
|
|
154
|
+
if (!name) {
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
const value = kernelVars.find(v => v.name === name)?.value;
|
|
158
|
+
if (!value) {
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
text = format("{0} = {1}", name, value);
|
|
162
|
+
break;
|
|
139
163
|
}
|
|
140
|
-
|
|
141
|
-
|
|
164
|
+
case "expression":
|
|
165
|
+
{
|
|
142
166
|
continue;
|
|
143
167
|
}
|
|
144
|
-
text = format('{0} = {1}', name, value);
|
|
145
|
-
break;
|
|
146
|
-
}
|
|
147
|
-
case 'expression': {
|
|
148
|
-
continue;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
if (text) {
|
|
152
|
-
const line = iv.range.startLineNumber;
|
|
153
|
-
let lineSegments = lineDecorations.get(line);
|
|
154
|
-
if (!lineSegments) {
|
|
155
|
-
lineSegments = [];
|
|
156
|
-
lineDecorations.set(line, lineSegments);
|
|
157
168
|
}
|
|
158
|
-
if (
|
|
159
|
-
|
|
169
|
+
if (text) {
|
|
170
|
+
const line = iv.range.startLineNumber;
|
|
171
|
+
let lineSegments = lineDecorations.get(line);
|
|
172
|
+
if (!lineSegments) {
|
|
173
|
+
lineSegments = [];
|
|
174
|
+
lineDecorations.set(line, lineSegments);
|
|
175
|
+
}
|
|
176
|
+
if (!( lineSegments.some(iv => iv.text === text))) {
|
|
177
|
+
lineSegments.push(( new InlineSegment(iv.range.startColumn, text)));
|
|
178
|
+
}
|
|
160
179
|
}
|
|
161
180
|
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
181
|
+
}, err => {
|
|
182
|
+
onUnexpectedExternalError(err);
|
|
183
|
+
})
|
|
184
|
+
);
|
|
166
185
|
await Promise.all(promises);
|
|
167
186
|
lineDecorations.forEach((segments, line) => {
|
|
168
187
|
if (segments.length > 0) {
|
|
169
188
|
segments.sort((a, b) => a.column - b.column);
|
|
170
|
-
const text = ( segments.map(s => s.text)).join(
|
|
189
|
+
const text = ( segments.map(s => s.text)).join(", ");
|
|
171
190
|
const editorWidth = cell.layoutInfo.editorWidth;
|
|
172
191
|
const fontInfo = cell.layoutInfo.fontInfo;
|
|
173
192
|
if (fontInfo && cell.textModel) {
|
|
174
193
|
const base = Math.floor((editorWidth - 50) / fontInfo.typicalHalfwidthCharacterWidth);
|
|
175
194
|
const lineLength = cell.textModel.getLineLength(line);
|
|
176
195
|
const available = Math.max(0, base - lineLength);
|
|
177
|
-
inlineDecorations.push(...createInlineValueDecoration(line, text,
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
inlineDecorations.push(...createInlineValueDecoration(line, text, 'nb'));
|
|
196
|
+
inlineDecorations.push(...createInlineValueDecoration(line, text, "nb", undefined, available));
|
|
197
|
+
} else {
|
|
198
|
+
inlineDecorations.push(...createInlineValueDecoration(line, text, "nb"));
|
|
181
199
|
}
|
|
182
200
|
}
|
|
183
201
|
});
|
|
184
|
-
}
|
|
185
|
-
else if (inlineValuesSetting === 'on') {
|
|
202
|
+
} else if (inlineValuesSetting === "on") {
|
|
186
203
|
if (!this.notebookEditor.hasModel()) {
|
|
187
204
|
return;
|
|
188
205
|
}
|
|
189
206
|
const kernel = this.notebookKernelService.getMatchingKernel(this.notebookEditor.textModel);
|
|
190
|
-
const variables = kernel?.selected?.provideVariables(event.notebook, undefined,
|
|
207
|
+
const variables = kernel?.selected?.provideVariables(event.notebook, undefined, "named", 0, token);
|
|
191
208
|
if (!variables) {
|
|
192
209
|
return;
|
|
193
210
|
}
|
|
@@ -212,10 +229,10 @@ let NotebookInlineVariablesController = class NotebookInlineVariablesController
|
|
|
212
229
|
if (( processedVars.has(varName))) {
|
|
213
230
|
continue;
|
|
214
231
|
}
|
|
215
|
-
const regex = ( new RegExp(`\\b${varName}\\b(?!\\w)`,
|
|
232
|
+
const regex = ( new RegExp(`\\b${varName}\\b(?!\\w)`, "g"));
|
|
216
233
|
let lastMatchOutsideIgnored = null;
|
|
217
234
|
let foundMatch = false;
|
|
218
|
-
const lines = document.getValue().split(
|
|
235
|
+
const lines = document.getValue().split("\n");
|
|
219
236
|
for (let lineNumber = lines.length - 1; lineNumber >= 0; lineNumber--) {
|
|
220
237
|
const line = lines[lineNumber];
|
|
221
238
|
let match;
|
|
@@ -236,7 +253,7 @@ let NotebookInlineVariablesController = class NotebookInlineVariablesController
|
|
|
236
253
|
}
|
|
237
254
|
}
|
|
238
255
|
if (lastMatchOutsideIgnored) {
|
|
239
|
-
const inlineVal = varName +
|
|
256
|
+
const inlineVal = varName + " = " + vars.find(v => v.name === varName)?.value;
|
|
240
257
|
let lineSegments = lineDecorations.get(lastMatchOutsideIgnored.line);
|
|
241
258
|
if (!lineSegments) {
|
|
242
259
|
lineSegments = [];
|
|
@@ -251,17 +268,16 @@ let NotebookInlineVariablesController = class NotebookInlineVariablesController
|
|
|
251
268
|
lineDecorations.forEach((segments, line) => {
|
|
252
269
|
if (segments.length > 0) {
|
|
253
270
|
segments.sort((a, b) => a.column - b.column);
|
|
254
|
-
const text = ( segments.map(s => s.text)).join(
|
|
271
|
+
const text = ( segments.map(s => s.text)).join(", ");
|
|
255
272
|
const editorWidth = cell.layoutInfo.editorWidth;
|
|
256
273
|
const fontInfo = cell.layoutInfo.fontInfo;
|
|
257
274
|
if (fontInfo && cell.textModel) {
|
|
258
275
|
const base = Math.floor((editorWidth - 50) / fontInfo.typicalHalfwidthCharacterWidth);
|
|
259
276
|
const lineLength = cell.textModel.getLineLength(line);
|
|
260
277
|
const available = Math.max(0, base - lineLength);
|
|
261
|
-
inlineDecorations.push(...createInlineValueDecoration(line, text,
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
inlineDecorations.push(...createInlineValueDecoration(line, text, 'nb'));
|
|
278
|
+
inlineDecorations.push(...createInlineValueDecoration(line, text, "nb", undefined, available));
|
|
279
|
+
} else {
|
|
280
|
+
inlineDecorations.push(...createInlineValueDecoration(line, text, "nb"));
|
|
265
281
|
}
|
|
266
282
|
}
|
|
267
283
|
});
|
|
@@ -272,13 +288,11 @@ let NotebookInlineVariablesController = class NotebookInlineVariablesController
|
|
|
272
288
|
}
|
|
273
289
|
}
|
|
274
290
|
getFunctionRanges(document) {
|
|
275
|
-
return document.getLanguageId() ===
|
|
276
|
-
? this.getPythonFunctionRanges(document.getValue())
|
|
277
|
-
: this.getBracedFunctionRanges(document.getValue());
|
|
291
|
+
return document.getLanguageId() === "python" ? this.getPythonFunctionRanges(document.getValue()) : this.getBracedFunctionRanges(document.getValue());
|
|
278
292
|
}
|
|
279
293
|
getPythonFunctionRanges(code) {
|
|
280
294
|
const functionRanges = [];
|
|
281
|
-
const lines = code.split(
|
|
295
|
+
const lines = code.split("\n");
|
|
282
296
|
let functionStartLine = -1;
|
|
283
297
|
let inFunction = false;
|
|
284
298
|
let pythonIndentLevel = -1;
|
|
@@ -302,7 +316,7 @@ let NotebookInlineVariablesController = class NotebookInlineVariablesController
|
|
|
302
316
|
continue;
|
|
303
317
|
}
|
|
304
318
|
if (inFunction) {
|
|
305
|
-
if (line.trim() ===
|
|
319
|
+
if (line.trim() === "") {
|
|
306
320
|
continue;
|
|
307
321
|
}
|
|
308
322
|
const currentIndent = line.match(/^\s*/)?.[0].length ?? 0;
|
|
@@ -320,7 +334,7 @@ let NotebookInlineVariablesController = class NotebookInlineVariablesController
|
|
|
320
334
|
}
|
|
321
335
|
getBracedFunctionRanges(code) {
|
|
322
336
|
const functionRanges = [];
|
|
323
|
-
const lines = code.split(
|
|
337
|
+
const lines = code.split("\n");
|
|
324
338
|
let braceDepth = 0;
|
|
325
339
|
let functionStartLine = -1;
|
|
326
340
|
let inFunction = false;
|
|
@@ -328,14 +342,13 @@ let NotebookInlineVariablesController = class NotebookInlineVariablesController
|
|
|
328
342
|
for (let lineNumber = 0; lineNumber < lines.length; lineNumber++) {
|
|
329
343
|
const line = lines[lineNumber];
|
|
330
344
|
for (const char of line) {
|
|
331
|
-
if (char ===
|
|
345
|
+
if (char === "{") {
|
|
332
346
|
if (!inFunction && functionDeclRegex.test(line)) {
|
|
333
347
|
inFunction = true;
|
|
334
348
|
functionStartLine = lineNumber;
|
|
335
349
|
}
|
|
336
350
|
braceDepth++;
|
|
337
|
-
}
|
|
338
|
-
else if (char === '}') {
|
|
351
|
+
} else if (char === "}") {
|
|
339
352
|
braceDepth--;
|
|
340
353
|
if (braceDepth === 0 && inFunction) {
|
|
341
354
|
functionRanges.push(( new Range(functionStartLine + 1, 1, lineNumber + 1, line.length + 1)));
|
|
@@ -352,8 +365,7 @@ let NotebookInlineVariablesController = class NotebookInlineVariablesController
|
|
|
352
365
|
_getCommentedRanges(document) {
|
|
353
366
|
try {
|
|
354
367
|
return this.getCommentedRangesByAccurateTokenization(document);
|
|
355
|
-
}
|
|
356
|
-
catch (e) {
|
|
368
|
+
} catch (e) {
|
|
357
369
|
return this.getCommentedRangesByManualParsing(document);
|
|
358
370
|
}
|
|
359
371
|
}
|
|
@@ -380,14 +392,12 @@ let NotebookInlineVariablesController = class NotebookInlineVariablesController
|
|
|
380
392
|
}
|
|
381
393
|
const endCharacter = lineTokens.getEndOffset(tokenIndex);
|
|
382
394
|
const isLastToken = tokenIndex === lineTokens.getCount() - 1;
|
|
383
|
-
const nextTokenDifferent = !isLastToken &&
|
|
384
|
-
lineTokens.getStandardTokenType(tokenIndex + 1) !== tokenType;
|
|
395
|
+
const nextTokenDifferent = !isLastToken && lineTokens.getStandardTokenType(tokenIndex + 1) !== tokenType;
|
|
385
396
|
if (isLastToken || nextTokenDifferent) {
|
|
386
397
|
commentRanges.push(( new Range(lineNumber, startCharacter + 1, lineNumber, endCharacter + 1)));
|
|
387
398
|
startCharacter = undefined;
|
|
388
399
|
}
|
|
389
|
-
}
|
|
390
|
-
else {
|
|
400
|
+
} else {
|
|
391
401
|
startCharacter = undefined;
|
|
392
402
|
}
|
|
393
403
|
}
|
|
@@ -396,13 +406,13 @@ let NotebookInlineVariablesController = class NotebookInlineVariablesController
|
|
|
396
406
|
}
|
|
397
407
|
getCommentedRangesByManualParsing(document) {
|
|
398
408
|
const commentRanges = [];
|
|
399
|
-
const lines = document.getValue().split(
|
|
409
|
+
const lines = document.getValue().split("\n");
|
|
400
410
|
const languageId = document.getLanguageId();
|
|
401
|
-
const lineCommentToken = languageId ===
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
411
|
+
const lineCommentToken = languageId === "python" ? "#" : languageId === "javascript" || languageId === "typescript" ? "//" : null;
|
|
412
|
+
const blockComments = (languageId === "javascript" || languageId === "typescript") ? {
|
|
413
|
+
start: "/*",
|
|
414
|
+
end: "*/"
|
|
415
|
+
} : null;
|
|
406
416
|
let inBlockComment = false;
|
|
407
417
|
let blockCommentStartLine = -1;
|
|
408
418
|
let blockCommentStartCol = -1;
|
|
@@ -495,19 +505,13 @@ let NotebookInlineVariablesController = class NotebookInlineVariablesController
|
|
|
495
505
|
this.cellContentListeners.clear();
|
|
496
506
|
}
|
|
497
507
|
};
|
|
498
|
-
NotebookInlineVariablesController = NotebookInlineVariablesController_1 = ( __decorate([
|
|
499
|
-
( __param(1, INotebookKernelService)),
|
|
500
|
-
( __param(2, INotebookExecutionStateService)),
|
|
501
|
-
( __param(3, ILanguageFeaturesService)),
|
|
502
|
-
( __param(4, IConfigurationService)),
|
|
503
|
-
( __param(5, IDebugService))
|
|
504
|
-
], NotebookInlineVariablesController));
|
|
508
|
+
NotebookInlineVariablesController = NotebookInlineVariablesController_1 = ( __decorate([( __param(1, INotebookKernelService)), ( __param(2, INotebookExecutionStateService)), ( __param(3, ILanguageFeaturesService)), ( __param(4, IConfigurationService)), ( __param(5, IDebugService))], NotebookInlineVariablesController));
|
|
505
509
|
registerNotebookContribution(NotebookInlineVariablesController.id, NotebookInlineVariablesController);
|
|
506
510
|
registerAction2(class ClearNotebookInlineValues extends NotebookAction {
|
|
507
511
|
constructor() {
|
|
508
512
|
super({
|
|
509
|
-
id:
|
|
510
|
-
title: ( localize(
|
|
513
|
+
id: "notebook.clearAllInlineValues",
|
|
514
|
+
title: ( localize(9637, "Clear All Inline Values"))
|
|
511
515
|
});
|
|
512
516
|
}
|
|
513
517
|
runWithContext(accessor, context) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { RawContextKey } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey';
|
|
3
3
|
|
|
4
|
-
const NOTEBOOK_VARIABLE_VIEW_ENABLED = ( new RawContextKey(
|
|
4
|
+
const NOTEBOOK_VARIABLE_VIEW_ENABLED = ( new RawContextKey("notebookVariableViewEnabled", false));
|
|
5
5
|
|
|
6
6
|
export { NOTEBOOK_VARIABLE_VIEW_ENABLED };
|
|
@@ -20,7 +20,15 @@ import { INotebookService } from '@codingame/monaco-vscode-api/vscode/vs/workben
|
|
|
20
20
|
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
21
21
|
|
|
22
22
|
let NotebookVariables = class NotebookVariables extends Disposable {
|
|
23
|
-
constructor(
|
|
23
|
+
constructor(
|
|
24
|
+
contextKeyService,
|
|
25
|
+
configurationService,
|
|
26
|
+
editorService,
|
|
27
|
+
notebookExecutionStateService,
|
|
28
|
+
notebookKernelService,
|
|
29
|
+
notebookDocumentService,
|
|
30
|
+
viewDescriptorService
|
|
31
|
+
) {
|
|
24
32
|
super();
|
|
25
33
|
this.configurationService = configurationService;
|
|
26
34
|
this.editorService = editorService;
|
|
@@ -32,8 +40,10 @@ let NotebookVariables = class NotebookVariables extends Disposable {
|
|
|
32
40
|
this.initialized = false;
|
|
33
41
|
this.viewEnabled = NOTEBOOK_VARIABLE_VIEW_ENABLED.bindTo(contextKeyService);
|
|
34
42
|
this.listeners.push(this.editorService.onDidActiveEditorChange(() => this.handleInitEvent()));
|
|
35
|
-
this.listeners.push(
|
|
36
|
-
|
|
43
|
+
this.listeners.push(
|
|
44
|
+
this.notebookExecutionStateService.onDidChangeExecution(e => this.handleInitEvent(e.notebook))
|
|
45
|
+
);
|
|
46
|
+
this.configListener = configurationService.onDidChangeConfiguration(e => this.handleConfigChange(e));
|
|
37
47
|
}
|
|
38
48
|
handleConfigChange(e) {
|
|
39
49
|
if (e.affectsConfiguration(NotebookSetting.notebookVariablesView)) {
|
|
@@ -41,10 +51,9 @@ let NotebookVariables = class NotebookVariables extends Disposable {
|
|
|
41
51
|
}
|
|
42
52
|
}
|
|
43
53
|
handleInitEvent(notebook) {
|
|
44
|
-
const enabled = this.editorService.activeEditorPane?.getId() ===
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (enabled && (!!notebook || this.editorService.activeEditorPane?.getId() === 'workbench.editor.notebook')) {
|
|
54
|
+
const enabled = this.editorService.activeEditorPane?.getId() === "workbench.editor.repl" || this.configurationService.getValue(NotebookSetting.notebookVariablesView) ||
|
|
55
|
+
this.configurationService.getValue("notebook.experimental.variablesView");
|
|
56
|
+
if (enabled && (!!notebook || this.editorService.activeEditorPane?.getId() === "workbench.editor.notebook")) {
|
|
48
57
|
if (this.hasVariableProvider(notebook) && !this.initialized && this.initializeView()) {
|
|
49
58
|
this.viewEnabled.set(true);
|
|
50
59
|
this.initialized = true;
|
|
@@ -53,9 +62,7 @@ let NotebookVariables = class NotebookVariables extends Disposable {
|
|
|
53
62
|
}
|
|
54
63
|
}
|
|
55
64
|
hasVariableProvider(notebookUri) {
|
|
56
|
-
const notebook = notebookUri ?
|
|
57
|
-
this.notebookDocumentService.getNotebookTextModel(notebookUri) :
|
|
58
|
-
getNotebookEditorFromEditorPane(this.editorService.activeEditorPane)?.getViewModel()?.notebookDocument;
|
|
65
|
+
const notebook = notebookUri ? this.notebookDocumentService.getNotebookTextModel(notebookUri) : getNotebookEditorFromEditorPane(this.editorService.activeEditorPane)?.getViewModel()?.notebookDocument;
|
|
59
66
|
return notebook && this.notebookKernelService.getMatchingKernel(notebook).selected?.hasVariableProvider;
|
|
60
67
|
}
|
|
61
68
|
initializeView() {
|
|
@@ -63,9 +70,16 @@ let NotebookVariables = class NotebookVariables extends Disposable {
|
|
|
63
70
|
if (debugViewContainer) {
|
|
64
71
|
const viewsRegistry = ( Registry.as(Extensions.ViewsRegistry));
|
|
65
72
|
const viewDescriptor = {
|
|
66
|
-
id:
|
|
67
|
-
|
|
68
|
-
|
|
73
|
+
id: "workbench.notebook.variables",
|
|
74
|
+
name: ( localize2(9640, "Notebook Variables")),
|
|
75
|
+
containerIcon: variablesViewIcon,
|
|
76
|
+
ctorDescriptor: ( new SyncDescriptor(NotebookVariablesView)),
|
|
77
|
+
order: 50,
|
|
78
|
+
weight: 5,
|
|
79
|
+
canToggleVisibility: true,
|
|
80
|
+
canMoveView: true,
|
|
81
|
+
collapsed: false,
|
|
82
|
+
when: NOTEBOOK_VARIABLE_VIEW_ENABLED
|
|
69
83
|
};
|
|
70
84
|
viewsRegistry.registerViews([viewDescriptor], debugViewContainer);
|
|
71
85
|
return true;
|
|
@@ -78,14 +92,6 @@ let NotebookVariables = class NotebookVariables extends Disposable {
|
|
|
78
92
|
this.configListener.dispose();
|
|
79
93
|
}
|
|
80
94
|
};
|
|
81
|
-
NotebookVariables = ( __decorate([
|
|
82
|
-
( __param(0, IContextKeyService)),
|
|
83
|
-
( __param(1, IConfigurationService)),
|
|
84
|
-
( __param(2, IEditorService)),
|
|
85
|
-
( __param(3, INotebookExecutionStateService)),
|
|
86
|
-
( __param(4, INotebookKernelService)),
|
|
87
|
-
( __param(5, INotebookService)),
|
|
88
|
-
( __param(6, IViewDescriptorService))
|
|
89
|
-
], NotebookVariables));
|
|
95
|
+
NotebookVariables = ( __decorate([( __param(0, IContextKeyService)), ( __param(1, IConfigurationService)), ( __param(2, IEditorService)), ( __param(3, INotebookExecutionStateService)), ( __param(4, INotebookKernelService)), ( __param(5, INotebookService)), ( __param(6, IViewDescriptorService))], NotebookVariables));
|
|
90
96
|
|
|
91
97
|
export { NotebookVariables };
|
|
@@ -9,7 +9,7 @@ class NotebookVariableDataSource {
|
|
|
9
9
|
this.cancellationTokenSource = ( new CancellationTokenSource());
|
|
10
10
|
}
|
|
11
11
|
hasChildren(element) {
|
|
12
|
-
return element.kind ===
|
|
12
|
+
return element.kind === "root" || element.hasNamedChildren || element.indexedChildrenCount > 0;
|
|
13
13
|
}
|
|
14
14
|
cancel() {
|
|
15
15
|
this.cancellationTokenSource.cancel();
|
|
@@ -17,13 +17,11 @@ class NotebookVariableDataSource {
|
|
|
17
17
|
this.cancellationTokenSource = ( new CancellationTokenSource());
|
|
18
18
|
}
|
|
19
19
|
async getChildren(element) {
|
|
20
|
-
if (element.kind ===
|
|
20
|
+
if (element.kind === "empty") {
|
|
21
21
|
return [];
|
|
22
|
-
}
|
|
23
|
-
else if (element.kind === 'root') {
|
|
22
|
+
} else if (element.kind === "root") {
|
|
24
23
|
return this.getRootVariables(element.notebook);
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
24
|
+
} else {
|
|
27
25
|
return this.getVariables(element);
|
|
28
26
|
}
|
|
29
27
|
}
|
|
@@ -32,7 +30,13 @@ class NotebookVariableDataSource {
|
|
|
32
30
|
if (selectedKernel && selectedKernel.hasVariableProvider) {
|
|
33
31
|
let children = [];
|
|
34
32
|
if (parent.hasNamedChildren) {
|
|
35
|
-
const variables = selectedKernel.provideVariables(
|
|
33
|
+
const variables = selectedKernel.provideVariables(
|
|
34
|
+
parent.notebook.uri,
|
|
35
|
+
parent.extHostId,
|
|
36
|
+
"named",
|
|
37
|
+
0,
|
|
38
|
+
this.cancellationTokenSource.token
|
|
39
|
+
);
|
|
36
40
|
for await (const variable of variables) {
|
|
37
41
|
children.push(this.createVariableElement(variable, parent.notebook));
|
|
38
42
|
}
|
|
@@ -58,12 +62,12 @@ class NotebookVariableDataSource {
|
|
|
58
62
|
end = last;
|
|
59
63
|
}
|
|
60
64
|
childNodes.push({
|
|
61
|
-
kind:
|
|
65
|
+
kind: "variable",
|
|
62
66
|
notebook: parent.notebook,
|
|
63
67
|
id: parent.id + `${start}`,
|
|
64
68
|
extHostId: parent.extHostId,
|
|
65
69
|
name: `[${start}..${end - 1}]`,
|
|
66
|
-
value:
|
|
70
|
+
value: "",
|
|
67
71
|
indexedChildrenCount: end - start,
|
|
68
72
|
indexStart: start,
|
|
69
73
|
hasNamedChildren: false
|
|
@@ -71,19 +75,24 @@ class NotebookVariableDataSource {
|
|
|
71
75
|
}
|
|
72
76
|
if (parent.indexedChildrenCount > indexedChildCountLimit) {
|
|
73
77
|
childNodes.push({
|
|
74
|
-
kind:
|
|
78
|
+
kind: "variable",
|
|
75
79
|
notebook: parent.notebook,
|
|
76
80
|
id: parent.id + `${last + 1}`,
|
|
77
81
|
extHostId: parent.extHostId,
|
|
78
|
-
name: ( localize(
|
|
79
|
-
value:
|
|
82
|
+
name: ( localize(9641, "Display limit reached")),
|
|
83
|
+
value: "",
|
|
80
84
|
indexedChildrenCount: 0,
|
|
81
85
|
hasNamedChildren: false
|
|
82
86
|
});
|
|
83
87
|
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
88
|
+
} else if (parent.indexedChildrenCount > 0) {
|
|
89
|
+
const variables = kernel.provideVariables(
|
|
90
|
+
parent.notebook.uri,
|
|
91
|
+
parent.extHostId,
|
|
92
|
+
"indexed",
|
|
93
|
+
parent.indexStart ?? 0,
|
|
94
|
+
this.cancellationTokenSource.token
|
|
95
|
+
);
|
|
87
96
|
for await (const variable of variables) {
|
|
88
97
|
childNodes.push(this.createVariableElement(variable, parent.notebook));
|
|
89
98
|
if (childNodes.length >= variablePageSize) {
|
|
@@ -96,7 +105,7 @@ class NotebookVariableDataSource {
|
|
|
96
105
|
async getRootVariables(notebook) {
|
|
97
106
|
const selectedKernel = this.notebookKernelService.getMatchingKernel(notebook).selected;
|
|
98
107
|
if (selectedKernel && selectedKernel.hasVariableProvider) {
|
|
99
|
-
const variables = selectedKernel.provideVariables(notebook.uri, undefined,
|
|
108
|
+
const variables = selectedKernel.provideVariables(notebook.uri, undefined, "named", 0, this.cancellationTokenSource.token);
|
|
100
109
|
const varElements = [];
|
|
101
110
|
for await (const variable of variables) {
|
|
102
111
|
varElements.push(this.createVariableElement(variable, notebook));
|
|
@@ -108,7 +117,7 @@ class NotebookVariableDataSource {
|
|
|
108
117
|
createVariableElement(variable, notebook) {
|
|
109
118
|
return {
|
|
110
119
|
...variable,
|
|
111
|
-
kind:
|
|
120
|
+
kind: "variable",
|
|
112
121
|
notebook,
|
|
113
122
|
extHostId: variable.id,
|
|
114
123
|
id: `${variable.id}`
|