@codingame/monaco-vscode-notebook-service-override 8.0.4 → 9.0.2
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/package.json +3 -2
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +8 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +21 -21
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticsActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +6 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +26 -24
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookMulticursor.js +624 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +13 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +4 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +9 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +12 -12
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +24 -24
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.js +54 -55
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +22 -22
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +24 -24
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +23 -21
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/notebookIndentationActions.js +7 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +12 -12
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +297 -21
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +124 -73
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityHelp.js +27 -19
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +33 -33
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +62 -39
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +7 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +7 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +18 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +15 -40
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.js +0 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +28 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +55 -45
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorker.js +6 -6
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +12 -12
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +0 -47
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +0 -1303
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +0 -267
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +0 -569
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +0 -115
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +0 -39
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +0 -903
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +0 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +0 -397
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +0 -186
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +0 -107
|
@@ -27,7 +27,7 @@ const NotebookPreloadContribution = ( (Object.freeze({
|
|
|
27
27
|
localResourceRoots: 'localResourceRoots',
|
|
28
28
|
})));
|
|
29
29
|
const notebookProviderContribution = {
|
|
30
|
-
description: ( localize(
|
|
30
|
+
description: ( localize(7632, 'Contributes notebook document provider.')),
|
|
31
31
|
type: 'array',
|
|
32
32
|
defaultSnippets: [{ body: [{ type: '', displayName: '', 'selector': [{ 'filenamePattern': '' }] }] }],
|
|
33
33
|
items: {
|
|
@@ -40,25 +40,25 @@ const notebookProviderContribution = {
|
|
|
40
40
|
properties: {
|
|
41
41
|
[NotebookEditorContribution.type]: {
|
|
42
42
|
type: 'string',
|
|
43
|
-
description: ( localize(
|
|
43
|
+
description: ( localize(7633, 'Type of the notebook.')),
|
|
44
44
|
},
|
|
45
45
|
[NotebookEditorContribution.displayName]: {
|
|
46
46
|
type: 'string',
|
|
47
|
-
description: ( localize(
|
|
47
|
+
description: ( localize(7634, 'Human readable name of the notebook.')),
|
|
48
48
|
},
|
|
49
49
|
[NotebookEditorContribution.selector]: {
|
|
50
50
|
type: 'array',
|
|
51
|
-
description: ( localize(
|
|
51
|
+
description: ( localize(7635, 'Set of globs that the notebook is for.')),
|
|
52
52
|
items: {
|
|
53
53
|
type: 'object',
|
|
54
54
|
properties: {
|
|
55
55
|
filenamePattern: {
|
|
56
56
|
type: 'string',
|
|
57
|
-
description: ( localize(
|
|
57
|
+
description: ( localize(7636, 'Glob that the notebook is enabled for.')),
|
|
58
58
|
},
|
|
59
59
|
excludeFileNamePattern: {
|
|
60
60
|
type: 'string',
|
|
61
|
-
description: ( localize(
|
|
61
|
+
description: ( localize(7637, 'Glob that the notebook is disabled for.'))
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
}
|
|
@@ -66,7 +66,7 @@ const notebookProviderContribution = {
|
|
|
66
66
|
[NotebookEditorContribution.priority]: {
|
|
67
67
|
type: 'string',
|
|
68
68
|
markdownDeprecationMessage: ( localize(
|
|
69
|
-
|
|
69
|
+
7638,
|
|
70
70
|
'Controls if the custom editor is enabled automatically when the user opens a file. This may be overridden by users using the `workbench.editorAssociations` setting.'
|
|
71
71
|
)),
|
|
72
72
|
enum: [
|
|
@@ -75,11 +75,11 @@ const notebookProviderContribution = {
|
|
|
75
75
|
],
|
|
76
76
|
markdownEnumDescriptions: [
|
|
77
77
|
( localize(
|
|
78
|
-
|
|
78
|
+
7639,
|
|
79
79
|
'The editor is automatically used when the user opens a resource, provided that no other default custom editors are registered for that resource.'
|
|
80
80
|
)),
|
|
81
81
|
( localize(
|
|
82
|
-
|
|
82
|
+
7640,
|
|
83
83
|
'The editor is not automatically used when the user opens a resource, but a user can switch to the editor using the `Reopen With` command.'
|
|
84
84
|
)),
|
|
85
85
|
],
|
|
@@ -90,7 +90,7 @@ const notebookProviderContribution = {
|
|
|
90
90
|
};
|
|
91
91
|
const defaultRendererSnippet = ( (Object.freeze({ id: '', displayName: '', mimeTypes: [''], entrypoint: '' })));
|
|
92
92
|
const notebookRendererContribution = {
|
|
93
|
-
description: ( localize(
|
|
93
|
+
description: ( localize(7641, 'Contributes notebook output renderer provider.')),
|
|
94
94
|
type: 'array',
|
|
95
95
|
defaultSnippets: [{ body: [defaultRendererSnippet] }],
|
|
96
96
|
items: {
|
|
@@ -105,18 +105,18 @@ const notebookRendererContribution = {
|
|
|
105
105
|
properties: {
|
|
106
106
|
[NotebookRendererContribution.id]: {
|
|
107
107
|
type: 'string',
|
|
108
|
-
description: ( localize(
|
|
108
|
+
description: ( localize(7642, 'Unique identifier of the notebook output renderer.')),
|
|
109
109
|
},
|
|
110
110
|
[NotebookRendererContribution.displayName]: {
|
|
111
111
|
type: 'string',
|
|
112
|
-
description: ( localize(
|
|
112
|
+
description: ( localize(7643, 'Human readable name of the notebook output renderer.')),
|
|
113
113
|
},
|
|
114
114
|
[NotebookRendererContribution.hardDependencies]: {
|
|
115
115
|
type: 'array',
|
|
116
116
|
uniqueItems: true,
|
|
117
117
|
items: { type: 'string' },
|
|
118
118
|
markdownDescription: ( localize(
|
|
119
|
-
|
|
119
|
+
7644,
|
|
120
120
|
'List of kernel dependencies the renderer requires. If any of the dependencies are present in the `NotebookKernel.preloads`, the renderer can be used.'
|
|
121
121
|
)),
|
|
122
122
|
},
|
|
@@ -125,7 +125,7 @@ const notebookRendererContribution = {
|
|
|
125
125
|
uniqueItems: true,
|
|
126
126
|
items: { type: 'string' },
|
|
127
127
|
markdownDescription: ( localize(
|
|
128
|
-
|
|
128
|
+
7645,
|
|
129
129
|
'List of soft kernel dependencies the renderer can make use of. If any of the dependencies are present in the `NotebookKernel.preloads`, the renderer will be preferred over renderers that don\'t interact with the kernel.'
|
|
130
130
|
)),
|
|
131
131
|
},
|
|
@@ -138,17 +138,17 @@ const notebookRendererContribution = {
|
|
|
138
138
|
],
|
|
139
139
|
enumDescriptions: [
|
|
140
140
|
( localize(
|
|
141
|
-
|
|
141
|
+
7646,
|
|
142
142
|
'Messaging is required. The renderer will only be used when it\'s part of an extension that can be run in an extension host.'
|
|
143
143
|
)),
|
|
144
144
|
( localize(
|
|
145
|
-
|
|
145
|
+
7647,
|
|
146
146
|
'The renderer is better with messaging available, but it\'s not requried.'
|
|
147
147
|
)),
|
|
148
|
-
( localize(
|
|
148
|
+
( localize(7648, 'The renderer does not require messaging.')),
|
|
149
149
|
],
|
|
150
150
|
description: ( localize(
|
|
151
|
-
|
|
151
|
+
7649,
|
|
152
152
|
'Defines how and if the renderer needs to communicate with an extension host, via `createRendererMessaging`. Renderers with stronger messaging requirements may not work in all environments.'
|
|
153
153
|
)),
|
|
154
154
|
},
|
|
@@ -164,13 +164,13 @@ const notebookRendererContribution = {
|
|
|
164
164
|
properties: {
|
|
165
165
|
[NotebookRendererContribution.mimeTypes]: {
|
|
166
166
|
type: 'array',
|
|
167
|
-
description: ( localize(
|
|
167
|
+
description: ( localize(7650, 'Set of globs that the notebook is for.')),
|
|
168
168
|
items: {
|
|
169
169
|
type: 'string'
|
|
170
170
|
}
|
|
171
171
|
},
|
|
172
172
|
[NotebookRendererContribution.entrypoint]: {
|
|
173
|
-
description: ( localize(
|
|
173
|
+
description: ( localize(7651, 'File to load in the webview to render the extension.')),
|
|
174
174
|
type: 'string',
|
|
175
175
|
},
|
|
176
176
|
}
|
|
@@ -181,17 +181,17 @@ const notebookRendererContribution = {
|
|
|
181
181
|
],
|
|
182
182
|
properties: {
|
|
183
183
|
[NotebookRendererContribution.entrypoint]: {
|
|
184
|
-
description: ( localize(
|
|
184
|
+
description: ( localize(7651, 'File to load in the webview to render the extension.')),
|
|
185
185
|
type: 'object',
|
|
186
186
|
required: ['extends', 'path'],
|
|
187
187
|
properties: {
|
|
188
188
|
extends: {
|
|
189
189
|
type: 'string',
|
|
190
|
-
description: ( localize(
|
|
190
|
+
description: ( localize(7652, 'Existing renderer that this one extends.')),
|
|
191
191
|
},
|
|
192
192
|
path: {
|
|
193
193
|
type: 'string',
|
|
194
|
-
description: ( localize(
|
|
194
|
+
description: ( localize(7651, 'File to load in the webview to render the extension.')),
|
|
195
195
|
},
|
|
196
196
|
}
|
|
197
197
|
},
|
|
@@ -203,7 +203,7 @@ const notebookRendererContribution = {
|
|
|
203
203
|
}
|
|
204
204
|
};
|
|
205
205
|
const notebookPreloadContribution = {
|
|
206
|
-
description: ( localize(
|
|
206
|
+
description: ( localize(7653, 'Contributes notebook preloads.')),
|
|
207
207
|
type: 'array',
|
|
208
208
|
defaultSnippets: [{ body: [{ type: '', entrypoint: '' }] }],
|
|
209
209
|
items: {
|
|
@@ -215,17 +215,17 @@ const notebookPreloadContribution = {
|
|
|
215
215
|
properties: {
|
|
216
216
|
[NotebookPreloadContribution.type]: {
|
|
217
217
|
type: 'string',
|
|
218
|
-
description: ( localize(
|
|
218
|
+
description: ( localize(7654, 'Type of the notebook.')),
|
|
219
219
|
},
|
|
220
220
|
[NotebookPreloadContribution.entrypoint]: {
|
|
221
221
|
type: 'string',
|
|
222
|
-
description: ( localize(
|
|
222
|
+
description: ( localize(7655, 'Path to file loaded in the webview.')),
|
|
223
223
|
},
|
|
224
224
|
[NotebookPreloadContribution.localResourceRoots]: {
|
|
225
225
|
type: 'array',
|
|
226
226
|
items: { type: 'string' },
|
|
227
227
|
description: ( localize(
|
|
228
|
-
|
|
228
|
+
7656,
|
|
229
229
|
'Paths to additional resources that should be allowed in the webview.'
|
|
230
230
|
)),
|
|
231
231
|
},
|
|
@@ -272,8 +272,8 @@ class NotebooksDataRenderer extends Disposable {
|
|
|
272
272
|
return { data: { headers: [], rows: [] }, dispose: () => { } };
|
|
273
273
|
}
|
|
274
274
|
const headers = [
|
|
275
|
-
( localize(
|
|
276
|
-
( localize(
|
|
275
|
+
( localize(7657, "ID")),
|
|
276
|
+
( localize(7658, "Name")),
|
|
277
277
|
];
|
|
278
278
|
const rows = ( (contrib
|
|
279
279
|
.sort((a, b) => a.type.localeCompare(b.type))
|
|
@@ -306,8 +306,8 @@ class NotebookRenderersDataRenderer extends Disposable {
|
|
|
306
306
|
return { data: { headers: [], rows: [] }, dispose: () => { } };
|
|
307
307
|
}
|
|
308
308
|
const headers = [
|
|
309
|
-
( localize(
|
|
310
|
-
( localize(
|
|
309
|
+
( localize(7659, "Name")),
|
|
310
|
+
( localize(7660, "Mimetypes")),
|
|
311
311
|
];
|
|
312
312
|
const rows = ( (contrib
|
|
313
313
|
.sort((a, b) => a.displayName.localeCompare(b.displayName))
|
|
@@ -328,7 +328,7 @@ class NotebookRenderersDataRenderer extends Disposable {
|
|
|
328
328
|
}
|
|
329
329
|
( (Registry.as(Extensions.ExtensionFeaturesRegistry))).registerExtensionFeature({
|
|
330
330
|
id: 'notebooks',
|
|
331
|
-
label: ( localize(
|
|
331
|
+
label: ( localize(7661, "Notebooks")),
|
|
332
332
|
access: {
|
|
333
333
|
canToggle: false
|
|
334
334
|
},
|
|
@@ -336,7 +336,7 @@ class NotebookRenderersDataRenderer extends Disposable {
|
|
|
336
336
|
});
|
|
337
337
|
( (Registry.as(Extensions.ExtensionFeaturesRegistry))).registerExtensionFeature({
|
|
338
338
|
id: 'notebookRenderer',
|
|
339
|
-
label: ( localize(
|
|
339
|
+
label: ( localize(7662, "Notebook Renderers")),
|
|
340
340
|
access: {
|
|
341
341
|
canToggle: false
|
|
342
342
|
},
|
package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js
CHANGED
|
@@ -4,7 +4,7 @@ import { getDefaultNotebookCreationOptions, NotebookEditorWidget } from 'vscode/
|
|
|
4
4
|
import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
5
5
|
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
|
|
6
6
|
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
7
|
-
import { NotebookEditorInput, isCompositeNotebookEditorInput } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookEditorInput';
|
|
7
|
+
import { NotebookEditorInput, isCompositeNotebookEditorInput, isNotebookEditorInput } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookEditorInput';
|
|
8
8
|
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
9
9
|
import { GroupModelChangeKind } from 'vscode/vscode/vs/workbench/common/editor';
|
|
10
10
|
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
@@ -20,34 +20,35 @@ let NotebookEditorWidgetService = class NotebookEditorWidgetService {
|
|
|
20
20
|
this._tokenPool = 1;
|
|
21
21
|
this._disposables = ( new DisposableStore());
|
|
22
22
|
this._notebookEditors = ( new Map());
|
|
23
|
+
this.groupListener = ( new Map());
|
|
23
24
|
this._onNotebookEditorAdd = ( new Emitter());
|
|
24
25
|
this._onNotebookEditorsRemove = ( new Emitter());
|
|
25
26
|
this.onDidAddNotebookEditor = this._onNotebookEditorAdd.event;
|
|
26
27
|
this.onDidRemoveNotebookEditor = this._onNotebookEditorsRemove.event;
|
|
27
28
|
this._borrowableEditors = ( new Map());
|
|
28
|
-
const groupListener = ( new Map());
|
|
29
29
|
const onNewGroup = (group) => {
|
|
30
30
|
const { id } = group;
|
|
31
31
|
const listeners = [];
|
|
32
32
|
listeners.push(group.onDidCloseEditor(e => {
|
|
33
|
-
const
|
|
34
|
-
if (!
|
|
33
|
+
const widgetMap = this._borrowableEditors.get(group.id);
|
|
34
|
+
if (!widgetMap) {
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
37
|
const inputs = e.editor instanceof NotebookEditorInput ? [e.editor] : (isCompositeNotebookEditorInput(e.editor) ? e.editor.editorInputs : []);
|
|
38
38
|
inputs.forEach(input => {
|
|
39
|
-
const
|
|
40
|
-
|
|
39
|
+
const widgets = widgetMap.get(input.resource);
|
|
40
|
+
const index = widgets?.findIndex(widget => widget.editorType === input.typeId);
|
|
41
|
+
if (!widgets || index === undefined || index === -1) {
|
|
41
42
|
return;
|
|
42
43
|
}
|
|
44
|
+
const value = widgets.splice(index, 1)[0];
|
|
43
45
|
value.token = undefined;
|
|
44
46
|
this._disposeWidget(value.widget);
|
|
45
|
-
widgets.delete(input.resource);
|
|
46
47
|
value.widget = undefined;
|
|
47
48
|
});
|
|
48
49
|
}));
|
|
49
50
|
listeners.push(group.onWillMoveEditor(e => {
|
|
50
|
-
if (e.editor
|
|
51
|
+
if (isNotebookEditorInput(e.editor)) {
|
|
51
52
|
this._allowWidgetMove(e.editor, e.groupId, e.target);
|
|
52
53
|
}
|
|
53
54
|
if (isCompositeNotebookEditorInput(e.editor)) {
|
|
@@ -56,22 +57,24 @@ let NotebookEditorWidgetService = class NotebookEditorWidgetService {
|
|
|
56
57
|
});
|
|
57
58
|
}
|
|
58
59
|
}));
|
|
59
|
-
groupListener.set(id, listeners);
|
|
60
|
+
this.groupListener.set(id, listeners);
|
|
60
61
|
};
|
|
61
62
|
this._disposables.add(editorGroupService.onDidAddGroup(onNewGroup));
|
|
62
63
|
editorGroupService.whenReady.then(() => editorGroupService.groups.forEach(onNewGroup));
|
|
63
64
|
this._disposables.add(editorGroupService.onDidRemoveGroup(group => {
|
|
64
|
-
const listeners = groupListener.get(group.id);
|
|
65
|
+
const listeners = this.groupListener.get(group.id);
|
|
65
66
|
if (listeners) {
|
|
66
67
|
listeners.forEach(listener => listener.dispose());
|
|
67
|
-
groupListener.delete(group.id);
|
|
68
|
+
this.groupListener.delete(group.id);
|
|
68
69
|
}
|
|
69
70
|
const widgets = this._borrowableEditors.get(group.id);
|
|
70
71
|
this._borrowableEditors.delete(group.id);
|
|
71
72
|
if (widgets) {
|
|
72
|
-
for (const
|
|
73
|
-
value
|
|
74
|
-
|
|
73
|
+
for (const values of ( widgets.values())) {
|
|
74
|
+
for (const value of values) {
|
|
75
|
+
value.token = undefined;
|
|
76
|
+
this._disposeWidget(value.widget);
|
|
77
|
+
}
|
|
75
78
|
}
|
|
76
79
|
}
|
|
77
80
|
}));
|
|
@@ -93,6 +96,10 @@ let NotebookEditorWidgetService = class NotebookEditorWidgetService {
|
|
|
93
96
|
this._disposables.dispose();
|
|
94
97
|
this._onNotebookEditorAdd.dispose();
|
|
95
98
|
this._onNotebookEditorsRemove.dispose();
|
|
99
|
+
this.groupListener.forEach((listeners) => {
|
|
100
|
+
listeners.forEach(listener => listener.dispose());
|
|
101
|
+
});
|
|
102
|
+
this.groupListener.clear();
|
|
96
103
|
}
|
|
97
104
|
_disposeWidget(widget) {
|
|
98
105
|
widget.onWillHide();
|
|
@@ -106,27 +113,35 @@ let NotebookEditorWidgetService = class NotebookEditorWidgetService {
|
|
|
106
113
|
if (sourcePart.windowId !== targetPart.windowId) {
|
|
107
114
|
return;
|
|
108
115
|
}
|
|
109
|
-
const
|
|
110
|
-
if (
|
|
116
|
+
const target = this._borrowableEditors.get(targetID)?.get(input.resource)?.findIndex(widget => widget.editorType === input.typeId);
|
|
117
|
+
if (target !== undefined && target !== -1) {
|
|
111
118
|
return;
|
|
112
119
|
}
|
|
113
|
-
const widget = this._borrowableEditors.get(sourceID)?.get(input.resource);
|
|
120
|
+
const widget = this._borrowableEditors.get(sourceID)?.get(input.resource)?.find(widget => widget.editorType === input.typeId);
|
|
114
121
|
if (!widget) {
|
|
115
122
|
throw ( new Error('no widget at source group'));
|
|
116
123
|
}
|
|
117
|
-
this._borrowableEditors.get(sourceID)?.
|
|
124
|
+
const sourceWidgets = this._borrowableEditors.get(sourceID)?.get(input.resource);
|
|
125
|
+
if (sourceWidgets) {
|
|
126
|
+
const indexToRemove = sourceWidgets.findIndex(widget => widget.editorType === input.typeId);
|
|
127
|
+
if (indexToRemove !== -1) {
|
|
128
|
+
sourceWidgets.splice(indexToRemove, 1);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
118
131
|
let targetMap = this._borrowableEditors.get(targetID);
|
|
119
132
|
if (!targetMap) {
|
|
120
133
|
targetMap = ( new ResourceMap());
|
|
121
134
|
this._borrowableEditors.set(targetID, targetMap);
|
|
122
135
|
}
|
|
123
|
-
targetMap.
|
|
136
|
+
const widgetsAtTarget = targetMap.get(input.resource) ?? [];
|
|
137
|
+
widgetsAtTarget?.push(widget);
|
|
138
|
+
targetMap.set(input.resource, widgetsAtTarget);
|
|
124
139
|
}
|
|
125
140
|
retrieveExistingWidgetFromURI(resource) {
|
|
126
141
|
for (const widgetInfo of ( this._borrowableEditors.values())) {
|
|
127
|
-
const
|
|
128
|
-
if (
|
|
129
|
-
return this._createBorrowValue(
|
|
142
|
+
const widgets = widgetInfo.get(resource);
|
|
143
|
+
if (widgets && widgets.length > 0) {
|
|
144
|
+
return this._createBorrowValue(widgets[0].token, widgets[0]);
|
|
130
145
|
}
|
|
131
146
|
}
|
|
132
147
|
return undefined;
|
|
@@ -134,40 +149,48 @@ let NotebookEditorWidgetService = class NotebookEditorWidgetService {
|
|
|
134
149
|
retrieveAllExistingWidgets() {
|
|
135
150
|
const ret = [];
|
|
136
151
|
for (const widgetInfo of ( this._borrowableEditors.values())) {
|
|
137
|
-
for (const
|
|
138
|
-
|
|
152
|
+
for (const widgets of ( widgetInfo.values())) {
|
|
153
|
+
for (const widget of widgets) {
|
|
154
|
+
ret.push(this._createBorrowValue(widget.token, widget));
|
|
155
|
+
}
|
|
139
156
|
}
|
|
140
157
|
}
|
|
141
158
|
return ret;
|
|
142
159
|
}
|
|
143
|
-
retrieveWidget(accessor,
|
|
144
|
-
let value = this._borrowableEditors.get(
|
|
160
|
+
retrieveWidget(accessor, groupId, input, creationOptions, initialDimension, codeWindow) {
|
|
161
|
+
let value = this._borrowableEditors.get(groupId)?.get(input.resource)?.find(widget => widget.editorType === input.typeId);
|
|
145
162
|
if (!value) {
|
|
146
163
|
const editorGroupContextKeyService = accessor.get(IContextKeyService);
|
|
147
164
|
const editorGroupEditorProgressService = accessor.get(IEditorProgressService);
|
|
148
|
-
const
|
|
149
|
-
[IContextKeyService, editorGroupContextKeyService],
|
|
150
|
-
[IEditorProgressService, editorGroupEditorProgressService]
|
|
151
|
-
)));
|
|
152
|
-
const ctorOptions = creationOptions ?? getDefaultNotebookCreationOptions();
|
|
153
|
-
const widget = notebookInstantiationService.createInstance(NotebookEditorWidget, {
|
|
154
|
-
...ctorOptions,
|
|
155
|
-
codeWindow: codeWindow ?? ctorOptions.codeWindow,
|
|
156
|
-
}, initialDimension);
|
|
165
|
+
const widget = this.createWidget(editorGroupContextKeyService, editorGroupEditorProgressService, creationOptions, codeWindow, initialDimension);
|
|
157
166
|
const token = this._tokenPool++;
|
|
158
|
-
value = { widget, token };
|
|
159
|
-
let map = this._borrowableEditors.get(
|
|
167
|
+
value = { widget, editorType: input.typeId, token };
|
|
168
|
+
let map = this._borrowableEditors.get(groupId);
|
|
160
169
|
if (!map) {
|
|
161
170
|
map = ( new ResourceMap());
|
|
162
|
-
this._borrowableEditors.set(
|
|
171
|
+
this._borrowableEditors.set(groupId, map);
|
|
163
172
|
}
|
|
164
|
-
map.
|
|
173
|
+
const values = map.get(input.resource) ?? [];
|
|
174
|
+
values.push(value);
|
|
175
|
+
map.set(input.resource, values);
|
|
165
176
|
}
|
|
166
177
|
else {
|
|
167
178
|
value.token = this._tokenPool++;
|
|
168
179
|
}
|
|
169
180
|
return this._createBorrowValue(value.token, value);
|
|
170
181
|
}
|
|
182
|
+
createWidget(editorGroupContextKeyService, editorGroupEditorProgressService, creationOptions, codeWindow, initialDimension) {
|
|
183
|
+
const notebookInstantiationService = this.instantiationService.createChild(( new ServiceCollection(
|
|
184
|
+
[IContextKeyService, editorGroupContextKeyService],
|
|
185
|
+
[IEditorProgressService, editorGroupEditorProgressService]
|
|
186
|
+
)));
|
|
187
|
+
const ctorOptions = creationOptions ?? getDefaultNotebookCreationOptions();
|
|
188
|
+
const widget = notebookInstantiationService.createInstance(NotebookEditorWidget, {
|
|
189
|
+
...ctorOptions,
|
|
190
|
+
codeWindow: codeWindow ?? ctorOptions.codeWindow,
|
|
191
|
+
}, initialDimension);
|
|
192
|
+
return widget;
|
|
193
|
+
}
|
|
171
194
|
_createBorrowValue(myToken, widget) {
|
|
172
195
|
return {
|
|
173
196
|
get value() {
|
package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js
CHANGED
|
@@ -2,12 +2,12 @@ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
|
2
2
|
import { toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
3
3
|
import { localize } from 'vscode/vscode/vs/nls';
|
|
4
4
|
import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands.service';
|
|
5
|
-
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
6
5
|
import { IWorkspaceTrustRequestService } from 'vscode/vscode/vs/platform/workspace/common/workspaceTrust.service';
|
|
7
6
|
import { KernelPickerMRUStrategy } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/viewParts/notebookKernelQuickPickStrategy';
|
|
8
7
|
import { CellKind, NotebookCellExecutionState } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
9
8
|
import { INotebookExecutionStateService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookExecutionStateService.service';
|
|
10
9
|
import { INotebookKernelService, INotebookKernelHistoryService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookKernelService.service';
|
|
10
|
+
import { INotebookLoggingService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookLoggingService.service';
|
|
11
11
|
|
|
12
12
|
let NotebookExecutionService = class NotebookExecutionService {
|
|
13
13
|
constructor(_commandService, _notebookKernelService, _notebookKernelHistoryService, _workspaceTrustRequestService, _logService, _notebookExecutionStateService) {
|
|
@@ -25,8 +25,8 @@ let NotebookExecutionService = class NotebookExecutionService {
|
|
|
25
25
|
if (!cellsArr.length) {
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
|
-
this._logService.debug(`
|
|
29
|
-
const message = ( localize(
|
|
28
|
+
this._logService.debug(`Execution`, `${JSON.stringify(( (cellsArr.map(c => c.handle))))}`);
|
|
29
|
+
const message = ( localize(3259, "Executing a notebook cell will run code from this workspace."));
|
|
30
30
|
const trust = await this._workspaceTrustRequestService.requestWorkspaceTrust({ message });
|
|
31
31
|
if (!trust) {
|
|
32
32
|
return;
|
|
@@ -60,14 +60,15 @@ let NotebookExecutionService = class NotebookExecutionService {
|
|
|
60
60
|
await kernel.executeNotebookCellsRequest(notebook.uri, ( (validCellExecutions.map(c => c.cellHandle))));
|
|
61
61
|
const unconfirmed = validCellExecutions.filter(exe => exe.state === NotebookCellExecutionState.Unconfirmed);
|
|
62
62
|
if (unconfirmed.length) {
|
|
63
|
-
this._logService.debug(`
|
|
63
|
+
this._logService.debug(`Execution`, `Completing unconfirmed executions ${JSON.stringify(( (unconfirmed.map(exe => exe.cellHandle))))}`);
|
|
64
64
|
unconfirmed.forEach(exe => exe.complete({}));
|
|
65
65
|
}
|
|
66
|
+
this._logService.debug(`Execution`, `Completed executions ${JSON.stringify(( (validCellExecutions.map(exe => exe.cellHandle))))}`);
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
69
|
async cancelNotebookCellHandles(notebook, cells) {
|
|
69
70
|
const cellsArr = Array.from(cells);
|
|
70
|
-
this._logService.debug(`
|
|
71
|
+
this._logService.debug(`Execution`, `CancelNotebookCellHandles ${JSON.stringify(cellsArr)}`);
|
|
71
72
|
const kernel = this._notebookKernelService.getSelectedOrSuggestedKernel(notebook);
|
|
72
73
|
if (kernel) {
|
|
73
74
|
await kernel.cancelNotebookCellExecution(notebook.uri, cellsArr);
|
|
@@ -95,7 +96,7 @@ NotebookExecutionService = ( (__decorate([
|
|
|
95
96
|
( (__param(1, INotebookKernelService))),
|
|
96
97
|
( (__param(2, INotebookKernelHistoryService))),
|
|
97
98
|
( (__param(3, IWorkspaceTrustRequestService))),
|
|
98
|
-
( (__param(4,
|
|
99
|
+
( (__param(4, INotebookLoggingService))),
|
|
99
100
|
( (__param(5, INotebookExecutionStateService)))
|
|
100
101
|
], NotebookExecutionService)));
|
|
101
102
|
|
|
@@ -113,7 +113,7 @@ registerAction2(class extends Action2 {
|
|
|
113
113
|
constructor() {
|
|
114
114
|
super({
|
|
115
115
|
id: 'notebook.clearNotebookKernelsMRUCache',
|
|
116
|
-
title: ( localize2(
|
|
116
|
+
title: ( localize2(3263, "Clear Notebook Kernels MRU Cache")),
|
|
117
117
|
category: Categories.Developer,
|
|
118
118
|
f1: true
|
|
119
119
|
});
|
package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js
CHANGED
|
@@ -74,14 +74,14 @@ let NotebookKeymapService = class NotebookKeymapService extends Disposable {
|
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
76
|
this.notificationService.prompt(Severity$1.Info, ( localize(
|
|
77
|
-
|
|
77
|
+
3260,
|
|
78
78
|
"Disable other keymaps ({0}) to avoid conflicts between keybindings?",
|
|
79
79
|
( (distinct(( (oldKeymaps.map(k => k.local.manifest.displayName)))).map(name => `'${name}'`))).join(', ')
|
|
80
80
|
)), [{
|
|
81
|
-
label: ( localize(
|
|
81
|
+
label: ( localize(3261, "Yes")),
|
|
82
82
|
run: () => onPrompt(true)
|
|
83
83
|
}, {
|
|
84
|
-
label: ( localize(
|
|
84
|
+
label: ( localize(3262, "No")),
|
|
85
85
|
run: () => onPrompt(false)
|
|
86
86
|
}]);
|
|
87
87
|
}
|
package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js
CHANGED
|
@@ -8,7 +8,7 @@ let NotebookLoggingService = class NotebookLoggingService extends Disposable {
|
|
|
8
8
|
static { this.ID = 'notebook'; }
|
|
9
9
|
constructor(loggerService) {
|
|
10
10
|
super();
|
|
11
|
-
this._logger = this._register(loggerService.createLogger(logChannelId, { name: ( localize(
|
|
11
|
+
this._logger = this._register(loggerService.createLogger(logChannelId, { name: ( localize(3264, "Notebook")) }));
|
|
12
12
|
}
|
|
13
13
|
debug(category, output) {
|
|
14
14
|
this._logger.debug(`[${category}] ${output}`);
|
|
@@ -16,6 +16,12 @@ let NotebookLoggingService = class NotebookLoggingService extends Disposable {
|
|
|
16
16
|
info(category, output) {
|
|
17
17
|
this._logger.info(`[${category}] ${output}`);
|
|
18
18
|
}
|
|
19
|
+
warn(category, output) {
|
|
20
|
+
this._logger.warn(`[${category}] ${output}`);
|
|
21
|
+
}
|
|
22
|
+
error(category, output) {
|
|
23
|
+
this._logger.error(`[${category}] ${output}`);
|
|
24
|
+
}
|
|
19
25
|
};
|
|
20
26
|
NotebookLoggingService = ( (__decorate([
|
|
21
27
|
( (__param(0, ILoggerService)))
|
|
@@ -19,7 +19,7 @@ import { StorageScope, StorageTarget } from 'vscode/vscode/vs/platform/storage/c
|
|
|
19
19
|
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
20
20
|
import { Memento } from 'vscode/vscode/vs/workbench/common/memento';
|
|
21
21
|
import { notebooksExtensionPoint, notebookRendererExtensionPoint, notebookPreloadExtensionPoint } from '../notebookExtensionPoint.js';
|
|
22
|
-
import { NotebookDiffEditorInput } from '
|
|
22
|
+
import { NotebookDiffEditorInput } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookDiffEditorInput';
|
|
23
23
|
import { NotebookTextModel } from '../../common/model/notebookTextModel.js';
|
|
24
24
|
import { NotebookEditorPriority, NotebookSetting, CellUri, NotebookRendererMatch, RENDERER_EQUIVALENT_EXTENSIONS, RENDERER_NOT_AVAILABLE, MimeTypeDisplayOrder, ACCESSIBLE_NOTEBOOK_DISPLAY_ORDER, NOTEBOOK_DISPLAY_ORDER } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
25
25
|
import { NotebookEditorInput } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookEditorInput';
|
|
@@ -35,6 +35,8 @@ import { InstallRecommendedExtensionAction } from 'vscode/vscode/vs/workbench/co
|
|
|
35
35
|
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
|
|
36
36
|
import { INotebookDocumentService } from 'vscode/vscode/vs/workbench/services/notebook/common/notebookDocumentService.service';
|
|
37
37
|
import { MergeEditorInput } from 'vscode/vscode/vs/workbench/contrib/mergeEditor/browser/mergeEditorInput';
|
|
38
|
+
import { streamToBuffer, VSBuffer } from 'vscode/vscode/vs/base/common/buffer';
|
|
39
|
+
import { NotebookMultiDiffEditorInput } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput';
|
|
38
40
|
|
|
39
41
|
var NotebookProviderInfoStore_1, NotebookService_1;
|
|
40
42
|
let NotebookProviderInfoStore = class NotebookProviderInfoStore extends Disposable {
|
|
@@ -166,7 +168,11 @@ let NotebookProviderInfoStore = class NotebookProviderInfoStore extends Disposab
|
|
|
166
168
|
});
|
|
167
169
|
return { editor: NotebookEditorInput.getOrCreate(this._instantiationService, ref.object.resource, undefined, notebookProviderInfo.id), options };
|
|
168
170
|
};
|
|
169
|
-
const notebookDiffEditorInputFactory = (
|
|
171
|
+
const notebookDiffEditorInputFactory = (diffEditorInput, group) => {
|
|
172
|
+
const { modified, original, label, description } = diffEditorInput;
|
|
173
|
+
if (this._configurationService.getValue('notebook.experimental.enableNewDiffEditor')) {
|
|
174
|
+
return { editor: NotebookMultiDiffEditorInput.create(this._instantiationService, modified.resource, label, description, original.resource, notebookProviderInfo.id) };
|
|
175
|
+
}
|
|
170
176
|
return { editor: NotebookDiffEditorInput.create(this._instantiationService, modified.resource, label, description, original.resource, notebookProviderInfo.id) };
|
|
171
177
|
};
|
|
172
178
|
const mergeEditorInputFactory = (mergeEditor) => {
|
|
@@ -548,7 +554,7 @@ let NotebookService = class NotebookService extends Disposable {
|
|
|
548
554
|
const knownProvider = this.getViewTypeProvider(viewType);
|
|
549
555
|
const actions = knownProvider ? [
|
|
550
556
|
toAction({
|
|
551
|
-
id: 'workbench.notebook.action.installMissingViewType', label: ( localize(
|
|
557
|
+
id: 'workbench.notebook.action.installMissingViewType', label: ( localize(3258, "Install extension for '{0}'", viewType)), run: async () => {
|
|
552
558
|
await this._instantiationService.createInstance(InstallRecommendedExtensionAction, knownProvider).run();
|
|
553
559
|
}
|
|
554
560
|
})
|
|
@@ -598,17 +604,23 @@ let NotebookService = class NotebookService extends Disposable {
|
|
|
598
604
|
}
|
|
599
605
|
}
|
|
600
606
|
}
|
|
601
|
-
createNotebookTextModel(viewType, uri,
|
|
607
|
+
async createNotebookTextModel(viewType, uri, stream) {
|
|
602
608
|
if (( (this._models.has(uri)))) {
|
|
603
609
|
throw ( (new Error(`notebook for ${uri} already exists`)));
|
|
604
610
|
}
|
|
605
|
-
const
|
|
611
|
+
const info = await this.withNotebookDataProvider(viewType);
|
|
612
|
+
if (!(info instanceof SimpleNotebookProviderInfo)) {
|
|
613
|
+
throw ( (new Error('CANNOT open file notebook with this provider')));
|
|
614
|
+
}
|
|
615
|
+
const bytes = stream ? await streamToBuffer(stream) : VSBuffer.fromByteArray([]);
|
|
616
|
+
const data = await info.serializer.dataToNotebook(bytes);
|
|
617
|
+
const notebookModel = this._instantiationService.createInstance(NotebookTextModel, info.viewType, uri, data.cells, data.metadata, info.serializer.options);
|
|
606
618
|
const modelData = ( (new ModelData(notebookModel, this._onWillDisposeDocument.bind(this))));
|
|
607
619
|
this._models.set(uri, modelData);
|
|
608
620
|
this._notebookDocumentService.addNotebookDocument(modelData);
|
|
609
621
|
this._onWillAddNotebookDocument.fire(notebookModel);
|
|
610
622
|
this._onDidAddNotebookDocument.fire(notebookModel);
|
|
611
|
-
this._postDocumentOpenActivation(viewType);
|
|
623
|
+
this._postDocumentOpenActivation(info.viewType);
|
|
612
624
|
return notebookModel;
|
|
613
625
|
}
|
|
614
626
|
getNotebookTextModel(uri) {
|