@codingame/monaco-vscode-notebook-service-override 8.0.4 → 9.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/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/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
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(2817, "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(2818, "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
|
+
2819,
|
|
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(2820, "Yes")),
|
|
82
82
|
run: () => onPrompt(true)
|
|
83
83
|
}, {
|
|
84
|
-
label: ( localize(
|
|
84
|
+
label: ( localize(2821, "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(2822, "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(2816, "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) {
|
package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
2
|
import { Disposable, DisposableStore, toDisposable, dispose } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
3
|
-
import {
|
|
4
|
-
import { DefaultWorkerFactory } from 'vscode/vscode/vs/base/browser/defaultWorkerFactory';
|
|
3
|
+
import { createWebWorker } from 'vscode/vscode/vs/base/browser/defaultWorkerFactory';
|
|
5
4
|
import { NotebookCellsChangeType } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
6
5
|
import { INotebookService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookService.service';
|
|
7
6
|
|
|
@@ -35,7 +34,7 @@ class WorkerManager extends Disposable {
|
|
|
35
34
|
}
|
|
36
35
|
withWorker() {
|
|
37
36
|
if (!this._editorWorkerClient) {
|
|
38
|
-
this._editorWorkerClient = ( new NotebookWorkerClient(this._notebookService
|
|
37
|
+
this._editorWorkerClient = ( new NotebookWorkerClient(this._notebookService));
|
|
39
38
|
}
|
|
40
39
|
return Promise.resolve(this._editorWorkerClient);
|
|
41
40
|
}
|
|
@@ -65,7 +64,7 @@ class NotebookEditorModelManager extends Disposable {
|
|
|
65
64
|
return;
|
|
66
65
|
}
|
|
67
66
|
const modelUrl = ( resource.toString());
|
|
68
|
-
this._proxy
|
|
67
|
+
this._proxy.$acceptNewModel(( model.uri.toString()), {
|
|
69
68
|
cells: ( model.cells.map(cell => ({
|
|
70
69
|
handle: cell.handle,
|
|
71
70
|
uri: cell.uri,
|
|
@@ -114,7 +113,7 @@ class NotebookEditorModelManager extends Disposable {
|
|
|
114
113
|
: e);
|
|
115
114
|
return data;
|
|
116
115
|
}));
|
|
117
|
-
this._proxy
|
|
116
|
+
this._proxy.$acceptModelChanged(( modelUrl.toString()), {
|
|
118
117
|
rawEvents: dto,
|
|
119
118
|
versionId: event.versionId
|
|
120
119
|
});
|
|
@@ -123,7 +122,7 @@ class NotebookEditorModelManager extends Disposable {
|
|
|
123
122
|
this._stopModelSync(modelUrl);
|
|
124
123
|
}));
|
|
125
124
|
toDispose.add(toDisposable(() => {
|
|
126
|
-
this._proxy
|
|
125
|
+
this._proxy.$acceptRemovedModel(modelUrl);
|
|
127
126
|
}));
|
|
128
127
|
this._syncedModels[modelUrl] = toDispose;
|
|
129
128
|
}
|
|
@@ -134,34 +133,20 @@ class NotebookEditorModelManager extends Disposable {
|
|
|
134
133
|
dispose(toDispose);
|
|
135
134
|
}
|
|
136
135
|
}
|
|
137
|
-
class NotebookWorkerHost {
|
|
138
|
-
constructor(workerClient) {
|
|
139
|
-
this._workerClient = workerClient;
|
|
140
|
-
}
|
|
141
|
-
fhr(method, args) {
|
|
142
|
-
return this._workerClient.fhr(method, args);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
136
|
class NotebookWorkerClient extends Disposable {
|
|
146
|
-
constructor(_notebookService
|
|
137
|
+
constructor(_notebookService) {
|
|
147
138
|
super();
|
|
148
139
|
this._notebookService = _notebookService;
|
|
149
|
-
this._workerFactory = ( new DefaultWorkerFactory(label));
|
|
150
140
|
this._worker = null;
|
|
151
141
|
this._modelManager = null;
|
|
152
142
|
}
|
|
153
|
-
fhr(method, args) {
|
|
154
|
-
throw ( new Error(`Not implemented!`));
|
|
155
|
-
}
|
|
156
143
|
computeDiff(original, modified) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
});
|
|
144
|
+
const proxy = this._ensureSyncedResources([original, modified]);
|
|
145
|
+
return proxy.$computeDiff(( original.toString()), ( modified.toString()));
|
|
160
146
|
}
|
|
161
147
|
canPromptRecommendation(modelUri) {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
});
|
|
148
|
+
const proxy = this._ensureSyncedResources([modelUri]);
|
|
149
|
+
return proxy.$canPromptRecommendation(( modelUri.toString()));
|
|
165
150
|
}
|
|
166
151
|
_getOrCreateModelManager(proxy) {
|
|
167
152
|
if (!this._modelManager) {
|
|
@@ -169,20 +154,15 @@ class NotebookWorkerClient extends Disposable {
|
|
|
169
154
|
}
|
|
170
155
|
return this._modelManager;
|
|
171
156
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
});
|
|
157
|
+
_ensureSyncedResources(resources) {
|
|
158
|
+
const proxy = this._getOrCreateWorker().proxy;
|
|
159
|
+
this._getOrCreateModelManager(proxy).ensureSyncedResources(resources);
|
|
160
|
+
return proxy;
|
|
177
161
|
}
|
|
178
162
|
_getOrCreateWorker() {
|
|
179
163
|
if (!this._worker) {
|
|
180
164
|
try {
|
|
181
|
-
this._worker = this._register((
|
|
182
|
-
this._workerFactory,
|
|
183
|
-
'vs/workbench/contrib/notebook/common/services/notebookSimpleWorker',
|
|
184
|
-
( new NotebookWorkerHost(this))
|
|
185
|
-
)));
|
|
165
|
+
this._worker = this._register(createWebWorker('vs/workbench/contrib/notebook/common/services/notebookSimpleWorker', 'NotebookEditorWorker'));
|
|
186
166
|
}
|
|
187
167
|
catch (err) {
|
|
188
168
|
throw (err);
|
|
@@ -190,11 +170,6 @@ class NotebookWorkerClient extends Disposable {
|
|
|
190
170
|
}
|
|
191
171
|
return this._worker;
|
|
192
172
|
}
|
|
193
|
-
_getProxy() {
|
|
194
|
-
return this._getOrCreateWorker().getProxyObject().then(undefined, (err) => {
|
|
195
|
-
throw (err);
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
173
|
}
|
|
199
174
|
|
|
200
175
|
export { NotebookEditorWorkerServiceImpl };
|
package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.js
CHANGED
|
@@ -11,7 +11,6 @@ import 'vscode/vscode/vs/base/common/htmlContent';
|
|
|
11
11
|
import 'vscode/vscode/vs/base/common/filters';
|
|
12
12
|
import 'vscode/vscode/vs/base/common/strings';
|
|
13
13
|
import 'vscode/vscode/vs/base/common/lifecycle';
|
|
14
|
-
import 'vscode/external/vscode-marked/lib/marked.esm.js';
|
|
15
14
|
import 'vscode/vscode/vs/base/common/charCode';
|
|
16
15
|
import 'vscode/vscode/vs/base/common/marshallingIds';
|
|
17
16
|
import 'vscode/vscode/vs/base/common/path';
|
|
@@ -16,6 +16,8 @@ import { ILanguageService } from 'vscode/vscode/vs/editor/common/languages/langu
|
|
|
16
16
|
import { TextModel } from 'vscode/vscode/vs/editor/common/model/textModel';
|
|
17
17
|
import { isDefined } from 'vscode/vscode/vs/base/common/types';
|
|
18
18
|
import { ILanguageDetectionService } from 'vscode/vscode/vs/workbench/services/languageDetection/common/languageDetectionWorkerService.service';
|
|
19
|
+
import { Range } from 'vscode/vscode/vs/editor/common/core/range';
|
|
20
|
+
import { SearchParams } from 'vscode/vscode/vs/editor/common/model/textModelSearch';
|
|
19
21
|
|
|
20
22
|
var NotebookTextModel_1;
|
|
21
23
|
class StackOperation {
|
|
@@ -1000,6 +1002,32 @@ let NotebookTextModel = NotebookTextModel_1 = class NotebookTextModel extends Di
|
|
|
1000
1002
|
_indexIsInvalid(index) {
|
|
1001
1003
|
return index < 0 || index >= this._cells.length;
|
|
1002
1004
|
}
|
|
1005
|
+
findNextMatch(searchString, searchStart, isRegex, matchCase, wordSeparators) {
|
|
1006
|
+
this._assertIndex(searchStart.cellIndex);
|
|
1007
|
+
const searchParams = ( new SearchParams(searchString, isRegex, matchCase, wordSeparators));
|
|
1008
|
+
const searchData = searchParams.parseSearchRequest();
|
|
1009
|
+
if (!searchData) {
|
|
1010
|
+
return null;
|
|
1011
|
+
}
|
|
1012
|
+
let cellIndex = searchStart.cellIndex;
|
|
1013
|
+
let searchStartPosition = searchStart.position;
|
|
1014
|
+
while (cellIndex < this._cells.length) {
|
|
1015
|
+
const cell = this._cells[cellIndex];
|
|
1016
|
+
const searchRange = ( new Range(
|
|
1017
|
+
searchStartPosition.lineNumber,
|
|
1018
|
+
searchStartPosition.column,
|
|
1019
|
+
cell.textBuffer.getLineCount(),
|
|
1020
|
+
cell.textBuffer.getLineMaxColumn(cell.textBuffer.getLineCount())
|
|
1021
|
+
));
|
|
1022
|
+
const result = cell.textBuffer.findMatchesLineByLine(searchRange, searchData, false, 1);
|
|
1023
|
+
if (result.length > 0) {
|
|
1024
|
+
return { cell, match: result[0] };
|
|
1025
|
+
}
|
|
1026
|
+
cellIndex++;
|
|
1027
|
+
searchStartPosition = { lineNumber: 1, column: 1 };
|
|
1028
|
+
}
|
|
1029
|
+
return null;
|
|
1030
|
+
}
|
|
1003
1031
|
};
|
|
1004
1032
|
NotebookTextModel = NotebookTextModel_1 = ( __decorate([
|
|
1005
1033
|
( __param(5, IUndoRedoService)),
|