@codingame/monaco-vscode-notebook-service-override 25.1.2 → 26.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +2 -2
- package/package.json +3 -3
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +112 -94
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +95 -96
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticEditorContrib.js +28 -19
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticsActions.js +15 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib.js +22 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +25 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +37 -44
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +211 -115
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +16 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +5 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +57 -49
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +24 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +78 -76
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +14 -15
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +43 -28
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +65 -34
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +19 -16
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +6 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +15 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +28 -16
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookMulticursor.js +211 -170
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookSelectionHighlight.js +11 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +158 -156
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookInlineVariables.js +109 -105
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +28 -22
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +26 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +23 -16
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +72 -40
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +233 -186
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +22 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +239 -151
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +85 -86
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +25 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +13 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +8 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.js +218 -196
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +258 -255
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +106 -98
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/notebookIndentationActions.js +63 -49
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +55 -64
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/variablesActions.js +21 -25
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +149 -129
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.d.ts +57 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.js +286 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.js +82 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +452 -363
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityHelp.js +44 -61
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibleView.js +9 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +203 -207
- package/vscode/src/vs/workbench/contrib/notebook/browser/outputEditor/notebookOutputEditor.js +148 -104
- package/vscode/src/vs/workbench/contrib/notebook/browser/outputEditor/notebookOutputEditorInput.js +19 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/replEditorAccessibleView.js +9 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookCellStatusBarServiceImpl.js +9 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +34 -22
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +29 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +70 -52
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +31 -19
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +78 -41
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +37 -27
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +9 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +8 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +214 -119
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +38 -36
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSource.js +24 -25
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSourceFactory.js +2 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.js +26 -15
- package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +35 -15
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +468 -258
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.d.ts +33 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +113 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +74 -58
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +7 -10
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookCellMatching.js +72 -16
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookWebWorker.js +70 -51
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/repl.contribution.js +195 -149
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorAccessibilityHelp.js +60 -81
- package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +7 -12
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +104 -66
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +115 -77
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +42 -26
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.js +19 -12
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.d.ts +0 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +0 -198
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.d.ts +0 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.js +0 -333
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.js +0 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +0 -261
|
@@ -23,7 +23,7 @@ import { INotificationService } from '@codingame/monaco-vscode-api/vscode/vs/pla
|
|
|
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
25
|
import { CTX_INLINE_CHAT_FOCUSED } from '@codingame/monaco-vscode-katex-common/vscode/vs/workbench/contrib/inlineChat/common/inlineChat';
|
|
26
|
-
import { runDeleteAction, changeCellToKind } from '@codingame/monaco-vscode-
|
|
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';
|
|
@@ -36,18 +36,18 @@ import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench
|
|
|
36
36
|
import { ILanguageDetectionService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/languageDetection/common/languageDetectionWorkerService.service';
|
|
37
37
|
import { NotebookInlineVariablesController } from '../contrib/notebookVariables/notebookInlineVariables.js';
|
|
38
38
|
|
|
39
|
-
const CLEAR_ALL_CELLS_OUTPUTS_COMMAND_ID =
|
|
40
|
-
const EDIT_CELL_COMMAND_ID =
|
|
41
|
-
const DELETE_CELL_COMMAND_ID =
|
|
42
|
-
const QUIT_EDIT_ALL_CELLS_COMMAND_ID =
|
|
43
|
-
const CLEAR_CELL_OUTPUTS_COMMAND_ID =
|
|
44
|
-
const SELECT_NOTEBOOK_INDENTATION_ID =
|
|
45
|
-
const COMMENT_SELECTED_CELLS_ID =
|
|
39
|
+
const CLEAR_ALL_CELLS_OUTPUTS_COMMAND_ID = "notebook.clearAllCellsOutputs";
|
|
40
|
+
const EDIT_CELL_COMMAND_ID = "notebook.cell.edit";
|
|
41
|
+
const DELETE_CELL_COMMAND_ID = "notebook.cell.delete";
|
|
42
|
+
const QUIT_EDIT_ALL_CELLS_COMMAND_ID = "notebook.quitEditAllCells";
|
|
43
|
+
const CLEAR_CELL_OUTPUTS_COMMAND_ID = "notebook.cell.clearOutputs";
|
|
44
|
+
const SELECT_NOTEBOOK_INDENTATION_ID = "notebook.selectIndentation";
|
|
45
|
+
const COMMENT_SELECTED_CELLS_ID = "notebook.commentSelectedCells";
|
|
46
46
|
registerAction2(class EditCellAction extends NotebookCellAction {
|
|
47
47
|
constructor() {
|
|
48
48
|
super({
|
|
49
49
|
id: EDIT_CELL_COMMAND_ID,
|
|
50
|
-
title: ( localize(
|
|
50
|
+
title: ( localize(9694, "Edit Cell")),
|
|
51
51
|
keybinding: {
|
|
52
52
|
when: ( ContextKeyExpr.and(
|
|
53
53
|
NOTEBOOK_CELL_LIST_FOCUSED,
|
|
@@ -60,18 +60,18 @@ registerAction2(class EditCellAction extends NotebookCellAction {
|
|
|
60
60
|
},
|
|
61
61
|
menu: {
|
|
62
62
|
id: MenuId.NotebookCellTitle,
|
|
63
|
-
when: ( ContextKeyExpr.and(( NOTEBOOK_EDITOR_EDITABLE.isEqualTo(true)), ( NOTEBOOK_CELL_TYPE.isEqualTo(
|
|
63
|
+
when: ( ContextKeyExpr.and(( NOTEBOOK_EDITOR_EDITABLE.isEqualTo(true)), ( NOTEBOOK_CELL_TYPE.isEqualTo("markup")), ( NOTEBOOK_CELL_MARKDOWN_EDIT_MODE.toNegated()), NOTEBOOK_CELL_EDITABLE)),
|
|
64
64
|
order: CellToolbarOrder.EditCell,
|
|
65
65
|
group: CELL_TITLE_CELL_GROUP_ID
|
|
66
66
|
},
|
|
67
|
-
icon: editIcon
|
|
67
|
+
icon: editIcon
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
async runWithContext(accessor, context) {
|
|
71
71
|
if (!context.notebookEditor.hasModel()) {
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
|
-
await context.notebookEditor.focusNotebookCell(context.cell,
|
|
74
|
+
await context.notebookEditor.focusNotebookCell(context.cell, "editor");
|
|
75
75
|
const foundEditor = context.cell ? findTargetCellEditor(context, context.cell) : undefined;
|
|
76
76
|
if (foundEditor && foundEditor.hasTextFocus() && InlineChatController.get(foundEditor)?.getWidgetPosition()?.lineNumber === foundEditor.getPosition()?.lineNumber) {
|
|
77
77
|
InlineChatController.get(foundEditor)?.focus();
|
|
@@ -83,48 +83,46 @@ 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(9695, "Stop Editing Cell")),
|
|
87
87
|
menu: {
|
|
88
88
|
id: MenuId.NotebookCellTitle,
|
|
89
|
-
when: ( ContextKeyExpr.and(( NOTEBOOK_CELL_TYPE.isEqualTo(
|
|
89
|
+
when: ( ContextKeyExpr.and(( NOTEBOOK_CELL_TYPE.isEqualTo("markup")), NOTEBOOK_CELL_MARKDOWN_EDIT_MODE, NOTEBOOK_CELL_EDITABLE)),
|
|
90
90
|
order: CellToolbarOrder.SaveCell,
|
|
91
91
|
group: CELL_TITLE_CELL_GROUP_ID
|
|
92
92
|
},
|
|
93
93
|
icon: stopEditIcon,
|
|
94
|
-
keybinding: [
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
94
|
+
keybinding: [{
|
|
95
|
+
when: ( ContextKeyExpr.and(quitEditCondition, ( EditorContextKeys.hoverVisible.toNegated()), ( EditorContextKeys.hasNonEmptySelection.toNegated()), ( EditorContextKeys.hasMultipleSelections.toNegated()))),
|
|
96
|
+
primary: KeyCode.Escape,
|
|
97
|
+
weight: NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT - 5
|
|
98
|
+
}, {
|
|
99
|
+
when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, NOTEBOOK_OUTPUT_FOCUSED)),
|
|
100
|
+
primary: KeyCode.Escape,
|
|
101
|
+
weight: KeybindingWeight.WorkbenchContrib + 5
|
|
102
|
+
}, {
|
|
103
|
+
when: ( ContextKeyExpr.and(quitEditCondition, ( NOTEBOOK_CELL_TYPE.isEqualTo("markup")))),
|
|
104
|
+
primary: KeyMod.WinCtrl | KeyCode.Enter,
|
|
105
|
+
win: {
|
|
106
|
+
primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.Enter
|
|
99
107
|
},
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
primary: KeyCode.Escape,
|
|
103
|
-
weight: KeybindingWeight.WorkbenchContrib + 5
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
when: ( ContextKeyExpr.and(quitEditCondition, ( NOTEBOOK_CELL_TYPE.isEqualTo('markup')))),
|
|
107
|
-
primary: KeyMod.WinCtrl | KeyCode.Enter,
|
|
108
|
-
win: {
|
|
109
|
-
primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.Enter
|
|
110
|
-
},
|
|
111
|
-
weight: NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT - 5
|
|
112
|
-
},
|
|
113
|
-
]
|
|
108
|
+
weight: NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT - 5
|
|
109
|
+
}]
|
|
114
110
|
});
|
|
115
111
|
}
|
|
116
112
|
async runWithContext(accessor, context) {
|
|
117
113
|
if (context.cell.cellKind === CellKind.Markup) {
|
|
118
114
|
context.cell.updateEditState(CellEditState.Preview, QUIT_EDIT_CELL_COMMAND_ID);
|
|
119
115
|
}
|
|
120
|
-
await context.notebookEditor.focusNotebookCell(context.cell,
|
|
116
|
+
await context.notebookEditor.focusNotebookCell(context.cell, "container", {
|
|
117
|
+
skipReveal: true
|
|
118
|
+
});
|
|
121
119
|
}
|
|
122
120
|
});
|
|
123
121
|
registerAction2(class QuitEditAllCellsAction extends NotebookAction {
|
|
124
122
|
constructor() {
|
|
125
123
|
super({
|
|
126
124
|
id: QUIT_EDIT_ALL_CELLS_COMMAND_ID,
|
|
127
|
-
title: ( localize(
|
|
125
|
+
title: ( localize(9696, "Stop Editing All Cells"))
|
|
128
126
|
});
|
|
129
127
|
}
|
|
130
128
|
async runWithContext(accessor, context) {
|
|
@@ -136,12 +134,16 @@ registerAction2(class QuitEditAllCellsAction extends NotebookAction {
|
|
|
136
134
|
return;
|
|
137
135
|
}
|
|
138
136
|
const activeCell = context.notebookEditor.getActiveCell();
|
|
139
|
-
const editingCells = viewModel.viewCells.filter(
|
|
137
|
+
const editingCells = viewModel.viewCells.filter(
|
|
138
|
+
cell => cell.cellKind === CellKind.Markup && cell.getEditState() === CellEditState.Editing
|
|
139
|
+
);
|
|
140
140
|
editingCells.forEach(cell => {
|
|
141
141
|
cell.updateEditState(CellEditState.Preview, QUIT_EDIT_ALL_CELLS_COMMAND_ID);
|
|
142
142
|
});
|
|
143
143
|
if (activeCell) {
|
|
144
|
-
await context.notebookEditor.focusNotebookCell(activeCell,
|
|
144
|
+
await context.notebookEditor.focusNotebookCell(activeCell, "container", {
|
|
145
|
+
skipReveal: true
|
|
146
|
+
});
|
|
145
147
|
}
|
|
146
148
|
}
|
|
147
149
|
});
|
|
@@ -149,7 +151,7 @@ registerAction2(class DeleteCellAction extends NotebookCellAction {
|
|
|
149
151
|
constructor() {
|
|
150
152
|
super({
|
|
151
153
|
id: DELETE_CELL_COMMAND_ID,
|
|
152
|
-
title: ( localize(
|
|
154
|
+
title: ( localize(9697, "Delete Cell")),
|
|
153
155
|
keybinding: {
|
|
154
156
|
primary: KeyCode.Delete,
|
|
155
157
|
mac: {
|
|
@@ -162,17 +164,14 @@ registerAction2(class DeleteCellAction extends NotebookCellAction {
|
|
|
162
164
|
)),
|
|
163
165
|
weight: KeybindingWeight.WorkbenchContrib
|
|
164
166
|
},
|
|
165
|
-
menu: [
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
group: CELL_TITLE_CELL_GROUP_ID
|
|
174
|
-
}
|
|
175
|
-
],
|
|
167
|
+
menu: [{
|
|
168
|
+
id: MenuId.NotebookCellDelete,
|
|
169
|
+
when: NOTEBOOK_EDITOR_EDITABLE,
|
|
170
|
+
group: CELL_TITLE_CELL_GROUP_ID
|
|
171
|
+
}, {
|
|
172
|
+
id: MenuId.InteractiveCellDelete,
|
|
173
|
+
group: CELL_TITLE_CELL_GROUP_ID
|
|
174
|
+
}],
|
|
176
175
|
icon: deleteCellIcon
|
|
177
176
|
});
|
|
178
177
|
}
|
|
@@ -186,18 +185,19 @@ registerAction2(class DeleteCellAction extends NotebookCellAction {
|
|
|
186
185
|
const configService = accessor.get(IConfigurationService);
|
|
187
186
|
if (runState === NotebookCellExecutionState.Executing && configService.getValue(NotebookSetting.confirmDeleteRunningCell)) {
|
|
188
187
|
const dialogService = accessor.get(IDialogService);
|
|
189
|
-
const primaryButton = ( localize(
|
|
188
|
+
const primaryButton = ( localize(9698, "Delete"));
|
|
190
189
|
confirmation = await dialogService.confirm({
|
|
191
|
-
type:
|
|
192
|
-
message: ( localize(
|
|
190
|
+
type: "question",
|
|
191
|
+
message: ( localize(9699, "This cell is running, are you sure you want to delete it?")),
|
|
193
192
|
primaryButton: primaryButton,
|
|
194
193
|
checkbox: {
|
|
195
|
-
label: ( localize(
|
|
194
|
+
label: ( localize(9700, "Do not ask me again"))
|
|
196
195
|
}
|
|
197
196
|
});
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
|
|
197
|
+
} else {
|
|
198
|
+
confirmation = {
|
|
199
|
+
confirmed: true
|
|
200
|
+
};
|
|
201
201
|
}
|
|
202
202
|
if (!confirmation.confirmed) {
|
|
203
203
|
return;
|
|
@@ -212,25 +212,22 @@ registerAction2(class ClearCellOutputsAction extends NotebookCellAction {
|
|
|
212
212
|
constructor() {
|
|
213
213
|
super({
|
|
214
214
|
id: CLEAR_CELL_OUTPUTS_COMMAND_ID,
|
|
215
|
-
title: ( localize(
|
|
216
|
-
menu: [
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
))
|
|
232
|
-
},
|
|
233
|
-
],
|
|
215
|
+
title: ( localize(9701, "Clear Cell Outputs")),
|
|
216
|
+
menu: [{
|
|
217
|
+
id: MenuId.NotebookCellTitle,
|
|
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()))),
|
|
219
|
+
order: CellToolbarOrder.ClearCellOutput,
|
|
220
|
+
group: CELL_TITLE_OUTPUT_GROUP_ID
|
|
221
|
+
}, {
|
|
222
|
+
id: MenuId.NotebookOutputToolbar,
|
|
223
|
+
when: ( ContextKeyExpr.and(
|
|
224
|
+
NOTEBOOK_CELL_HAS_OUTPUTS,
|
|
225
|
+
NOTEBOOK_EDITOR_EDITABLE,
|
|
226
|
+
NOTEBOOK_CELL_EDITABLE,
|
|
227
|
+
NOTEBOOK_CELL_IS_FIRST_OUTPUT,
|
|
228
|
+
NOTEBOOK_USE_CONSOLIDATED_OUTPUT_BUTTON
|
|
229
|
+
))
|
|
230
|
+
}],
|
|
234
231
|
keybinding: {
|
|
235
232
|
when: ( ContextKeyExpr.and(
|
|
236
233
|
NOTEBOOK_EDITOR_FOCUSED,
|
|
@@ -257,18 +254,24 @@ registerAction2(class ClearCellOutputsAction extends NotebookCellAction {
|
|
|
257
254
|
return;
|
|
258
255
|
}
|
|
259
256
|
const computeUndoRedo = !editor.isReadOnly;
|
|
260
|
-
editor.textModel.applyEdits([{
|
|
257
|
+
editor.textModel.applyEdits([{
|
|
258
|
+
editType: CellEditType.Output,
|
|
259
|
+
index,
|
|
260
|
+
outputs: []
|
|
261
|
+
}], true, undefined, () => undefined, undefined, computeUndoRedo);
|
|
261
262
|
const runState = notebookExecutionStateService.getCellExecution(context.cell.uri)?.state;
|
|
262
263
|
if (runState !== NotebookCellExecutionState.Executing) {
|
|
263
264
|
context.notebookEditor.textModel.applyEdits([{
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
265
|
+
editType: CellEditType.PartialInternalMetadata,
|
|
266
|
+
index,
|
|
267
|
+
internalMetadata: {
|
|
268
|
+
runStartTime: null,
|
|
269
|
+
runStartTimeAdjustment: null,
|
|
270
|
+
runEndTime: null,
|
|
271
|
+
executionOrder: null,
|
|
272
|
+
lastRunSuccess: null
|
|
273
|
+
}
|
|
274
|
+
}], true, undefined, () => undefined, undefined, computeUndoRedo);
|
|
272
275
|
}
|
|
273
276
|
}
|
|
274
277
|
});
|
|
@@ -276,22 +279,19 @@ registerAction2(class ClearAllCellOutputsAction extends NotebookAction {
|
|
|
276
279
|
constructor() {
|
|
277
280
|
super({
|
|
278
281
|
id: CLEAR_ALL_CELLS_OUTPUTS_COMMAND_ID,
|
|
279
|
-
title: ( localize(
|
|
282
|
+
title: ( localize(9702, "Clear All Outputs")),
|
|
280
283
|
precondition: NOTEBOOK_HAS_OUTPUTS,
|
|
281
|
-
menu: [
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
order: 10
|
|
293
|
-
}
|
|
294
|
-
],
|
|
284
|
+
menu: [{
|
|
285
|
+
id: MenuId.EditorTitle,
|
|
286
|
+
when: ( ContextKeyExpr.and(NOTEBOOK_IS_ACTIVE_EDITOR, ( ContextKeyExpr.notEquals("config.notebook.globalToolbar", true)))),
|
|
287
|
+
group: "navigation",
|
|
288
|
+
order: 0
|
|
289
|
+
}, {
|
|
290
|
+
id: MenuId.NotebookToolbar,
|
|
291
|
+
when: ( ContextKeyExpr.and(executeNotebookCondition, ( ContextKeyExpr.equals("config.notebook.globalToolbar", true)))),
|
|
292
|
+
group: "navigation/execute",
|
|
293
|
+
order: 10
|
|
294
|
+
}],
|
|
295
295
|
icon: clearIcon
|
|
296
296
|
});
|
|
297
297
|
}
|
|
@@ -303,13 +303,17 @@ registerAction2(class ClearAllCellOutputsAction extends NotebookAction {
|
|
|
303
303
|
}
|
|
304
304
|
const computeUndoRedo = !editor.isReadOnly;
|
|
305
305
|
editor.textModel.applyEdits(( editor.textModel.cells.map((cell, index) => ({
|
|
306
|
-
editType: CellEditType.Output,
|
|
306
|
+
editType: CellEditType.Output,
|
|
307
|
+
index,
|
|
308
|
+
outputs: []
|
|
307
309
|
}))), true, undefined, () => undefined, undefined, computeUndoRedo);
|
|
308
310
|
const clearExecutionMetadataEdits = ( editor.textModel.cells.map((cell, index) => {
|
|
309
311
|
const runState = notebookExecutionStateService.getCellExecution(cell.uri)?.state;
|
|
310
312
|
if (runState !== NotebookCellExecutionState.Executing) {
|
|
311
313
|
return {
|
|
312
|
-
editType: CellEditType.PartialInternalMetadata,
|
|
314
|
+
editType: CellEditType.PartialInternalMetadata,
|
|
315
|
+
index,
|
|
316
|
+
internalMetadata: {
|
|
313
317
|
runStartTime: null,
|
|
314
318
|
runStartTimeAdjustment: null,
|
|
315
319
|
runEndTime: null,
|
|
@@ -317,13 +321,19 @@ registerAction2(class ClearAllCellOutputsAction extends NotebookAction {
|
|
|
317
321
|
lastRunSuccess: null
|
|
318
322
|
}
|
|
319
323
|
};
|
|
320
|
-
}
|
|
321
|
-
else {
|
|
324
|
+
} else {
|
|
322
325
|
return undefined;
|
|
323
326
|
}
|
|
324
327
|
})).filter(edit => !!edit);
|
|
325
328
|
if (clearExecutionMetadataEdits.length) {
|
|
326
|
-
context.notebookEditor.textModel.applyEdits(
|
|
329
|
+
context.notebookEditor.textModel.applyEdits(
|
|
330
|
+
clearExecutionMetadataEdits,
|
|
331
|
+
true,
|
|
332
|
+
undefined,
|
|
333
|
+
() => undefined,
|
|
334
|
+
undefined,
|
|
335
|
+
computeUndoRedo
|
|
336
|
+
);
|
|
327
337
|
}
|
|
328
338
|
const controller = editor.getContribution(NotebookInlineVariablesController.id);
|
|
329
339
|
controller.clearNotebookInlineDecorations();
|
|
@@ -333,47 +343,44 @@ registerAction2(class ChangeCellLanguageAction extends NotebookCellAction {
|
|
|
333
343
|
constructor() {
|
|
334
344
|
super({
|
|
335
345
|
id: CHANGE_CELL_LANGUAGE,
|
|
336
|
-
title: ( localize(
|
|
346
|
+
title: ( localize(9703, "Change Cell Language")),
|
|
337
347
|
keybinding: {
|
|
338
348
|
weight: KeybindingWeight.WorkbenchContrib,
|
|
339
349
|
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KeyK, KeyCode.KeyM),
|
|
340
350
|
when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, NOTEBOOK_EDITOR_EDITABLE, NOTEBOOK_CELL_EDITABLE))
|
|
341
351
|
},
|
|
342
352
|
metadata: {
|
|
343
|
-
description: ( localize(
|
|
344
|
-
args: [
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
'type': 'number'
|
|
357
|
-
}
|
|
353
|
+
description: ( localize(9703, "Change Cell Language")),
|
|
354
|
+
args: [{
|
|
355
|
+
name: "range",
|
|
356
|
+
description: "The cell range",
|
|
357
|
+
schema: {
|
|
358
|
+
"type": "object",
|
|
359
|
+
"required": ["start", "end"],
|
|
360
|
+
"properties": {
|
|
361
|
+
"start": {
|
|
362
|
+
"type": "number"
|
|
363
|
+
},
|
|
364
|
+
"end": {
|
|
365
|
+
"type": "number"
|
|
358
366
|
}
|
|
359
367
|
}
|
|
360
|
-
},
|
|
361
|
-
{
|
|
362
|
-
name: 'language',
|
|
363
|
-
description: 'The target cell language',
|
|
364
|
-
schema: {
|
|
365
|
-
'type': 'string'
|
|
366
|
-
}
|
|
367
368
|
}
|
|
368
|
-
|
|
369
|
+
}, {
|
|
370
|
+
name: "language",
|
|
371
|
+
description: "The target cell language",
|
|
372
|
+
schema: {
|
|
373
|
+
"type": "string"
|
|
374
|
+
}
|
|
375
|
+
}]
|
|
369
376
|
}
|
|
370
377
|
});
|
|
371
378
|
}
|
|
372
379
|
getCellContextFromArgs(accessor, context, ...additionalArgs) {
|
|
373
|
-
if (!context || typeof context.start !==
|
|
380
|
+
if (!context || typeof context.start !== "number" || typeof context.end !== "number" || context.start >= context.end) {
|
|
374
381
|
return;
|
|
375
382
|
}
|
|
376
|
-
const language = additionalArgs.length && typeof additionalArgs[0] ===
|
|
383
|
+
const language = additionalArgs.length && typeof additionalArgs[0] === "string" ? additionalArgs[0] : undefined;
|
|
377
384
|
const activeEditorContext = this.getEditorContextFromArgsOrActive(accessor);
|
|
378
385
|
if (!activeEditorContext || !activeEditorContext.notebookEditor.hasModel() || context.start >= activeEditorContext.notebookEditor.getLength()) {
|
|
379
386
|
return;
|
|
@@ -387,8 +394,7 @@ registerAction2(class ChangeCellLanguageAction extends NotebookCellAction {
|
|
|
387
394
|
async runWithContext(accessor, context) {
|
|
388
395
|
if (context.language) {
|
|
389
396
|
await this.setLanguage(context, context.language);
|
|
390
|
-
}
|
|
391
|
-
else {
|
|
397
|
+
} else {
|
|
392
398
|
await this.showLanguagePicker(accessor, context);
|
|
393
399
|
}
|
|
394
400
|
}
|
|
@@ -406,17 +412,13 @@ registerAction2(class ChangeCellLanguageAction extends NotebookCellAction {
|
|
|
406
412
|
const allSupportedLanguages = matchResult.all.flatMap(kernel => kernel.supportedLanguages);
|
|
407
413
|
languages = allSupportedLanguages.length > 0 ? allSupportedLanguages : languageService.getRegisteredLanguageIds();
|
|
408
414
|
}
|
|
409
|
-
const providerLanguages = ( new Set([
|
|
410
|
-
...languages,
|
|
411
|
-
'markdown'
|
|
412
|
-
]));
|
|
415
|
+
const providerLanguages = ( new Set([...languages, "markdown"]));
|
|
413
416
|
providerLanguages.forEach(languageId => {
|
|
414
417
|
let description;
|
|
415
|
-
if (context.cell.cellKind === CellKind.Markup ? (languageId ===
|
|
416
|
-
description = ( localize(
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
description = ( localize(9385, "({0})", languageId));
|
|
418
|
+
if (context.cell.cellKind === CellKind.Markup ? (languageId === "markdown") : (languageId === context.cell.language)) {
|
|
419
|
+
description = ( localize(9704, "({0}) - Current Language", languageId));
|
|
420
|
+
} else {
|
|
421
|
+
description = ( localize(9705, "({0})", languageId));
|
|
420
422
|
}
|
|
421
423
|
const languageName = languageService.getLanguageName(languageId);
|
|
422
424
|
if (!languageName) {
|
|
@@ -424,14 +426,17 @@ registerAction2(class ChangeCellLanguageAction extends NotebookCellAction {
|
|
|
424
426
|
}
|
|
425
427
|
const item = {
|
|
426
428
|
label: languageName,
|
|
427
|
-
iconClasses: getIconClasses(
|
|
429
|
+
iconClasses: getIconClasses(
|
|
430
|
+
modelService,
|
|
431
|
+
languageService,
|
|
432
|
+
this.getFakeResource(languageName, languageService)
|
|
433
|
+
),
|
|
428
434
|
description,
|
|
429
435
|
languageId
|
|
430
436
|
};
|
|
431
|
-
if (languageId ===
|
|
437
|
+
if (languageId === "markdown" || languageId === context.cell.language) {
|
|
432
438
|
topItems.push(item);
|
|
433
|
-
}
|
|
434
|
-
else {
|
|
439
|
+
} else {
|
|
435
440
|
mainItems.push(item);
|
|
436
441
|
}
|
|
437
442
|
});
|
|
@@ -439,19 +444,18 @@ registerAction2(class ChangeCellLanguageAction extends NotebookCellAction {
|
|
|
439
444
|
return a.description.localeCompare(b.description);
|
|
440
445
|
});
|
|
441
446
|
const autoDetectMode = {
|
|
442
|
-
label: ( localize(
|
|
447
|
+
label: ( localize(9706, "Auto Detect"))
|
|
443
448
|
};
|
|
444
|
-
const picks = [
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
: selection?.languageId;
|
|
449
|
+
const picks = [autoDetectMode, {
|
|
450
|
+
type: "separator",
|
|
451
|
+
label: ( localize(9707, "languages (identifier)"))
|
|
452
|
+
}, ...topItems, {
|
|
453
|
+
type: "separator"
|
|
454
|
+
}, ...mainItems];
|
|
455
|
+
const selection = await quickInputService.pick(picks, {
|
|
456
|
+
placeHolder: ( localize(9708, "Select Language Mode"))
|
|
457
|
+
});
|
|
458
|
+
const languageId = selection === autoDetectMode ? await languageDetectionService.detectLanguage(context.cell.uri) : selection?.languageId;
|
|
455
459
|
if (languageId) {
|
|
456
460
|
await this.setLanguage(context, languageId);
|
|
457
461
|
}
|
|
@@ -466,8 +470,7 @@ registerAction2(class ChangeCellLanguageAction extends NotebookCellAction {
|
|
|
466
470
|
const extensions = languageService.getExtensions(languageId);
|
|
467
471
|
if (extensions.length) {
|
|
468
472
|
fakeResource = URI.file(extensions[0]);
|
|
469
|
-
}
|
|
470
|
-
else {
|
|
473
|
+
} else {
|
|
471
474
|
const filenames = languageService.getFilenames(languageId);
|
|
472
475
|
if (filenames.length) {
|
|
473
476
|
fakeResource = URI.file(filenames[0]);
|
|
@@ -481,10 +484,13 @@ registerAction2(class DetectCellLanguageAction extends NotebookCellAction {
|
|
|
481
484
|
constructor() {
|
|
482
485
|
super({
|
|
483
486
|
id: DETECT_CELL_LANGUAGE,
|
|
484
|
-
title: ( localize2(
|
|
487
|
+
title: ( localize2(9709, "Accept Detected Language for Cell")),
|
|
485
488
|
f1: true,
|
|
486
489
|
precondition: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_EDITABLE, NOTEBOOK_CELL_EDITABLE)),
|
|
487
|
-
keybinding: {
|
|
490
|
+
keybinding: {
|
|
491
|
+
primary: KeyCode.KeyD | KeyMod.Alt | KeyMod.Shift,
|
|
492
|
+
weight: KeybindingWeight.WorkbenchContrib
|
|
493
|
+
}
|
|
488
494
|
});
|
|
489
495
|
}
|
|
490
496
|
async runWithContext(accessor, context) {
|
|
@@ -493,44 +499,53 @@ registerAction2(class DetectCellLanguageAction extends NotebookCellAction {
|
|
|
493
499
|
const kernelService = accessor.get(INotebookKernelService);
|
|
494
500
|
const kernel = kernelService.getSelectedOrSuggestedKernel(context.notebookEditor.textModel);
|
|
495
501
|
const providerLanguages = [...(kernel?.supportedLanguages ?? [])];
|
|
496
|
-
providerLanguages.push(
|
|
502
|
+
providerLanguages.push("markdown");
|
|
497
503
|
const detection = await languageDetectionService.detectLanguage(context.cell.uri, providerLanguages);
|
|
498
504
|
if (detection) {
|
|
499
505
|
setCellToLanguage(detection, context);
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
notificationService.warn(( localize(9390, "Unable to detect cell language")));
|
|
506
|
+
} else {
|
|
507
|
+
notificationService.warn(( localize(9710, "Unable to detect cell language")));
|
|
503
508
|
}
|
|
504
509
|
}
|
|
505
510
|
});
|
|
506
511
|
async function setCellToLanguage(languageId, context) {
|
|
507
|
-
if (languageId ===
|
|
512
|
+
if (languageId === "markdown" && context.cell?.language !== "markdown") {
|
|
508
513
|
const idx = context.notebookEditor.getCellIndex(context.cell);
|
|
509
|
-
await changeCellToKind(CellKind.Markup, {
|
|
514
|
+
await changeCellToKind(CellKind.Markup, {
|
|
515
|
+
cell: context.cell,
|
|
516
|
+
notebookEditor: context.notebookEditor,
|
|
517
|
+
ui: true
|
|
518
|
+
}, "markdown", Mimes.markdown);
|
|
510
519
|
const newCell = context.notebookEditor.cellAt(idx);
|
|
511
520
|
if (newCell) {
|
|
512
|
-
await context.notebookEditor.focusNotebookCell(newCell,
|
|
521
|
+
await context.notebookEditor.focusNotebookCell(newCell, "editor");
|
|
513
522
|
}
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
523
|
+
} else if (languageId !== "markdown" && context.cell?.cellKind === CellKind.Markup) {
|
|
524
|
+
await changeCellToKind(CellKind.Code, {
|
|
525
|
+
cell: context.cell,
|
|
526
|
+
notebookEditor: context.notebookEditor,
|
|
527
|
+
ui: true
|
|
528
|
+
}, languageId);
|
|
529
|
+
} else {
|
|
519
530
|
const index = context.notebookEditor.textModel.cells.indexOf(context.cell.model);
|
|
520
|
-
context.notebookEditor.textModel.applyEdits([{
|
|
531
|
+
context.notebookEditor.textModel.applyEdits([{
|
|
532
|
+
editType: CellEditType.CellLanguage,
|
|
533
|
+
index,
|
|
534
|
+
language: languageId
|
|
535
|
+
}], true, undefined, () => undefined, undefined, !context.notebookEditor.isReadOnly);
|
|
521
536
|
}
|
|
522
537
|
}
|
|
523
538
|
registerAction2(class SelectNotebookIndentation extends NotebookAction {
|
|
524
539
|
constructor() {
|
|
525
540
|
super({
|
|
526
541
|
id: SELECT_NOTEBOOK_INDENTATION_ID,
|
|
527
|
-
title: ( localize2(
|
|
542
|
+
title: ( localize2(9711, "Select Indentation")),
|
|
528
543
|
f1: true,
|
|
529
544
|
precondition: ( ContextKeyExpr.and(
|
|
530
545
|
NOTEBOOK_IS_ACTIVE_EDITOR,
|
|
531
546
|
NOTEBOOK_EDITOR_EDITABLE,
|
|
532
547
|
NOTEBOOK_CELL_EDITABLE
|
|
533
|
-
))
|
|
548
|
+
))
|
|
534
549
|
});
|
|
535
550
|
}
|
|
536
551
|
async runWithContext(accessor, context) {
|
|
@@ -542,23 +557,21 @@ registerAction2(class SelectNotebookIndentation extends NotebookAction {
|
|
|
542
557
|
const instantiationService = accessor.get(IInstantiationService);
|
|
543
558
|
const activeNotebook = getNotebookEditorFromEditorPane(editorService.activeEditorPane);
|
|
544
559
|
if (!activeNotebook || activeNotebook.isDisposed) {
|
|
545
|
-
return quickInputService.pick([{
|
|
560
|
+
return quickInputService.pick([{
|
|
561
|
+
label: ( localize(9712, "No notebook editor active at this time"))
|
|
562
|
+
}]);
|
|
546
563
|
}
|
|
547
564
|
if (activeNotebook.isReadOnly) {
|
|
548
|
-
return quickInputService.pick([{
|
|
565
|
+
return quickInputService.pick([{
|
|
566
|
+
label: ( localize(9713, "The active notebook editor is read-only."))
|
|
567
|
+
}]);
|
|
549
568
|
}
|
|
550
|
-
const picks = ( [
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
new NotebookChangeTabDisplaySize()),
|
|
557
|
-
(
|
|
558
|
-
new NotebookIndentationToTabsAction()),
|
|
559
|
-
(
|
|
560
|
-
new NotebookIndentationToSpacesAction())
|
|
561
|
-
].map(item => {
|
|
569
|
+
const picks = ( [(
|
|
570
|
+
new NotebookIndentUsingTabs()), (
|
|
571
|
+
new NotebookIndentUsingSpaces()), (
|
|
572
|
+
new NotebookChangeTabDisplaySize()), (
|
|
573
|
+
new NotebookIndentationToTabsAction()), (
|
|
574
|
+
new NotebookIndentationToSpacesAction())].map(item => {
|
|
562
575
|
return {
|
|
563
576
|
id: item.desc.id,
|
|
564
577
|
label: ( item.desc.title.toString()),
|
|
@@ -567,9 +580,18 @@ registerAction2(class SelectNotebookIndentation extends NotebookAction {
|
|
|
567
580
|
}
|
|
568
581
|
};
|
|
569
582
|
}));
|
|
570
|
-
picks.splice(3, 0, {
|
|
571
|
-
|
|
572
|
-
|
|
583
|
+
picks.splice(3, 0, {
|
|
584
|
+
type: "separator",
|
|
585
|
+
label: ( localize(9714, "convert file"))
|
|
586
|
+
});
|
|
587
|
+
picks.unshift({
|
|
588
|
+
type: "separator",
|
|
589
|
+
label: ( localize(9715, "change view"))
|
|
590
|
+
});
|
|
591
|
+
const action = await quickInputService.pick(picks, {
|
|
592
|
+
placeHolder: ( localize(9716, "Select Action")),
|
|
593
|
+
matchOnDetail: true
|
|
594
|
+
});
|
|
573
595
|
if (!action) {
|
|
574
596
|
return;
|
|
575
597
|
}
|
|
@@ -582,7 +604,7 @@ registerAction2(class CommentSelectedCellsAction extends NotebookMultiCellAction
|
|
|
582
604
|
constructor() {
|
|
583
605
|
super({
|
|
584
606
|
id: COMMENT_SELECTED_CELLS_ID,
|
|
585
|
-
title: ( localize(
|
|
607
|
+
title: ( localize(9717, "Comment Selected Cells")),
|
|
586
608
|
keybinding: {
|
|
587
609
|
when: ( ContextKeyExpr.and(
|
|
588
610
|
NOTEBOOK_EDITOR_FOCUSED,
|
|
@@ -596,7 +618,7 @@ registerAction2(class CommentSelectedCellsAction extends NotebookMultiCellAction
|
|
|
596
618
|
}
|
|
597
619
|
async runWithContext(accessor, context) {
|
|
598
620
|
const languageConfigurationService = accessor.get(ILanguageConfigurationService);
|
|
599
|
-
context.selectedCells.forEach(async
|
|
621
|
+
context.selectedCells.forEach(async cellViewModel => {
|
|
600
622
|
const textModel = await cellViewModel.resolveTextModel();
|
|
601
623
|
const commentsOptions = cellViewModel.commentOptions;
|
|
602
624
|
const cellCommentCommand = ( new LineCommentCommand(languageConfigurationService, (
|
|
@@ -613,7 +635,7 @@ registerAction2(class CommentSelectedCellsAction extends NotebookMultiCellAction
|
|
|
613
635
|
CommandExecutor.executeCommands(textModel, cellEditorSelections, [cellCommentCommand]);
|
|
614
636
|
const newTrackedSelections = ( ( initialTrackedRangesIDs.map(i => {
|
|
615
637
|
return textModel._getTrackedRange(i);
|
|
616
|
-
})).filter(r => !!r).map(
|
|
638
|
+
})).filter(r => !!r).map(range => {
|
|
617
639
|
return ( new Selection(
|
|
618
640
|
range.startLineNumber,
|
|
619
641
|
range.startColumn,
|