@codingame/monaco-vscode-notebook-service-override 1.85.1
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/external/rollup-plugin-styles/dist/runtime/inject-css.js +3 -0
- package/external/tslib/tslib.es6.js +11 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/notebook.d.ts +5 -0
- package/notebook.js +44 -0
- package/override/vs/platform/dialogs/common/dialogs.js +8 -0
- package/package.json +32 -0
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +387 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +668 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +109 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.js +319 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/notebookVisibleCellObserver.js +58 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +173 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +485 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +106 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +67 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +165 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +67 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +238 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +72 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/media/notebookFind.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +168 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +317 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +209 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +87 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +82 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +67 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +93 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +383 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +51 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +46 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +135 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +383 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +117 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +511 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +168 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +57 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +94 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +51 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +702 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +268 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +45 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +1297 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +284 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +563 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +108 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +39 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +313 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +872 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +13 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +393 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +175 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +1121 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibility.js +159 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +339 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookCellStatusBarServiceImpl.js +41 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +182 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +106 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +509 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +133 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +342 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +111 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +28 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +65 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +666 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +200 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +80 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +1001 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +103 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +202 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +80 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookProvider.js +98 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorker.js +217 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +89 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +372 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopy.js +706 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +407 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +144 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.js +129 -0
- package/worker.js +1 -0
- package/workers/notebook.worker.js +9 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
|
|
3
|
+
import { CancellationToken } from 'monaco-editor/esm/vs/base/common/cancellation.js';
|
|
4
|
+
import { DisposableStore, Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
5
|
+
import { registerEditorAction, EditorAction } from 'monaco-editor/esm/vs/editor/browser/editorExtensions.js';
|
|
6
|
+
import { IBulkEditService, ResourceTextEdit } from 'monaco-editor/esm/vs/editor/browser/services/bulkEditService.js';
|
|
7
|
+
import { EditorContextKeys } from 'monaco-editor/esm/vs/editor/common/editorContextKeys.js';
|
|
8
|
+
import { IEditorWorkerService } from 'monaco-editor/esm/vs/editor/common/services/editorWorker.js';
|
|
9
|
+
import { ILanguageFeaturesService } from 'monaco-editor/esm/vs/editor/common/services/languageFeatures.js';
|
|
10
|
+
import { ITextModelService } from 'monaco-editor/esm/vs/editor/common/services/resolverService.js';
|
|
11
|
+
import { getDocumentFormattingEditsUntilResult, formatDocumentWithSelectedProvider } from 'monaco-editor/esm/vs/editor/contrib/format/browser/format.js';
|
|
12
|
+
import { registerAction2, Action2, MenuId } from 'monaco-editor/esm/vs/platform/actions/common/actions.js';
|
|
13
|
+
import { ContextKeyExpr } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
|
|
14
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
15
|
+
import { Progress } from 'monaco-editor/esm/vs/platform/progress/common/progress.js';
|
|
16
|
+
import { NOTEBOOK_ACTIONS_CATEGORY } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/coreActions';
|
|
17
|
+
import { getNotebookEditorFromEditorPane } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
|
|
18
|
+
import { NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_EDITOR_EDITABLE } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
|
|
19
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
20
|
+
import { INotebookExecutionService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookExecutionService';
|
|
21
|
+
import { NotebookSetting } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
22
|
+
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
23
|
+
import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
|
|
24
|
+
import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
25
|
+
import { INotebookService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookService';
|
|
26
|
+
|
|
27
|
+
registerAction2(class extends Action2 {
|
|
28
|
+
constructor() {
|
|
29
|
+
super({
|
|
30
|
+
id: 'notebook.format',
|
|
31
|
+
title: { value: ( localizeWithPath(
|
|
32
|
+
'vs/workbench/contrib/notebook/browser/contrib/format/formatting',
|
|
33
|
+
'format.title',
|
|
34
|
+
"Format Notebook"
|
|
35
|
+
)), original: 'Format Notebook' },
|
|
36
|
+
category: NOTEBOOK_ACTIONS_CATEGORY,
|
|
37
|
+
precondition: ( ContextKeyExpr.and(NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_EDITOR_EDITABLE)),
|
|
38
|
+
keybinding: {
|
|
39
|
+
when: ( EditorContextKeys.editorTextFocus.toNegated()),
|
|
40
|
+
primary: 1024 | 512 | 36 ,
|
|
41
|
+
linux: { primary: 2048 | 1024 | 39 },
|
|
42
|
+
weight: 200
|
|
43
|
+
},
|
|
44
|
+
f1: true,
|
|
45
|
+
menu: {
|
|
46
|
+
id: MenuId.EditorContext,
|
|
47
|
+
when: ( ContextKeyExpr.and(
|
|
48
|
+
EditorContextKeys.inCompositeEditor,
|
|
49
|
+
EditorContextKeys.hasDocumentFormattingProvider
|
|
50
|
+
)),
|
|
51
|
+
group: '1_modification',
|
|
52
|
+
order: 1.3
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
async run(accessor) {
|
|
57
|
+
const editorService = accessor.get(IEditorService);
|
|
58
|
+
const textModelService = accessor.get(ITextModelService);
|
|
59
|
+
const editorWorkerService = accessor.get(IEditorWorkerService);
|
|
60
|
+
const languageFeaturesService = accessor.get(ILanguageFeaturesService);
|
|
61
|
+
const bulkEditService = accessor.get(IBulkEditService);
|
|
62
|
+
const editor = getNotebookEditorFromEditorPane(editorService.activeEditorPane);
|
|
63
|
+
if (!editor || !editor.hasModel()) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const notebook = editor.textModel;
|
|
67
|
+
const disposable = ( new DisposableStore());
|
|
68
|
+
try {
|
|
69
|
+
const allCellEdits = await Promise.all(( notebook.cells.map(async (cell) => {
|
|
70
|
+
const ref = await textModelService.createModelReference(cell.uri);
|
|
71
|
+
disposable.add(ref);
|
|
72
|
+
const model = ref.object.textEditorModel;
|
|
73
|
+
const formatEdits = await getDocumentFormattingEditsUntilResult(editorWorkerService, languageFeaturesService, model, model.getOptions(), CancellationToken.None);
|
|
74
|
+
const edits = [];
|
|
75
|
+
if (formatEdits) {
|
|
76
|
+
for (const edit of formatEdits) {
|
|
77
|
+
edits.push(( new ResourceTextEdit(model.uri, edit, model.getVersionId())));
|
|
78
|
+
}
|
|
79
|
+
return edits;
|
|
80
|
+
}
|
|
81
|
+
return [];
|
|
82
|
+
})));
|
|
83
|
+
await bulkEditService.apply( allCellEdits.flat(), { label: ( localizeWithPath(
|
|
84
|
+
'vs/workbench/contrib/notebook/browser/contrib/format/formatting',
|
|
85
|
+
'label',
|
|
86
|
+
"Format Notebook"
|
|
87
|
+
)), code: 'undoredo.formatNotebook', });
|
|
88
|
+
}
|
|
89
|
+
finally {
|
|
90
|
+
disposable.dispose();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
registerEditorAction(class FormatCellAction extends EditorAction {
|
|
95
|
+
constructor() {
|
|
96
|
+
super({
|
|
97
|
+
id: 'notebook.formatCell',
|
|
98
|
+
label: ( localizeWithPath(
|
|
99
|
+
'vs/workbench/contrib/notebook/browser/contrib/format/formatting',
|
|
100
|
+
'formatCell.label',
|
|
101
|
+
"Format Cell"
|
|
102
|
+
)),
|
|
103
|
+
alias: 'Format Cell',
|
|
104
|
+
precondition: ( ContextKeyExpr.and(
|
|
105
|
+
NOTEBOOK_IS_ACTIVE_EDITOR,
|
|
106
|
+
NOTEBOOK_EDITOR_EDITABLE,
|
|
107
|
+
EditorContextKeys.inCompositeEditor,
|
|
108
|
+
EditorContextKeys.writable,
|
|
109
|
+
EditorContextKeys.hasDocumentFormattingProvider
|
|
110
|
+
)),
|
|
111
|
+
kbOpts: {
|
|
112
|
+
kbExpr: ( ContextKeyExpr.and(EditorContextKeys.editorTextFocus)),
|
|
113
|
+
primary: 1024 | 512 | 36 ,
|
|
114
|
+
linux: { primary: 2048 | 1024 | 39 },
|
|
115
|
+
weight: 100
|
|
116
|
+
},
|
|
117
|
+
contextMenuOpts: {
|
|
118
|
+
group: '1_modification',
|
|
119
|
+
order: 1.301
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
async run(accessor, editor) {
|
|
124
|
+
if (editor.hasModel()) {
|
|
125
|
+
const instaService = accessor.get(IInstantiationService);
|
|
126
|
+
await instaService.invokeFunction(formatDocumentWithSelectedProvider, editor, 1 , Progress.None, CancellationToken.None, true);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
let FormatOnCellExecutionParticipant = class FormatOnCellExecutionParticipant {
|
|
131
|
+
constructor(bulkEditService, languageFeaturesService, textModelService, editorWorkerService, configurationService, _notebookService) {
|
|
132
|
+
this.bulkEditService = bulkEditService;
|
|
133
|
+
this.languageFeaturesService = languageFeaturesService;
|
|
134
|
+
this.textModelService = textModelService;
|
|
135
|
+
this.editorWorkerService = editorWorkerService;
|
|
136
|
+
this.configurationService = configurationService;
|
|
137
|
+
this._notebookService = _notebookService;
|
|
138
|
+
}
|
|
139
|
+
async onWillExecuteCell(executions) {
|
|
140
|
+
const enabled = this.configurationService.getValue(NotebookSetting.formatOnCellExecution);
|
|
141
|
+
if (!enabled) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
const disposable = ( new DisposableStore());
|
|
145
|
+
try {
|
|
146
|
+
const allCellEdits = await Promise.all(( executions.map(async (cellExecution) => {
|
|
147
|
+
const nbModel = this._notebookService.getNotebookTextModel(cellExecution.notebook);
|
|
148
|
+
if (!nbModel) {
|
|
149
|
+
return [];
|
|
150
|
+
}
|
|
151
|
+
let activeCell;
|
|
152
|
+
for (const cell of nbModel.cells) {
|
|
153
|
+
if (cell.handle === cellExecution.cellHandle) {
|
|
154
|
+
activeCell = cell;
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
if (!activeCell) {
|
|
159
|
+
return [];
|
|
160
|
+
}
|
|
161
|
+
const ref = await this.textModelService.createModelReference(activeCell.uri);
|
|
162
|
+
disposable.add(ref);
|
|
163
|
+
const model = ref.object.textEditorModel;
|
|
164
|
+
const formatEdits = await getDocumentFormattingEditsUntilResult(this.editorWorkerService, this.languageFeaturesService, model, model.getOptions(), CancellationToken.None);
|
|
165
|
+
const edits = [];
|
|
166
|
+
if (formatEdits) {
|
|
167
|
+
edits.push(...( formatEdits.map(edit => ( new ResourceTextEdit(model.uri, edit, model.getVersionId())))));
|
|
168
|
+
return edits;
|
|
169
|
+
}
|
|
170
|
+
return [];
|
|
171
|
+
})));
|
|
172
|
+
await this.bulkEditService.apply( allCellEdits.flat(), { label: ( localizeWithPath(
|
|
173
|
+
'vs/workbench/contrib/notebook/browser/contrib/format/formatting',
|
|
174
|
+
'formatCells.label',
|
|
175
|
+
"Format Cells"
|
|
176
|
+
)), code: 'undoredo.notebooks.onWillExecuteFormat', });
|
|
177
|
+
}
|
|
178
|
+
finally {
|
|
179
|
+
disposable.dispose();
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
FormatOnCellExecutionParticipant = ( __decorate([
|
|
184
|
+
( __param(0, IBulkEditService)),
|
|
185
|
+
( __param(1, ILanguageFeaturesService)),
|
|
186
|
+
( __param(2, ITextModelService)),
|
|
187
|
+
( __param(3, IEditorWorkerService)),
|
|
188
|
+
( __param(4, IConfigurationService)),
|
|
189
|
+
( __param(5, INotebookService))
|
|
190
|
+
], FormatOnCellExecutionParticipant));
|
|
191
|
+
let CellExecutionParticipantsContribution = class CellExecutionParticipantsContribution extends Disposable {
|
|
192
|
+
constructor(instantiationService, notebookExecutionService) {
|
|
193
|
+
super();
|
|
194
|
+
this.instantiationService = instantiationService;
|
|
195
|
+
this.notebookExecutionService = notebookExecutionService;
|
|
196
|
+
this.registerKernelExecutionParticipants();
|
|
197
|
+
}
|
|
198
|
+
registerKernelExecutionParticipants() {
|
|
199
|
+
this._register(this.notebookExecutionService.registerExecutionParticipant(this.instantiationService.createInstance(FormatOnCellExecutionParticipant)));
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
CellExecutionParticipantsContribution = ( __decorate([
|
|
203
|
+
( __param(0, IInstantiationService)),
|
|
204
|
+
( __param(1, INotebookExecutionService))
|
|
205
|
+
], CellExecutionParticipantsContribution));
|
|
206
|
+
const workbenchContributionsRegistry = ( Registry.as(Extensions.Workbench));
|
|
207
|
+
workbenchContributionsRegistry.registerWorkbenchContribution(CellExecutionParticipantsContribution, 3 );
|
|
208
|
+
|
|
209
|
+
export { CellExecutionParticipantsContribution };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
3
|
+
import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
|
|
4
|
+
import { registerAction2, Action2 } from 'monaco-editor/esm/vs/platform/actions/common/actions.js';
|
|
5
|
+
import { ICommandService } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
|
|
6
|
+
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
7
|
+
import { ContextKeyExpr, IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
|
|
8
|
+
import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
|
|
9
|
+
import { IStorageService } from 'monaco-editor/esm/vs/platform/storage/common/storage.js';
|
|
10
|
+
import { Categories } from 'monaco-editor/esm/vs/platform/action/common/actionCommonCategories.js';
|
|
11
|
+
import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
12
|
+
import { Memento } from 'vscode/vscode/vs/workbench/common/memento';
|
|
13
|
+
import { HAS_OPENED_NOTEBOOK } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
|
|
14
|
+
import { NotebookSetting } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
15
|
+
import { NotebookEditorInput } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookEditorInput';
|
|
16
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
17
|
+
|
|
18
|
+
const hasOpenedNotebookKey = 'hasOpenedNotebook';
|
|
19
|
+
const hasShownGettingStartedKey = 'hasShownNotebookGettingStarted';
|
|
20
|
+
let NotebookGettingStarted = class NotebookGettingStarted extends Disposable {
|
|
21
|
+
constructor(_editorService, _storageService, _contextKeyService, _commandService, _configurationService) {
|
|
22
|
+
super();
|
|
23
|
+
const hasOpenedNotebook = HAS_OPENED_NOTEBOOK.bindTo(_contextKeyService);
|
|
24
|
+
const memento = ( new Memento('notebookGettingStarted2', _storageService));
|
|
25
|
+
const storedValue = memento.getMemento(0 , 0 );
|
|
26
|
+
if (storedValue[hasOpenedNotebookKey]) {
|
|
27
|
+
hasOpenedNotebook.set(true);
|
|
28
|
+
}
|
|
29
|
+
const needToShowGettingStarted = _configurationService.getValue(NotebookSetting.openGettingStarted) && !storedValue[hasShownGettingStartedKey];
|
|
30
|
+
if (!storedValue[hasOpenedNotebookKey] || needToShowGettingStarted) {
|
|
31
|
+
const onDidOpenNotebook = () => {
|
|
32
|
+
hasOpenedNotebook.set(true);
|
|
33
|
+
storedValue[hasOpenedNotebookKey] = true;
|
|
34
|
+
if (needToShowGettingStarted) {
|
|
35
|
+
_commandService.executeCommand('workbench.action.openWalkthrough', { category: 'notebooks', step: 'notebookProfile' }, true);
|
|
36
|
+
storedValue[hasShownGettingStartedKey] = true;
|
|
37
|
+
}
|
|
38
|
+
memento.saveMemento();
|
|
39
|
+
};
|
|
40
|
+
if (_editorService.activeEditor?.typeId === NotebookEditorInput.ID) {
|
|
41
|
+
onDidOpenNotebook();
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const listener = this._register(_editorService.onDidActiveEditorChange(() => {
|
|
45
|
+
if (_editorService.activeEditor?.typeId === NotebookEditorInput.ID) {
|
|
46
|
+
listener.dispose();
|
|
47
|
+
onDidOpenNotebook();
|
|
48
|
+
}
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
NotebookGettingStarted = ( __decorate([
|
|
54
|
+
( __param(0, IEditorService)),
|
|
55
|
+
( __param(1, IStorageService)),
|
|
56
|
+
( __param(2, IContextKeyService)),
|
|
57
|
+
( __param(3, ICommandService)),
|
|
58
|
+
( __param(4, IConfigurationService))
|
|
59
|
+
], NotebookGettingStarted));
|
|
60
|
+
( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(NotebookGettingStarted, 3 );
|
|
61
|
+
registerAction2(class NotebookClearNotebookLayoutAction extends Action2 {
|
|
62
|
+
constructor() {
|
|
63
|
+
super({
|
|
64
|
+
id: 'workbench.notebook.layout.gettingStarted',
|
|
65
|
+
title: {
|
|
66
|
+
value: ( localizeWithPath(
|
|
67
|
+
'vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted',
|
|
68
|
+
'workbench.notebook.layout.gettingStarted.label',
|
|
69
|
+
"Reset notebook getting started"
|
|
70
|
+
)),
|
|
71
|
+
original: 'Reset notebook getting started'
|
|
72
|
+
},
|
|
73
|
+
f1: true,
|
|
74
|
+
precondition: ( ContextKeyExpr.equals(`config.${NotebookSetting.openGettingStarted}`, true)),
|
|
75
|
+
category: Categories.Developer,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
run(accessor) {
|
|
79
|
+
const storageService = accessor.get(IStorageService);
|
|
80
|
+
const memento = ( new Memento('notebookGettingStarted', storageService));
|
|
81
|
+
const storedValue = memento.getMemento(0 , 0 );
|
|
82
|
+
storedValue[hasOpenedNotebookKey] = undefined;
|
|
83
|
+
memento.saveMemento();
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
export { NotebookGettingStarted };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { Disposable, DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
3
|
+
import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
|
|
4
|
+
import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
5
|
+
import { INotebookKernelService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookKernelService';
|
|
6
|
+
import { INotebookLoggingService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookLoggingService';
|
|
7
|
+
import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
|
|
8
|
+
|
|
9
|
+
let NotebookKernelDetection = class NotebookKernelDetection extends Disposable {
|
|
10
|
+
constructor(_notebookKernelService, _extensionService, _notebookLoggingService) {
|
|
11
|
+
super();
|
|
12
|
+
this._notebookKernelService = _notebookKernelService;
|
|
13
|
+
this._extensionService = _extensionService;
|
|
14
|
+
this._notebookLoggingService = _notebookLoggingService;
|
|
15
|
+
this._detectionMap = ( new Map());
|
|
16
|
+
this._localDisposableStore = this._register(( new DisposableStore()));
|
|
17
|
+
this._registerListeners();
|
|
18
|
+
}
|
|
19
|
+
_registerListeners() {
|
|
20
|
+
this._localDisposableStore.clear();
|
|
21
|
+
this._localDisposableStore.add(this._extensionService.onWillActivateByEvent(e => {
|
|
22
|
+
if (e.event.startsWith('onNotebook:')) {
|
|
23
|
+
if (this._extensionService.activationEventIsDone(e.event)) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const notebookType = e.event.substring('onNotebook:'.length);
|
|
27
|
+
if (notebookType === '*') {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
let shouldStartDetection = false;
|
|
31
|
+
const extensionStatus = this._extensionService.getExtensionsStatus();
|
|
32
|
+
this._extensionService.extensions.forEach(extension => {
|
|
33
|
+
if (extensionStatus[extension.identifier.value].activationTimes) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (extension.activationEvents?.includes(e.event)) {
|
|
37
|
+
shouldStartDetection = true;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
if (shouldStartDetection && !( this._detectionMap.has(notebookType))) {
|
|
41
|
+
this._notebookLoggingService.debug('KernelDetection', `start extension activation for ${notebookType}`);
|
|
42
|
+
const task = this._notebookKernelService.registerNotebookKernelDetectionTask({
|
|
43
|
+
notebookType: notebookType
|
|
44
|
+
});
|
|
45
|
+
this._detectionMap.set(notebookType, task);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}));
|
|
49
|
+
let timer = null;
|
|
50
|
+
this._localDisposableStore.add(this._extensionService.onDidChangeExtensionsStatus(() => {
|
|
51
|
+
if (timer) {
|
|
52
|
+
clearTimeout(timer);
|
|
53
|
+
}
|
|
54
|
+
timer = setTimeout(() => {
|
|
55
|
+
const taskToDelete = [];
|
|
56
|
+
for (const [notebookType, task] of this._detectionMap) {
|
|
57
|
+
if (this._extensionService.activationEventIsDone(`onNotebook:${notebookType}`)) {
|
|
58
|
+
this._notebookLoggingService.debug('KernelDetection', `finish extension activation for ${notebookType}`);
|
|
59
|
+
taskToDelete.push(notebookType);
|
|
60
|
+
task.dispose();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
taskToDelete.forEach(notebookType => {
|
|
64
|
+
this._detectionMap.delete(notebookType);
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
}));
|
|
68
|
+
this._localDisposableStore.add({
|
|
69
|
+
dispose: () => {
|
|
70
|
+
if (timer) {
|
|
71
|
+
clearTimeout(timer);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
NotebookKernelDetection = ( __decorate([
|
|
78
|
+
( __param(0, INotebookKernelService)),
|
|
79
|
+
( __param(1, IExtensionService)),
|
|
80
|
+
( __param(2, INotebookLoggingService))
|
|
81
|
+
], NotebookKernelDetection));
|
|
82
|
+
( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(NotebookKernelDetection, 3 );
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
|
|
2
|
+
import { registerAction2, Action2, MenuId } from 'monaco-editor/esm/vs/platform/actions/common/actions.js';
|
|
3
|
+
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
4
|
+
import { NOTEBOOK_ACTIONS_CATEGORY } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/coreActions';
|
|
5
|
+
import { NotebookSetting } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
6
|
+
|
|
7
|
+
const TOGGLE_CELL_TOOLBAR_POSITION = 'notebook.toggleCellToolbarPosition';
|
|
8
|
+
class ToggleCellToolbarPositionAction extends Action2 {
|
|
9
|
+
constructor() {
|
|
10
|
+
super({
|
|
11
|
+
id: TOGGLE_CELL_TOOLBAR_POSITION,
|
|
12
|
+
title: { value: ( localizeWithPath(
|
|
13
|
+
'vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions',
|
|
14
|
+
'notebook.toggleCellToolbarPosition',
|
|
15
|
+
"Toggle Cell Toolbar Position"
|
|
16
|
+
)), original: 'Toggle Cell Toolbar Position' },
|
|
17
|
+
menu: [{
|
|
18
|
+
id: MenuId.NotebookCellTitle,
|
|
19
|
+
group: 'View',
|
|
20
|
+
order: 1
|
|
21
|
+
}],
|
|
22
|
+
category: NOTEBOOK_ACTIONS_CATEGORY,
|
|
23
|
+
f1: false
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
async run(accessor, context) {
|
|
27
|
+
const editor = context && context.ui ? context.notebookEditor : undefined;
|
|
28
|
+
if (editor && editor.hasModel()) {
|
|
29
|
+
const viewType = editor.textModel.viewType;
|
|
30
|
+
const configurationService = accessor.get(IConfigurationService);
|
|
31
|
+
const toolbarPosition = configurationService.getValue(NotebookSetting.cellToolbarLocation);
|
|
32
|
+
const newConfig = this.togglePosition(viewType, toolbarPosition);
|
|
33
|
+
await configurationService.updateValue(NotebookSetting.cellToolbarLocation, newConfig);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
togglePosition(viewType, toolbarPosition) {
|
|
37
|
+
if (typeof toolbarPosition === 'string') {
|
|
38
|
+
if (['left', 'right', 'hidden'].indexOf(toolbarPosition) >= 0) {
|
|
39
|
+
const newViewValue = toolbarPosition === 'right' ? 'left' : 'right';
|
|
40
|
+
const config = {
|
|
41
|
+
default: toolbarPosition
|
|
42
|
+
};
|
|
43
|
+
config[viewType] = newViewValue;
|
|
44
|
+
return config;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
const config = {
|
|
48
|
+
default: 'right',
|
|
49
|
+
};
|
|
50
|
+
config[viewType] = 'left';
|
|
51
|
+
return config;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
const oldValue = toolbarPosition[viewType] ?? toolbarPosition['default'] ?? 'right';
|
|
56
|
+
const newViewValue = oldValue === 'right' ? 'left' : 'right';
|
|
57
|
+
const newConfig = {
|
|
58
|
+
...toolbarPosition
|
|
59
|
+
};
|
|
60
|
+
newConfig[viewType] = newViewValue;
|
|
61
|
+
return newConfig;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
registerAction2(ToggleCellToolbarPositionAction);
|
|
66
|
+
|
|
67
|
+
export { ToggleCellToolbarPositionAction };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
|
|
3
|
+
import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
4
|
+
import { MarkerList, IMarkerNavigationService } from 'monaco-editor/esm/vs/editor/contrib/gotoError/browser/markerNavigationService.js';
|
|
5
|
+
import { CellUri } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
6
|
+
import { MarkerSeverity, IMarkerService } from 'monaco-editor/esm/vs/platform/markers/common/markers.js';
|
|
7
|
+
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
8
|
+
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
9
|
+
import { NotebookOverviewRulerLane } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
|
|
10
|
+
import { registerNotebookContribution } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookEditorExtensions';
|
|
11
|
+
import { throttle } from 'monaco-editor/esm/vs/base/common/decorators.js';
|
|
12
|
+
import { editorErrorForeground, editorWarningForeground } from 'monaco-editor/esm/vs/platform/theme/common/colorRegistry.js';
|
|
13
|
+
import { isEqual } from 'monaco-editor/esm/vs/base/common/resources.js';
|
|
14
|
+
|
|
15
|
+
let MarkerListProvider = class MarkerListProvider {
|
|
16
|
+
constructor(_markerService, markerNavigation, _configService) {
|
|
17
|
+
this._markerService = _markerService;
|
|
18
|
+
this._configService = _configService;
|
|
19
|
+
this._dispoables = markerNavigation.registerProvider(this);
|
|
20
|
+
}
|
|
21
|
+
dispose() {
|
|
22
|
+
this._dispoables.dispose();
|
|
23
|
+
}
|
|
24
|
+
getMarkerList(resource) {
|
|
25
|
+
if (!resource) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
const data = CellUri.parse(resource);
|
|
29
|
+
if (!data) {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
return ( new MarkerList(uri => {
|
|
33
|
+
const otherData = CellUri.parse(uri);
|
|
34
|
+
return otherData?.notebook.toString() === ( data.notebook.toString());
|
|
35
|
+
}, this._markerService, this._configService));
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
MarkerListProvider = ( __decorate([
|
|
39
|
+
( __param(0, IMarkerService)),
|
|
40
|
+
( __param(1, IMarkerNavigationService)),
|
|
41
|
+
( __param(2, IConfigurationService))
|
|
42
|
+
], MarkerListProvider));
|
|
43
|
+
let NotebookMarkerDecorationContribution = class NotebookMarkerDecorationContribution extends Disposable {
|
|
44
|
+
static { this.id = 'workbench.notebook.markerDecoration'; }
|
|
45
|
+
constructor(_notebookEditor, _markerService) {
|
|
46
|
+
super();
|
|
47
|
+
this._notebookEditor = _notebookEditor;
|
|
48
|
+
this._markerService = _markerService;
|
|
49
|
+
this._markersOverviewRulerDecorations = [];
|
|
50
|
+
this._update();
|
|
51
|
+
this._register(this._notebookEditor.onDidChangeModel(() => this._update()));
|
|
52
|
+
this._register(this._markerService.onMarkerChanged(e => {
|
|
53
|
+
if (( e.some(uri => ( this._notebookEditor.getCellsInRange().some(cell => isEqual(cell.uri, uri)))))) {
|
|
54
|
+
this._update();
|
|
55
|
+
}
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
_update() {
|
|
59
|
+
if (!this._notebookEditor.hasModel()) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const cellDecorations = [];
|
|
63
|
+
this._notebookEditor.getCellsInRange().forEach(cell => {
|
|
64
|
+
const marker = this._markerService.read({ resource: cell.uri, severities: MarkerSeverity.Error | MarkerSeverity.Warning });
|
|
65
|
+
marker.forEach(m => {
|
|
66
|
+
const color = m.severity === MarkerSeverity.Error ? editorErrorForeground : editorWarningForeground;
|
|
67
|
+
const range = { startLineNumber: m.startLineNumber, startColumn: m.startColumn, endLineNumber: m.endLineNumber, endColumn: m.endColumn };
|
|
68
|
+
cellDecorations.push({
|
|
69
|
+
handle: cell.handle,
|
|
70
|
+
options: {
|
|
71
|
+
overviewRuler: {
|
|
72
|
+
color: color,
|
|
73
|
+
modelRanges: [range],
|
|
74
|
+
includeOutput: false,
|
|
75
|
+
position: NotebookOverviewRulerLane.Right
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
this._markersOverviewRulerDecorations = this._notebookEditor.deltaCellDecorations(this._markersOverviewRulerDecorations, cellDecorations);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
NotebookMarkerDecorationContribution.__decorator = ( __decorate([
|
|
85
|
+
throttle(100)
|
|
86
|
+
], NotebookMarkerDecorationContribution.prototype, "_update", null));
|
|
87
|
+
NotebookMarkerDecorationContribution = ( __decorate([
|
|
88
|
+
( __param(1, IMarkerService))
|
|
89
|
+
], NotebookMarkerDecorationContribution));
|
|
90
|
+
( Registry
|
|
91
|
+
.as(Extensions.Workbench))
|
|
92
|
+
.registerWorkbenchContribution(MarkerListProvider, 2 );
|
|
93
|
+
registerNotebookContribution(NotebookMarkerDecorationContribution.id, NotebookMarkerDecorationContribution);
|