@codingame/monaco-vscode-notebook-service-override 37.1.0 → 37.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +7 -2
- package/package.json +3 -3
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebook.d.ts +22 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebook.js +210 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocuments.d.ts +24 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocuments.js +140 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocumentsAndEditors.d.ts +29 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocumentsAndEditors.js +194 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookEditors.d.ts +27 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookEditors.js +149 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookKernels.d.ts +49 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookKernels.js +372 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookRenderers.d.ts +10 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookRenderers.js +26 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.d.ts +9 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.js +43 -0
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +9 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +24 -24
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticsActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +5 -5
- 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 +19 -19
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +7 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +9 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +6 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +9 -9
- 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 +32 -19
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookSelectionHighlight.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +13 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookInlineVariables.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +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 +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +14 -14
- 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 +30 -30
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +5 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +11 -14
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.js +38 -38
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +30 -26
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +21 -21
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/notebookIndentationActions.js +11 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +12 -12
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/variablesActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +24 -24
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.js +7 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +68 -68
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityHelp.js +10 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +35 -35
- package/vscode/src/vs/workbench/contrib/notebook/browser/outputEditor/notebookOutputEditor.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/outputEditor/notebookOutputEditorInput.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/replEditorAccessibleView.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookCellStatusBarServiceImpl.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +8 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +7 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +15 -12
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +9 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +8 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +26 -26
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModel.d.ts +87 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModel.js +352 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookWebWorker.js +44 -18
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/repl.contribution.js +5 -5
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorAccessibilityHelp.js +14 -14
- package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +2 -2
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +12 -12
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +5 -5
|
@@ -26,7 +26,7 @@ import { Extensions } from '@codingame/monaco-vscode-api/vscode/vs/workbench/com
|
|
|
26
26
|
import { SaveReason } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor';
|
|
27
27
|
import { getNotebookEditorFromEditorPane } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
|
|
28
28
|
import { NotebookSetting, CellKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
29
|
-
import { NotebookFileWorkingCopyModel } from '
|
|
29
|
+
import { NotebookFileWorkingCopyModel } from '../../../common/notebookEditorModel.js';
|
|
30
30
|
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
31
31
|
import { LifecyclePhase } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle';
|
|
32
32
|
import { IWorkingCopyFileService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/workingCopy/common/workingCopyFileService.service';
|
|
@@ -73,7 +73,7 @@ let FormatOnSaveParticipant = class FormatOnSaveParticipant {
|
|
|
73
73
|
return undefined;
|
|
74
74
|
}
|
|
75
75
|
progress.report({
|
|
76
|
-
message: ( localize(
|
|
76
|
+
message: ( localize(16593, "Formatting"))
|
|
77
77
|
});
|
|
78
78
|
const notebook = workingCopy.model.notebookModel;
|
|
79
79
|
const formatApplied = await this.instantiationService.invokeFunction(
|
|
@@ -85,7 +85,7 @@ let FormatOnSaveParticipant = class FormatOnSaveParticipant {
|
|
|
85
85
|
const disposable = ( new DisposableStore());
|
|
86
86
|
try {
|
|
87
87
|
if (!formatApplied) {
|
|
88
|
-
const allCellEdits = await Promise.all(
|
|
88
|
+
const allCellEdits = await Promise.all(notebook.cells.map(async cell => {
|
|
89
89
|
const ref = await this.textModelService.createModelReference(cell.uri);
|
|
90
90
|
disposable.add(ref);
|
|
91
91
|
const model = ref.object.textEditorModel;
|
|
@@ -98,13 +98,13 @@ let FormatOnSaveParticipant = class FormatOnSaveParticipant {
|
|
|
98
98
|
);
|
|
99
99
|
const edits = [];
|
|
100
100
|
if (formatEdits) {
|
|
101
|
-
edits.push(...
|
|
101
|
+
edits.push(...formatEdits.map(edit => ( new ResourceTextEdit(model.uri, edit, model.getVersionId()))));
|
|
102
102
|
return edits;
|
|
103
103
|
}
|
|
104
104
|
return [];
|
|
105
|
-
}))
|
|
105
|
+
}));
|
|
106
106
|
await this.bulkEditService.apply( allCellEdits.flat(), {
|
|
107
|
-
label: ( localize(
|
|
107
|
+
label: ( localize(16594, "Format Notebook")),
|
|
108
108
|
code: "undoredo.formatNotebook"
|
|
109
109
|
});
|
|
110
110
|
}
|
|
@@ -147,7 +147,7 @@ let TrimWhitespaceParticipant = class TrimWhitespaceParticipant extends Notebook
|
|
|
147
147
|
let cursors = [];
|
|
148
148
|
let prevSelection = [];
|
|
149
149
|
try {
|
|
150
|
-
const allCellEdits = await Promise.all(
|
|
150
|
+
const allCellEdits = await Promise.all(notebook.cells.map(async cell => {
|
|
151
151
|
if (cell.cellKind !== CellKind.Code) {
|
|
152
152
|
return [];
|
|
153
153
|
}
|
|
@@ -158,7 +158,7 @@ let TrimWhitespaceParticipant = class TrimWhitespaceParticipant extends Notebook
|
|
|
158
158
|
if (isActiveCell) {
|
|
159
159
|
prevSelection = activeCellEditor.getSelections() ?? [];
|
|
160
160
|
if (isAutoSaved) {
|
|
161
|
-
cursors =
|
|
161
|
+
cursors = prevSelection.map(s => s.getPosition());
|
|
162
162
|
const snippetsRange = SnippetController2.get(activeCellEditor)?.getSessionEnclosingRange();
|
|
163
163
|
if (snippetsRange) {
|
|
164
164
|
for (let lineNumber = snippetsRange.startLineNumber; lineNumber <= snippetsRange.endLineNumber; lineNumber++) {
|
|
@@ -171,14 +171,14 @@ let TrimWhitespaceParticipant = class TrimWhitespaceParticipant extends Notebook
|
|
|
171
171
|
if (!ops.length) {
|
|
172
172
|
return [];
|
|
173
173
|
}
|
|
174
|
-
return
|
|
174
|
+
return ops.map(op => ( new ResourceTextEdit(model.uri, {
|
|
175
175
|
...op,
|
|
176
176
|
text: op.text || ""
|
|
177
|
-
}, model.getVersionId())))
|
|
178
|
-
}))
|
|
177
|
+
}, model.getVersionId())));
|
|
178
|
+
}));
|
|
179
179
|
const filteredEdits = allCellEdits.flat().filter(edit => edit !== undefined);
|
|
180
180
|
await this.bulkEditService.apply(filteredEdits, {
|
|
181
|
-
label: ( localize(
|
|
181
|
+
label: ( localize(16595, "Notebook Trim Trailing Whitespace")),
|
|
182
182
|
code: "undoredo.notebookTrimTrailingWhitespace"
|
|
183
183
|
});
|
|
184
184
|
} finally {
|
|
@@ -219,7 +219,7 @@ let TrimFinalNewLinesParticipant = class TrimFinalNewLinesParticipant extends No
|
|
|
219
219
|
const notebook = workingCopy.model.notebookModel;
|
|
220
220
|
const activeCellEditor = getActiveCellCodeEditor(this.editorService);
|
|
221
221
|
try {
|
|
222
|
-
const allCellEdits = await Promise.all(
|
|
222
|
+
const allCellEdits = await Promise.all(notebook.cells.map(async cell => {
|
|
223
223
|
if (cell.cellKind !== CellKind.Code) {
|
|
224
224
|
return;
|
|
225
225
|
}
|
|
@@ -250,10 +250,10 @@ let TrimFinalNewLinesParticipant = class TrimFinalNewLinesParticipant extends No
|
|
|
250
250
|
range: deletionRange,
|
|
251
251
|
text: ""
|
|
252
252
|
}, cell.textModel?.getVersionId()));
|
|
253
|
-
}))
|
|
253
|
+
}));
|
|
254
254
|
const filteredEdits = allCellEdits.flat().filter(edit => edit !== undefined);
|
|
255
255
|
await this.bulkEditService.apply(filteredEdits, {
|
|
256
|
-
label: ( localize(
|
|
256
|
+
label: ( localize(16596, "Trim Final New Lines")),
|
|
257
257
|
code: "undoredo.trimFinalNewLines"
|
|
258
258
|
});
|
|
259
259
|
} finally {
|
|
@@ -289,7 +289,7 @@ let InsertFinalNewLineParticipant = class InsertFinalNewLineParticipant extends
|
|
|
289
289
|
selections = activeCellEditor.getSelections() ?? [];
|
|
290
290
|
}
|
|
291
291
|
try {
|
|
292
|
-
const allCellEdits = await Promise.all(
|
|
292
|
+
const allCellEdits = await Promise.all(notebook.cells.map(async cell => {
|
|
293
293
|
if (cell.cellKind !== CellKind.Code) {
|
|
294
294
|
return;
|
|
295
295
|
}
|
|
@@ -307,10 +307,10 @@ let InsertFinalNewLineParticipant = class InsertFinalNewLineParticipant extends
|
|
|
307
307
|
)),
|
|
308
308
|
text: cell.textBuffer.getEOL()
|
|
309
309
|
}, cell.textModel?.getVersionId()));
|
|
310
|
-
}))
|
|
310
|
+
}));
|
|
311
311
|
const filteredEdits = allCellEdits.filter(edit => edit !== undefined);
|
|
312
312
|
await this.bulkEditService.apply(filteredEdits, {
|
|
313
|
-
label: ( localize(
|
|
313
|
+
label: ( localize(16597, "Insert Final New Line")),
|
|
314
314
|
code: "undoredo.insertFinalNewLine"
|
|
315
315
|
});
|
|
316
316
|
if (activeCellEditor && selections) {
|
|
@@ -366,7 +366,7 @@ let CodeActionOnSaveParticipant = class CodeActionOnSaveParticipant {
|
|
|
366
366
|
if (notebookCodeActionsOnSave.length) {
|
|
367
367
|
const nbDisposable = ( new DisposableStore());
|
|
368
368
|
progress.report({
|
|
369
|
-
message: ( localize(
|
|
369
|
+
message: ( localize(16598, "Running 'Notebook' code actions"))
|
|
370
370
|
});
|
|
371
371
|
try {
|
|
372
372
|
const cell = notebookModel.cells[0];
|
|
@@ -407,10 +407,10 @@ let CodeActionOnSaveParticipant = class CodeActionOnSaveParticipant {
|
|
|
407
407
|
}
|
|
408
408
|
const cellDisposable = ( new DisposableStore());
|
|
409
409
|
progress.report({
|
|
410
|
-
message: ( localize(
|
|
410
|
+
message: ( localize(16599, "Running 'Cell' code actions"))
|
|
411
411
|
});
|
|
412
412
|
try {
|
|
413
|
-
await Promise.all(
|
|
413
|
+
await Promise.all(notebookModel.cells.map(async cell => {
|
|
414
414
|
const ref = await this.textModelService.createModelReference(cell.uri);
|
|
415
415
|
cellDisposable.add(ref);
|
|
416
416
|
const textEditorModel = ref.object.textEditorModel;
|
|
@@ -422,7 +422,7 @@ let CodeActionOnSaveParticipant = class CodeActionOnSaveParticipant {
|
|
|
422
422
|
progress,
|
|
423
423
|
token
|
|
424
424
|
);
|
|
425
|
-
}))
|
|
425
|
+
}));
|
|
426
426
|
} catch {
|
|
427
427
|
this.logService.error("Failed to apply code action on save");
|
|
428
428
|
} finally {
|
|
@@ -434,7 +434,7 @@ let CodeActionOnSaveParticipant = class CodeActionOnSaveParticipant {
|
|
|
434
434
|
}
|
|
435
435
|
}
|
|
436
436
|
createCodeActionsOnSave(settingItems) {
|
|
437
|
-
const kinds =
|
|
437
|
+
const kinds = settingItems.map(x => ( new HierarchicalKind(x)));
|
|
438
438
|
return kinds.filter(kind => {
|
|
439
439
|
return kinds.every(otherKind => otherKind.equals(kind) || !otherKind.contains(kind));
|
|
440
440
|
});
|
|
@@ -450,7 +450,7 @@ class CodeActionParticipantUtils {
|
|
|
450
450
|
const formatDisposable = ( new DisposableStore());
|
|
451
451
|
let formatResult = false;
|
|
452
452
|
progress.report({
|
|
453
|
-
message: ( localize(
|
|
453
|
+
message: ( localize(16600, "Running 'Format' code actions"))
|
|
454
454
|
});
|
|
455
455
|
try {
|
|
456
456
|
const cell = notebookModel.cells[0];
|
|
@@ -488,9 +488,9 @@ class CodeActionParticipantUtils {
|
|
|
488
488
|
_report() {
|
|
489
489
|
progress.report({
|
|
490
490
|
message: ( localize(
|
|
491
|
-
|
|
491
|
+
16601,
|
|
492
492
|
"Getting code actions from '{0}' ([configure]({1})).",
|
|
493
|
-
|
|
493
|
+
[...this._names].map(name => `'${name}'`).join(", "),
|
|
494
494
|
"command:workbench.action.openSettings?%5B%22notebook.codeActionsOnSave%22%5D"
|
|
495
495
|
))
|
|
496
496
|
});
|
|
@@ -535,7 +535,7 @@ class CodeActionParticipantUtils {
|
|
|
535
535
|
continue;
|
|
536
536
|
}
|
|
537
537
|
progress.report({
|
|
538
|
-
message: ( localize(
|
|
538
|
+
message: ( localize(16602, "Applying code action '{0}'.", action.action.title))
|
|
539
539
|
});
|
|
540
540
|
await instantiationService.invokeFunction(applyCodeAction, action, ApplyCodeActionReason.OnSave, {}, token);
|
|
541
541
|
if (token.isCancellationRequested) {
|
|
@@ -566,9 +566,9 @@ class CodeActionParticipantUtils {
|
|
|
566
566
|
_report() {
|
|
567
567
|
progress.report({
|
|
568
568
|
message: ( localize(
|
|
569
|
-
|
|
569
|
+
16601,
|
|
570
570
|
"Getting code actions from '{0}' ([configure]({1})).",
|
|
571
|
-
|
|
571
|
+
[...this._names].map(name => `'${name}'`).join(", "),
|
|
572
572
|
"command:workbench.action.openSettings?%5B%22notebook.defaultFormatter%22%5D"
|
|
573
573
|
))
|
|
574
574
|
});
|
|
@@ -603,7 +603,7 @@ class CodeActionParticipantUtils {
|
|
|
603
603
|
return false;
|
|
604
604
|
}
|
|
605
605
|
progress.report({
|
|
606
|
-
message: ( localize(
|
|
606
|
+
message: ( localize(16602, "Applying code action '{0}'.", action.action.title))
|
|
607
607
|
});
|
|
608
608
|
await instantiationService.invokeFunction(applyCodeAction, action, ApplyCodeActionReason.OnSave, {}, token);
|
|
609
609
|
if (token.isCancellationRequested) {
|
|
@@ -232,13 +232,13 @@ class TroubleshootController extends Disposable {
|
|
|
232
232
|
this._localStore.add(this._notebookEditor.onDidChangeViewCells(e => {
|
|
233
233
|
[...e.splices].reverse().forEach(splice => {
|
|
234
234
|
const [start, deleted, newCells] = splice;
|
|
235
|
-
const deletedCells = this._cellDisposables.splice(start, deleted, ...
|
|
235
|
+
const deletedCells = this._cellDisposables.splice(start, deleted, ...newCells.map(cell => {
|
|
236
236
|
const disposableStore = ( new DisposableStore());
|
|
237
237
|
disposableStore.add(cell.onDidChangeLayout(e => {
|
|
238
238
|
this._log(cell, e);
|
|
239
239
|
}));
|
|
240
240
|
return disposableStore;
|
|
241
|
-
}))
|
|
241
|
+
}));
|
|
242
242
|
dispose(deletedCells);
|
|
243
243
|
});
|
|
244
244
|
const addedCells = e.splices.reduce((acc, [,, newCells]) => [...acc, ...newCells], []);
|
|
@@ -282,7 +282,7 @@ registerAction2(class extends Action2 {
|
|
|
282
282
|
constructor() {
|
|
283
283
|
super({
|
|
284
284
|
id: "notebook.toggleLayoutTroubleshoot",
|
|
285
|
-
title: ( localize2(
|
|
285
|
+
title: ( localize2(16603, "Toggle Notebook Layout Troubleshoot")),
|
|
286
286
|
category: Categories.Developer,
|
|
287
287
|
f1: true
|
|
288
288
|
});
|
|
@@ -301,7 +301,7 @@ registerAction2(class extends Action2 {
|
|
|
301
301
|
constructor() {
|
|
302
302
|
super({
|
|
303
303
|
id: "notebook.inspectLayout",
|
|
304
|
-
title: ( localize2(
|
|
304
|
+
title: ( localize2(16604, "Inspect Notebook Layout")),
|
|
305
305
|
category: Categories.Developer,
|
|
306
306
|
f1: true
|
|
307
307
|
});
|
|
@@ -322,7 +322,7 @@ registerAction2(class extends Action2 {
|
|
|
322
322
|
constructor() {
|
|
323
323
|
super({
|
|
324
324
|
id: "notebook.clearNotebookEdtitorTypeCache",
|
|
325
|
-
title: ( localize2(
|
|
325
|
+
title: ( localize2(16605, "Clear Notebook Editor Type Cache")),
|
|
326
326
|
category: Categories.Developer,
|
|
327
327
|
f1: true
|
|
328
328
|
});
|
|
@@ -6,12 +6,12 @@ import { isDocumentExcludePattern } from '@codingame/monaco-vscode-api/vscode/vs
|
|
|
6
6
|
import { INotebookKernelService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookKernelService.service';
|
|
7
7
|
import { INotebookService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookService.service';
|
|
8
8
|
|
|
9
|
-
CommandsRegistry.registerCommand(
|
|
9
|
+
CommandsRegistry.registerCommand('_resolveNotebookContentProvider', (accessor) => {
|
|
10
10
|
const notebookService = accessor.get(INotebookService);
|
|
11
11
|
const contentProviders = notebookService.getContributedNotebookTypes();
|
|
12
|
-
return
|
|
13
|
-
const filenamePatterns =
|
|
14
|
-
if (typeof selector ===
|
|
12
|
+
return contentProviders.map(provider => {
|
|
13
|
+
const filenamePatterns = provider.selectors.map(selector => {
|
|
14
|
+
if (typeof selector === 'string') {
|
|
15
15
|
return selector;
|
|
16
16
|
}
|
|
17
17
|
if (isRelativePattern(selector)) {
|
|
@@ -24,7 +24,7 @@ CommandsRegistry.registerCommand("_resolveNotebookContentProvider", accessor =>
|
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
return null;
|
|
27
|
-
})
|
|
27
|
+
}).filter(pattern => pattern !== null);
|
|
28
28
|
return {
|
|
29
29
|
viewType: provider.id,
|
|
30
30
|
displayName: provider.displayName,
|
|
@@ -35,21 +35,18 @@ CommandsRegistry.registerCommand("_resolveNotebookContentProvider", accessor =>
|
|
|
35
35
|
transientOutputs: provider.options.transientOutputs
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
-
})
|
|
38
|
+
});
|
|
39
39
|
});
|
|
40
|
-
CommandsRegistry.registerCommand(
|
|
40
|
+
CommandsRegistry.registerCommand('_resolveNotebookKernels', async (accessor, args) => {
|
|
41
41
|
const notebookKernelService = accessor.get(INotebookKernelService);
|
|
42
42
|
const uri = URI.revive(args.uri);
|
|
43
|
-
const kernels = notebookKernelService.getMatchingKernel({
|
|
44
|
-
|
|
45
|
-
notebookType: args.viewType
|
|
46
|
-
});
|
|
47
|
-
return ( kernels.all.map(provider => ({
|
|
43
|
+
const kernels = notebookKernelService.getMatchingKernel({ uri, notebookType: args.viewType });
|
|
44
|
+
return kernels.all.map(provider => ({
|
|
48
45
|
id: provider.id,
|
|
49
46
|
label: provider.label,
|
|
50
47
|
description: provider.description,
|
|
51
48
|
detail: provider.detail,
|
|
52
49
|
isPreferred: false,
|
|
53
|
-
preloads: provider.preloadUris
|
|
54
|
-
}))
|
|
50
|
+
preloads: provider.preloadUris,
|
|
51
|
+
}));
|
|
55
52
|
});
|
|
@@ -22,8 +22,8 @@ import { KeybindingWeight } from '@codingame/monaco-vscode-api/vscode/vs/platfor
|
|
|
22
22
|
import { INotificationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification.service';
|
|
23
23
|
import { IQuickInputService } from '@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickInput.service';
|
|
24
24
|
import { InlineChatController } from '@codingame/monaco-vscode-katex-common/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatController';
|
|
25
|
-
import { CTX_INLINE_CHAT_FOCUSED } from '@codingame/monaco-vscode-
|
|
26
|
-
import { runDeleteAction, changeCellToKind } from '@codingame/monaco-vscode-
|
|
25
|
+
import { CTX_INLINE_CHAT_FOCUSED } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/inlineChat/common/inlineChat';
|
|
26
|
+
import { runDeleteAction, changeCellToKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/controller/cellOperations';
|
|
27
27
|
import { NotebookCellAction, CELL_TITLE_CELL_GROUP_ID, CellToolbarOrder, findTargetCellEditor, NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT, NotebookAction, CELL_TITLE_OUTPUT_GROUP_ID, executeNotebookCondition, NotebookMultiCellAction } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/controller/coreActions';
|
|
28
28
|
import { NotebookIndentUsingTabs, NotebookIndentUsingSpaces, NotebookChangeTabDisplaySize, NotebookIndentationToTabsAction, NotebookIndentationToSpacesAction } from './notebookIndentationActions.js';
|
|
29
29
|
import { QUIT_EDIT_CELL_COMMAND_ID, CellEditState, CHANGE_CELL_LANGUAGE, DETECT_CELL_LANGUAGE, getNotebookEditorFromEditorPane } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
|
|
@@ -47,7 +47,7 @@ registerAction2(class EditCellAction extends NotebookCellAction {
|
|
|
47
47
|
constructor() {
|
|
48
48
|
super({
|
|
49
49
|
id: EDIT_CELL_COMMAND_ID,
|
|
50
|
-
title: ( localize(
|
|
50
|
+
title: ( localize(16632, "Edit Cell")),
|
|
51
51
|
keybinding: {
|
|
52
52
|
when: ( ContextKeyExpr.and(
|
|
53
53
|
NOTEBOOK_CELL_LIST_FOCUSED,
|
|
@@ -83,7 +83,7 @@ registerAction2(class QuitEditCellAction extends NotebookCellAction {
|
|
|
83
83
|
constructor() {
|
|
84
84
|
super({
|
|
85
85
|
id: QUIT_EDIT_CELL_COMMAND_ID,
|
|
86
|
-
title: ( localize(
|
|
86
|
+
title: ( localize(16633, "Stop Editing Cell")),
|
|
87
87
|
menu: {
|
|
88
88
|
id: MenuId.NotebookCellTitle,
|
|
89
89
|
when: ( ContextKeyExpr.and(( NOTEBOOK_CELL_TYPE.isEqualTo("markup")), NOTEBOOK_CELL_MARKDOWN_EDIT_MODE, NOTEBOOK_CELL_EDITABLE)),
|
|
@@ -122,7 +122,7 @@ registerAction2(class QuitEditAllCellsAction extends NotebookAction {
|
|
|
122
122
|
constructor() {
|
|
123
123
|
super({
|
|
124
124
|
id: QUIT_EDIT_ALL_CELLS_COMMAND_ID,
|
|
125
|
-
title: ( localize(
|
|
125
|
+
title: ( localize(16634, "Stop Editing All Cells"))
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
128
|
async runWithContext(accessor, context) {
|
|
@@ -151,7 +151,7 @@ registerAction2(class DeleteCellAction extends NotebookCellAction {
|
|
|
151
151
|
constructor() {
|
|
152
152
|
super({
|
|
153
153
|
id: DELETE_CELL_COMMAND_ID,
|
|
154
|
-
title: ( localize(
|
|
154
|
+
title: ( localize(16635, "Delete Cell")),
|
|
155
155
|
keybinding: {
|
|
156
156
|
primary: KeyCode.Delete,
|
|
157
157
|
mac: {
|
|
@@ -185,13 +185,13 @@ registerAction2(class DeleteCellAction extends NotebookCellAction {
|
|
|
185
185
|
const configService = accessor.get(IConfigurationService);
|
|
186
186
|
if (runState === NotebookCellExecutionState.Executing && configService.getValue(NotebookSetting.confirmDeleteRunningCell)) {
|
|
187
187
|
const dialogService = accessor.get(IDialogService);
|
|
188
|
-
const primaryButton = ( localize(
|
|
188
|
+
const primaryButton = ( localize(16636, "Delete"));
|
|
189
189
|
confirmation = await dialogService.confirm({
|
|
190
190
|
type: "question",
|
|
191
|
-
message: ( localize(
|
|
191
|
+
message: ( localize(16637, "This cell is running, are you sure you want to delete it?")),
|
|
192
192
|
primaryButton: primaryButton,
|
|
193
193
|
checkbox: {
|
|
194
|
-
label: ( localize(
|
|
194
|
+
label: ( localize(16638, "Do not ask me again"))
|
|
195
195
|
}
|
|
196
196
|
});
|
|
197
197
|
} else {
|
|
@@ -212,7 +212,7 @@ registerAction2(class ClearCellOutputsAction extends NotebookCellAction {
|
|
|
212
212
|
constructor() {
|
|
213
213
|
super({
|
|
214
214
|
id: CLEAR_CELL_OUTPUTS_COMMAND_ID,
|
|
215
|
-
title: ( localize(
|
|
215
|
+
title: ( localize(16639, "Clear Cell Outputs")),
|
|
216
216
|
menu: [{
|
|
217
217
|
id: MenuId.NotebookCellTitle,
|
|
218
218
|
when: ( ContextKeyExpr.and(( NOTEBOOK_CELL_TYPE.isEqualTo("code")), executeNotebookCondition, NOTEBOOK_CELL_HAS_OUTPUTS, NOTEBOOK_EDITOR_EDITABLE, NOTEBOOK_CELL_EDITABLE, ( NOTEBOOK_USE_CONSOLIDATED_OUTPUT_BUTTON.toNegated()))),
|
|
@@ -279,7 +279,7 @@ registerAction2(class ClearAllCellOutputsAction extends NotebookAction {
|
|
|
279
279
|
constructor() {
|
|
280
280
|
super({
|
|
281
281
|
id: CLEAR_ALL_CELLS_OUTPUTS_COMMAND_ID,
|
|
282
|
-
title: ( localize(
|
|
282
|
+
title: ( localize(16640, "Clear All Outputs")),
|
|
283
283
|
precondition: NOTEBOOK_HAS_OUTPUTS,
|
|
284
284
|
menu: [{
|
|
285
285
|
id: MenuId.EditorTitle,
|
|
@@ -302,12 +302,12 @@ registerAction2(class ClearAllCellOutputsAction extends NotebookAction {
|
|
|
302
302
|
return;
|
|
303
303
|
}
|
|
304
304
|
const computeUndoRedo = !editor.isReadOnly;
|
|
305
|
-
editor.textModel.applyEdits(
|
|
305
|
+
editor.textModel.applyEdits(editor.textModel.cells.map((cell, index) => ({
|
|
306
306
|
editType: CellEditType.Output,
|
|
307
307
|
index,
|
|
308
308
|
outputs: []
|
|
309
|
-
}))
|
|
310
|
-
const clearExecutionMetadataEdits =
|
|
309
|
+
})), true, undefined, () => undefined, undefined, computeUndoRedo);
|
|
310
|
+
const clearExecutionMetadataEdits = editor.textModel.cells.map((cell, index) => {
|
|
311
311
|
const runState = notebookExecutionStateService.getCellExecution(cell.uri)?.state;
|
|
312
312
|
if (runState !== NotebookCellExecutionState.Executing) {
|
|
313
313
|
return {
|
|
@@ -324,7 +324,7 @@ registerAction2(class ClearAllCellOutputsAction extends NotebookAction {
|
|
|
324
324
|
} else {
|
|
325
325
|
return undefined;
|
|
326
326
|
}
|
|
327
|
-
})
|
|
327
|
+
}).filter(edit => !!edit);
|
|
328
328
|
if (clearExecutionMetadataEdits.length) {
|
|
329
329
|
context.notebookEditor.textModel.applyEdits(
|
|
330
330
|
clearExecutionMetadataEdits,
|
|
@@ -343,14 +343,14 @@ registerAction2(class ChangeCellLanguageAction extends NotebookCellAction {
|
|
|
343
343
|
constructor() {
|
|
344
344
|
super({
|
|
345
345
|
id: CHANGE_CELL_LANGUAGE,
|
|
346
|
-
title: ( localize(
|
|
346
|
+
title: ( localize(16641, "Change Cell Language")),
|
|
347
347
|
keybinding: {
|
|
348
348
|
weight: KeybindingWeight.WorkbenchContrib,
|
|
349
349
|
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KeyK, KeyCode.KeyM),
|
|
350
350
|
when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, NOTEBOOK_EDITOR_EDITABLE, NOTEBOOK_CELL_EDITABLE))
|
|
351
351
|
},
|
|
352
352
|
metadata: {
|
|
353
|
-
description: ( localize(
|
|
353
|
+
description: ( localize(16641, "Change Cell Language")),
|
|
354
354
|
args: [{
|
|
355
355
|
name: "range",
|
|
356
356
|
description: "The cell range",
|
|
@@ -416,9 +416,9 @@ registerAction2(class ChangeCellLanguageAction extends NotebookCellAction {
|
|
|
416
416
|
providerLanguages.forEach(languageId => {
|
|
417
417
|
let description;
|
|
418
418
|
if (context.cell.cellKind === CellKind.Markup ? (languageId === "markdown") : (languageId === context.cell.language)) {
|
|
419
|
-
description = ( localize(
|
|
419
|
+
description = ( localize(16642, "({0}) - Current Language", languageId));
|
|
420
420
|
} else {
|
|
421
|
-
description = ( localize(
|
|
421
|
+
description = ( localize(16643, "({0})", languageId));
|
|
422
422
|
}
|
|
423
423
|
const languageName = languageService.getLanguageName(languageId);
|
|
424
424
|
if (!languageName) {
|
|
@@ -444,16 +444,16 @@ registerAction2(class ChangeCellLanguageAction extends NotebookCellAction {
|
|
|
444
444
|
return a.description.localeCompare(b.description);
|
|
445
445
|
});
|
|
446
446
|
const autoDetectMode = {
|
|
447
|
-
label: ( localize(
|
|
447
|
+
label: ( localize(16644, "Auto Detect"))
|
|
448
448
|
};
|
|
449
449
|
const picks = [autoDetectMode, {
|
|
450
450
|
type: "separator",
|
|
451
|
-
label: ( localize(
|
|
451
|
+
label: ( localize(16645, "languages (identifier)"))
|
|
452
452
|
}, ...topItems, {
|
|
453
453
|
type: "separator"
|
|
454
454
|
}, ...mainItems];
|
|
455
455
|
const selection = await quickInputService.pick(picks, {
|
|
456
|
-
placeHolder: ( localize(
|
|
456
|
+
placeHolder: ( localize(16646, "Select Language Mode"))
|
|
457
457
|
});
|
|
458
458
|
const languageId = selection === autoDetectMode ? await languageDetectionService.detectLanguage(context.cell.uri) : selection?.languageId;
|
|
459
459
|
if (languageId) {
|
|
@@ -484,7 +484,7 @@ registerAction2(class DetectCellLanguageAction extends NotebookCellAction {
|
|
|
484
484
|
constructor() {
|
|
485
485
|
super({
|
|
486
486
|
id: DETECT_CELL_LANGUAGE,
|
|
487
|
-
title: ( localize2(
|
|
487
|
+
title: ( localize2(16647, "Accept Detected Language for Cell")),
|
|
488
488
|
f1: true,
|
|
489
489
|
precondition: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_EDITABLE, NOTEBOOK_CELL_EDITABLE)),
|
|
490
490
|
keybinding: {
|
|
@@ -504,7 +504,7 @@ registerAction2(class DetectCellLanguageAction extends NotebookCellAction {
|
|
|
504
504
|
if (detection) {
|
|
505
505
|
setCellToLanguage(detection, context);
|
|
506
506
|
} else {
|
|
507
|
-
notificationService.warn(( localize(
|
|
507
|
+
notificationService.warn(( localize(16648, "Unable to detect cell language")));
|
|
508
508
|
}
|
|
509
509
|
}
|
|
510
510
|
});
|
|
@@ -539,7 +539,7 @@ registerAction2(class SelectNotebookIndentation extends NotebookAction {
|
|
|
539
539
|
constructor() {
|
|
540
540
|
super({
|
|
541
541
|
id: SELECT_NOTEBOOK_INDENTATION_ID,
|
|
542
|
-
title: ( localize2(
|
|
542
|
+
title: ( localize2(16649, "Select Indentation")),
|
|
543
543
|
f1: true,
|
|
544
544
|
precondition: ( ContextKeyExpr.and(
|
|
545
545
|
NOTEBOOK_IS_ACTIVE_EDITOR,
|
|
@@ -558,15 +558,15 @@ registerAction2(class SelectNotebookIndentation extends NotebookAction {
|
|
|
558
558
|
const activeNotebook = getNotebookEditorFromEditorPane(editorService.activeEditorPane);
|
|
559
559
|
if (!activeNotebook || activeNotebook.isDisposed) {
|
|
560
560
|
return quickInputService.pick([{
|
|
561
|
-
label: ( localize(
|
|
561
|
+
label: ( localize(16650, "No notebook editor active at this time"))
|
|
562
562
|
}]);
|
|
563
563
|
}
|
|
564
564
|
if (activeNotebook.isReadOnly) {
|
|
565
565
|
return quickInputService.pick([{
|
|
566
|
-
label: ( localize(
|
|
566
|
+
label: ( localize(16651, "The active notebook editor is read-only."))
|
|
567
567
|
}]);
|
|
568
568
|
}
|
|
569
|
-
const picks =
|
|
569
|
+
const picks = [(
|
|
570
570
|
new NotebookIndentUsingTabs()), (
|
|
571
571
|
new NotebookIndentUsingSpaces()), (
|
|
572
572
|
new NotebookChangeTabDisplaySize()), (
|
|
@@ -579,17 +579,17 @@ registerAction2(class SelectNotebookIndentation extends NotebookAction {
|
|
|
579
579
|
instantiationService.invokeFunction(item.run);
|
|
580
580
|
}
|
|
581
581
|
};
|
|
582
|
-
})
|
|
582
|
+
});
|
|
583
583
|
picks.splice(3, 0, {
|
|
584
584
|
type: "separator",
|
|
585
|
-
label: ( localize(
|
|
585
|
+
label: ( localize(16652, "convert file"))
|
|
586
586
|
});
|
|
587
587
|
picks.unshift({
|
|
588
588
|
type: "separator",
|
|
589
|
-
label: ( localize(
|
|
589
|
+
label: ( localize(16653, "change view"))
|
|
590
590
|
});
|
|
591
591
|
const action = await quickInputService.pick(picks, {
|
|
592
|
-
placeHolder: ( localize(
|
|
592
|
+
placeHolder: ( localize(16654, "Select Action")),
|
|
593
593
|
matchOnDetail: true
|
|
594
594
|
});
|
|
595
595
|
if (!action) {
|
|
@@ -604,7 +604,7 @@ registerAction2(class CommentSelectedCellsAction extends NotebookMultiCellAction
|
|
|
604
604
|
constructor() {
|
|
605
605
|
super({
|
|
606
606
|
id: COMMENT_SELECTED_CELLS_ID,
|
|
607
|
-
title: ( localize(
|
|
607
|
+
title: ( localize(16655, "Comment Selected Cells")),
|
|
608
608
|
keybinding: {
|
|
609
609
|
when: ( ContextKeyExpr.and(
|
|
610
610
|
NOTEBOOK_EDITOR_FOCUSED,
|
|
@@ -629,20 +629,20 @@ registerAction2(class CommentSelectedCellsAction extends NotebookMultiCellAction
|
|
|
629
629
|
textModel.getLineMaxColumn(textModel.getLineCount())
|
|
630
630
|
)), textModel.getOptions().tabSize, Type.Toggle, commentsOptions.insertSpace ?? true, commentsOptions.ignoreEmptyLines ?? true, false));
|
|
631
631
|
const cellEditorSelections = cellViewModel.getSelections();
|
|
632
|
-
const initialTrackedRangesIDs =
|
|
632
|
+
const initialTrackedRangesIDs = cellEditorSelections.map(selection => {
|
|
633
633
|
return textModel._setTrackedRange(null, selection, TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges);
|
|
634
|
-
})
|
|
634
|
+
});
|
|
635
635
|
CommandExecutor.executeCommands(textModel, cellEditorSelections, [cellCommentCommand]);
|
|
636
|
-
const newTrackedSelections =
|
|
636
|
+
const newTrackedSelections = initialTrackedRangesIDs.map(i => {
|
|
637
637
|
return textModel._getTrackedRange(i);
|
|
638
|
-
})
|
|
638
|
+
}).filter(r => !!r).map(range => {
|
|
639
639
|
return ( new Selection(
|
|
640
640
|
range.startLineNumber,
|
|
641
641
|
range.startColumn,
|
|
642
642
|
range.endLineNumber,
|
|
643
643
|
range.endColumn
|
|
644
644
|
));
|
|
645
|
-
})
|
|
645
|
+
});
|
|
646
646
|
cellViewModel.setSelections(newTrackedSelections ?? []);
|
|
647
647
|
});
|
|
648
648
|
}
|