@codingame/monaco-vscode-notebook-service-override 4.1.0 → 4.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/external/rollup-plugin-styles/dist/runtime/inject-css.js +3 -0
- package/external/tslib/tslib.es6.js +11 -0
- package/notebook.js +12 -12
- package/override/vs/platform/dialogs/common/dialogs.js +10 -0
- package/package.json +2 -2
- 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 +391 -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/statusBarProviders.js +173 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +544 -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 +320 -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/format/formatting.js +209 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +84 -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 +101 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +393 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.js +5 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +97 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +120 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +60 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +150 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +656 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +77 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +517 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +159 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +56 -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/chat/cellChatActions.js +652 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +721 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +351 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +315 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +199 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +47 -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 +115 -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 +911 -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 +395 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +185 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +1187 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibility.js +159 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +451 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +192 -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 +510 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +130 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +341 -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 +641 -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 +90 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +1002 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +103 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +203 -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/services/workingCopy/common/abstractFileWorkingCopyManager.js +89 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +386 -0
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +408 -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
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
2
|
+
import { ILanguageService } from 'vscode/vscode/vs/editor/common/languages/language';
|
|
3
|
+
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
4
|
+
import { registerAction2, MenuId, MenuRegistry } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
5
|
+
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
6
|
+
import { InputFocusedContext } from 'vscode/vscode/vs/platform/contextkey/common/contextkeys';
|
|
7
|
+
import { insertCell } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/cellOperations';
|
|
8
|
+
import { NotebookAction } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/coreActions';
|
|
9
|
+
import { NOTEBOOK_CELL_LIST_FOCUSED, NOTEBOOK_EDITOR_EDITABLE } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
|
|
10
|
+
import { CellKind, NotebookSetting } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
11
|
+
import { CTX_NOTEBOOK_CHAT_OUTER_FOCUS_POSITION } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext';
|
|
12
|
+
|
|
13
|
+
const INSERT_CODE_CELL_ABOVE_COMMAND_ID = 'notebook.cell.insertCodeCellAbove';
|
|
14
|
+
const INSERT_CODE_CELL_BELOW_COMMAND_ID = 'notebook.cell.insertCodeCellBelow';
|
|
15
|
+
const INSERT_CODE_CELL_ABOVE_AND_FOCUS_CONTAINER_COMMAND_ID = 'notebook.cell.insertCodeCellAboveAndFocusContainer';
|
|
16
|
+
const INSERT_CODE_CELL_BELOW_AND_FOCUS_CONTAINER_COMMAND_ID = 'notebook.cell.insertCodeCellBelowAndFocusContainer';
|
|
17
|
+
const INSERT_CODE_CELL_AT_TOP_COMMAND_ID = 'notebook.cell.insertCodeCellAtTop';
|
|
18
|
+
const INSERT_MARKDOWN_CELL_ABOVE_COMMAND_ID = 'notebook.cell.insertMarkdownCellAbove';
|
|
19
|
+
const INSERT_MARKDOWN_CELL_BELOW_COMMAND_ID = 'notebook.cell.insertMarkdownCellBelow';
|
|
20
|
+
const INSERT_MARKDOWN_CELL_AT_TOP_COMMAND_ID = 'notebook.cell.insertMarkdownCellAtTop';
|
|
21
|
+
function insertNewCell(accessor, context, kind, direction, focusEditor) {
|
|
22
|
+
let newCell = null;
|
|
23
|
+
if (context.ui) {
|
|
24
|
+
context.notebookEditor.focus();
|
|
25
|
+
}
|
|
26
|
+
const languageService = accessor.get(ILanguageService);
|
|
27
|
+
if (context.cell) {
|
|
28
|
+
const idx = context.notebookEditor.getCellIndex(context.cell);
|
|
29
|
+
newCell = insertCell(languageService, context.notebookEditor, idx, kind, direction, undefined, true);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
const focusRange = context.notebookEditor.getFocus();
|
|
33
|
+
const next = Math.max(focusRange.end - 1, 0);
|
|
34
|
+
newCell = insertCell(languageService, context.notebookEditor, next, kind, direction, undefined, true);
|
|
35
|
+
}
|
|
36
|
+
return newCell;
|
|
37
|
+
}
|
|
38
|
+
class InsertCellCommand extends NotebookAction {
|
|
39
|
+
constructor(desc, kind, direction, focusEditor) {
|
|
40
|
+
super(desc);
|
|
41
|
+
this.kind = kind;
|
|
42
|
+
this.direction = direction;
|
|
43
|
+
this.focusEditor = focusEditor;
|
|
44
|
+
}
|
|
45
|
+
async runWithContext(accessor, context) {
|
|
46
|
+
const newCell = await insertNewCell(accessor, context, this.kind, this.direction);
|
|
47
|
+
if (newCell) {
|
|
48
|
+
await context.notebookEditor.focusNotebookCell(newCell, this.focusEditor ? 'editor' : 'container');
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
registerAction2(class InsertCodeCellAboveAction extends InsertCellCommand {
|
|
53
|
+
constructor() {
|
|
54
|
+
super({
|
|
55
|
+
id: INSERT_CODE_CELL_ABOVE_COMMAND_ID,
|
|
56
|
+
title: ( localizeWithPath(
|
|
57
|
+
'vs/workbench/contrib/notebook/browser/controller/insertCellActions',
|
|
58
|
+
'notebookActions.insertCodeCellAbove',
|
|
59
|
+
"Insert Code Cell Above"
|
|
60
|
+
)),
|
|
61
|
+
keybinding: {
|
|
62
|
+
primary: 2048 | 1024 | 3 ,
|
|
63
|
+
when: ( ContextKeyExpr.and(NOTEBOOK_CELL_LIST_FOCUSED, ( InputFocusedContext.toNegated()))),
|
|
64
|
+
weight: 200
|
|
65
|
+
},
|
|
66
|
+
menu: {
|
|
67
|
+
id: MenuId.NotebookCellInsert,
|
|
68
|
+
order: 0
|
|
69
|
+
}
|
|
70
|
+
}, CellKind.Code, 'above', true);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
registerAction2(class InsertCodeCellAboveAndFocusContainerAction extends InsertCellCommand {
|
|
74
|
+
constructor() {
|
|
75
|
+
super({
|
|
76
|
+
id: INSERT_CODE_CELL_ABOVE_AND_FOCUS_CONTAINER_COMMAND_ID,
|
|
77
|
+
title: ( localizeWithPath(
|
|
78
|
+
'vs/workbench/contrib/notebook/browser/controller/insertCellActions',
|
|
79
|
+
'notebookActions.insertCodeCellAboveAndFocusContainer',
|
|
80
|
+
"Insert Code Cell Above and Focus Container"
|
|
81
|
+
))
|
|
82
|
+
}, CellKind.Code, 'above', false);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
registerAction2(class InsertCodeCellBelowAction extends InsertCellCommand {
|
|
86
|
+
constructor() {
|
|
87
|
+
super({
|
|
88
|
+
id: INSERT_CODE_CELL_BELOW_COMMAND_ID,
|
|
89
|
+
title: ( localizeWithPath(
|
|
90
|
+
'vs/workbench/contrib/notebook/browser/controller/insertCellActions',
|
|
91
|
+
'notebookActions.insertCodeCellBelow',
|
|
92
|
+
"Insert Code Cell Below"
|
|
93
|
+
)),
|
|
94
|
+
keybinding: {
|
|
95
|
+
primary: 2048 | 3 ,
|
|
96
|
+
when: ( ContextKeyExpr.and(NOTEBOOK_CELL_LIST_FOCUSED, ( InputFocusedContext.toNegated()), ( CTX_NOTEBOOK_CHAT_OUTER_FOCUS_POSITION.isEqualTo('')))),
|
|
97
|
+
weight: 200
|
|
98
|
+
},
|
|
99
|
+
menu: {
|
|
100
|
+
id: MenuId.NotebookCellInsert,
|
|
101
|
+
order: 1
|
|
102
|
+
}
|
|
103
|
+
}, CellKind.Code, 'below', true);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
registerAction2(class InsertCodeCellBelowAndFocusContainerAction extends InsertCellCommand {
|
|
107
|
+
constructor() {
|
|
108
|
+
super({
|
|
109
|
+
id: INSERT_CODE_CELL_BELOW_AND_FOCUS_CONTAINER_COMMAND_ID,
|
|
110
|
+
title: ( localizeWithPath(
|
|
111
|
+
'vs/workbench/contrib/notebook/browser/controller/insertCellActions',
|
|
112
|
+
'notebookActions.insertCodeCellBelowAndFocusContainer',
|
|
113
|
+
"Insert Code Cell Below and Focus Container"
|
|
114
|
+
)),
|
|
115
|
+
}, CellKind.Code, 'below', false);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
registerAction2(class InsertMarkdownCellAboveAction extends InsertCellCommand {
|
|
119
|
+
constructor() {
|
|
120
|
+
super({
|
|
121
|
+
id: INSERT_MARKDOWN_CELL_ABOVE_COMMAND_ID,
|
|
122
|
+
title: ( localizeWithPath(
|
|
123
|
+
'vs/workbench/contrib/notebook/browser/controller/insertCellActions',
|
|
124
|
+
'notebookActions.insertMarkdownCellAbove',
|
|
125
|
+
"Insert Markdown Cell Above"
|
|
126
|
+
)),
|
|
127
|
+
menu: {
|
|
128
|
+
id: MenuId.NotebookCellInsert,
|
|
129
|
+
order: 2
|
|
130
|
+
}
|
|
131
|
+
}, CellKind.Markup, 'above', true);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
registerAction2(class InsertMarkdownCellBelowAction extends InsertCellCommand {
|
|
135
|
+
constructor() {
|
|
136
|
+
super({
|
|
137
|
+
id: INSERT_MARKDOWN_CELL_BELOW_COMMAND_ID,
|
|
138
|
+
title: ( localizeWithPath(
|
|
139
|
+
'vs/workbench/contrib/notebook/browser/controller/insertCellActions',
|
|
140
|
+
'notebookActions.insertMarkdownCellBelow',
|
|
141
|
+
"Insert Markdown Cell Below"
|
|
142
|
+
)),
|
|
143
|
+
menu: {
|
|
144
|
+
id: MenuId.NotebookCellInsert,
|
|
145
|
+
order: 3
|
|
146
|
+
}
|
|
147
|
+
}, CellKind.Markup, 'below', true);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
registerAction2(class InsertCodeCellAtTopAction extends NotebookAction {
|
|
151
|
+
constructor() {
|
|
152
|
+
super({
|
|
153
|
+
id: INSERT_CODE_CELL_AT_TOP_COMMAND_ID,
|
|
154
|
+
title: ( localizeWithPath(
|
|
155
|
+
'vs/workbench/contrib/notebook/browser/controller/insertCellActions',
|
|
156
|
+
'notebookActions.insertCodeCellAtTop',
|
|
157
|
+
"Add Code Cell At Top"
|
|
158
|
+
)),
|
|
159
|
+
f1: false
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
async run(accessor, context) {
|
|
163
|
+
context = context ?? this.getEditorContextFromArgsOrActive(accessor);
|
|
164
|
+
if (context) {
|
|
165
|
+
this.runWithContext(accessor, context);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
async runWithContext(accessor, context) {
|
|
169
|
+
const languageService = accessor.get(ILanguageService);
|
|
170
|
+
const newCell = insertCell(languageService, context.notebookEditor, 0, CellKind.Code, 'above', undefined, true);
|
|
171
|
+
if (newCell) {
|
|
172
|
+
await context.notebookEditor.focusNotebookCell(newCell, 'editor');
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
registerAction2(class InsertMarkdownCellAtTopAction extends NotebookAction {
|
|
177
|
+
constructor() {
|
|
178
|
+
super({
|
|
179
|
+
id: INSERT_MARKDOWN_CELL_AT_TOP_COMMAND_ID,
|
|
180
|
+
title: ( localizeWithPath(
|
|
181
|
+
'vs/workbench/contrib/notebook/browser/controller/insertCellActions',
|
|
182
|
+
'notebookActions.insertMarkdownCellAtTop',
|
|
183
|
+
"Add Markdown Cell At Top"
|
|
184
|
+
)),
|
|
185
|
+
f1: false
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
async run(accessor, context) {
|
|
189
|
+
context = context ?? this.getEditorContextFromArgsOrActive(accessor);
|
|
190
|
+
if (context) {
|
|
191
|
+
this.runWithContext(accessor, context);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
async runWithContext(accessor, context) {
|
|
195
|
+
const languageService = accessor.get(ILanguageService);
|
|
196
|
+
const newCell = insertCell(languageService, context.notebookEditor, 0, CellKind.Markup, 'above', undefined, true);
|
|
197
|
+
if (newCell) {
|
|
198
|
+
await context.notebookEditor.focusNotebookCell(newCell, 'editor');
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
MenuRegistry.appendMenuItem(MenuId.NotebookCellBetween, {
|
|
203
|
+
command: {
|
|
204
|
+
id: INSERT_CODE_CELL_BELOW_COMMAND_ID,
|
|
205
|
+
title: '$(add) ' + ( localizeWithPath(
|
|
206
|
+
'vs/workbench/contrib/notebook/browser/controller/insertCellActions',
|
|
207
|
+
'notebookActions.menu.insertCode',
|
|
208
|
+
"Code"
|
|
209
|
+
)),
|
|
210
|
+
tooltip: ( localizeWithPath(
|
|
211
|
+
'vs/workbench/contrib/notebook/browser/controller/insertCellActions',
|
|
212
|
+
'notebookActions.menu.insertCode.tooltip',
|
|
213
|
+
"Add Code Cell"
|
|
214
|
+
))
|
|
215
|
+
},
|
|
216
|
+
order: 0,
|
|
217
|
+
group: 'inline',
|
|
218
|
+
when: ( ContextKeyExpr.and(( NOTEBOOK_EDITOR_EDITABLE.isEqualTo(true)), ( ContextKeyExpr.notEquals('config.notebook.experimental.insertToolbarAlignment', 'left'))))
|
|
219
|
+
});
|
|
220
|
+
MenuRegistry.appendMenuItem(MenuId.NotebookCellBetween, {
|
|
221
|
+
command: {
|
|
222
|
+
id: INSERT_CODE_CELL_BELOW_COMMAND_ID,
|
|
223
|
+
title: ( localizeWithPath(
|
|
224
|
+
'vs/workbench/contrib/notebook/browser/controller/insertCellActions',
|
|
225
|
+
'notebookActions.menu.insertCode.minimalToolbar',
|
|
226
|
+
"Add Code"
|
|
227
|
+
)),
|
|
228
|
+
icon: Codicon.add,
|
|
229
|
+
tooltip: ( localizeWithPath(
|
|
230
|
+
'vs/workbench/contrib/notebook/browser/controller/insertCellActions',
|
|
231
|
+
'notebookActions.menu.insertCode.tooltip',
|
|
232
|
+
"Add Code Cell"
|
|
233
|
+
))
|
|
234
|
+
},
|
|
235
|
+
order: 0,
|
|
236
|
+
group: 'inline',
|
|
237
|
+
when: ( ContextKeyExpr.and(( NOTEBOOK_EDITOR_EDITABLE.isEqualTo(true)), ( ContextKeyExpr.equals('config.notebook.experimental.insertToolbarAlignment', 'left'))))
|
|
238
|
+
});
|
|
239
|
+
MenuRegistry.appendMenuItem(MenuId.NotebookToolbar, {
|
|
240
|
+
command: {
|
|
241
|
+
id: INSERT_CODE_CELL_BELOW_COMMAND_ID,
|
|
242
|
+
icon: Codicon.add,
|
|
243
|
+
title: ( localizeWithPath(
|
|
244
|
+
'vs/workbench/contrib/notebook/browser/controller/insertCellActions',
|
|
245
|
+
'notebookActions.menu.insertCode.ontoolbar',
|
|
246
|
+
"Code"
|
|
247
|
+
)),
|
|
248
|
+
tooltip: ( localizeWithPath(
|
|
249
|
+
'vs/workbench/contrib/notebook/browser/controller/insertCellActions',
|
|
250
|
+
'notebookActions.menu.insertCode.tooltip',
|
|
251
|
+
"Add Code Cell"
|
|
252
|
+
))
|
|
253
|
+
},
|
|
254
|
+
order: -5,
|
|
255
|
+
group: 'navigation/add',
|
|
256
|
+
when: ( ContextKeyExpr.and(( NOTEBOOK_EDITOR_EDITABLE.isEqualTo(true)), ( ContextKeyExpr.notEquals('config.notebook.insertToolbarLocation', 'betweenCells')), ( ContextKeyExpr.notEquals('config.notebook.insertToolbarLocation', 'hidden'))))
|
|
257
|
+
});
|
|
258
|
+
MenuRegistry.appendMenuItem(MenuId.NotebookCellListTop, {
|
|
259
|
+
command: {
|
|
260
|
+
id: INSERT_CODE_CELL_AT_TOP_COMMAND_ID,
|
|
261
|
+
title: '$(add) ' + ( localizeWithPath(
|
|
262
|
+
'vs/workbench/contrib/notebook/browser/controller/insertCellActions',
|
|
263
|
+
'notebookActions.menu.insertCode',
|
|
264
|
+
"Code"
|
|
265
|
+
)),
|
|
266
|
+
tooltip: ( localizeWithPath(
|
|
267
|
+
'vs/workbench/contrib/notebook/browser/controller/insertCellActions',
|
|
268
|
+
'notebookActions.menu.insertCode.tooltip',
|
|
269
|
+
"Add Code Cell"
|
|
270
|
+
))
|
|
271
|
+
},
|
|
272
|
+
order: 0,
|
|
273
|
+
group: 'inline',
|
|
274
|
+
when: ( ContextKeyExpr.and(( NOTEBOOK_EDITOR_EDITABLE.isEqualTo(true)), ( ContextKeyExpr.notEquals('config.notebook.experimental.insertToolbarAlignment', 'left'))))
|
|
275
|
+
});
|
|
276
|
+
MenuRegistry.appendMenuItem(MenuId.NotebookCellListTop, {
|
|
277
|
+
command: {
|
|
278
|
+
id: INSERT_CODE_CELL_AT_TOP_COMMAND_ID,
|
|
279
|
+
title: ( localizeWithPath(
|
|
280
|
+
'vs/workbench/contrib/notebook/browser/controller/insertCellActions',
|
|
281
|
+
'notebookActions.menu.insertCode.minimaltoolbar',
|
|
282
|
+
"Add Code"
|
|
283
|
+
)),
|
|
284
|
+
icon: Codicon.add,
|
|
285
|
+
tooltip: ( localizeWithPath(
|
|
286
|
+
'vs/workbench/contrib/notebook/browser/controller/insertCellActions',
|
|
287
|
+
'notebookActions.menu.insertCode.tooltip',
|
|
288
|
+
"Add Code Cell"
|
|
289
|
+
))
|
|
290
|
+
},
|
|
291
|
+
order: 0,
|
|
292
|
+
group: 'inline',
|
|
293
|
+
when: ( ContextKeyExpr.and(( NOTEBOOK_EDITOR_EDITABLE.isEqualTo(true)), ( ContextKeyExpr.equals('config.notebook.experimental.insertToolbarAlignment', 'left'))))
|
|
294
|
+
});
|
|
295
|
+
MenuRegistry.appendMenuItem(MenuId.NotebookCellBetween, {
|
|
296
|
+
command: {
|
|
297
|
+
id: INSERT_MARKDOWN_CELL_BELOW_COMMAND_ID,
|
|
298
|
+
title: '$(add) ' + ( localizeWithPath(
|
|
299
|
+
'vs/workbench/contrib/notebook/browser/controller/insertCellActions',
|
|
300
|
+
'notebookActions.menu.insertMarkdown',
|
|
301
|
+
"Markdown"
|
|
302
|
+
)),
|
|
303
|
+
tooltip: ( localizeWithPath(
|
|
304
|
+
'vs/workbench/contrib/notebook/browser/controller/insertCellActions',
|
|
305
|
+
'notebookActions.menu.insertMarkdown.tooltip',
|
|
306
|
+
"Add Markdown Cell"
|
|
307
|
+
))
|
|
308
|
+
},
|
|
309
|
+
order: 1,
|
|
310
|
+
group: 'inline',
|
|
311
|
+
when: ( ContextKeyExpr.and(( NOTEBOOK_EDITOR_EDITABLE.isEqualTo(true)), ( ContextKeyExpr.notEquals('config.notebook.experimental.insertToolbarAlignment', 'left'))))
|
|
312
|
+
});
|
|
313
|
+
MenuRegistry.appendMenuItem(MenuId.NotebookToolbar, {
|
|
314
|
+
command: {
|
|
315
|
+
id: INSERT_MARKDOWN_CELL_BELOW_COMMAND_ID,
|
|
316
|
+
icon: Codicon.add,
|
|
317
|
+
title: ( localizeWithPath(
|
|
318
|
+
'vs/workbench/contrib/notebook/browser/controller/insertCellActions',
|
|
319
|
+
'notebookActions.menu.insertMarkdown.ontoolbar',
|
|
320
|
+
"Markdown"
|
|
321
|
+
)),
|
|
322
|
+
tooltip: ( localizeWithPath(
|
|
323
|
+
'vs/workbench/contrib/notebook/browser/controller/insertCellActions',
|
|
324
|
+
'notebookActions.menu.insertMarkdown.tooltip',
|
|
325
|
+
"Add Markdown Cell"
|
|
326
|
+
))
|
|
327
|
+
},
|
|
328
|
+
order: -5,
|
|
329
|
+
group: 'navigation/add',
|
|
330
|
+
when: ( ContextKeyExpr.and(( NOTEBOOK_EDITOR_EDITABLE.isEqualTo(true)), ( ContextKeyExpr.notEquals('config.notebook.insertToolbarLocation', 'betweenCells')), ( ContextKeyExpr.notEquals('config.notebook.insertToolbarLocation', 'hidden')), ( ContextKeyExpr.notEquals(`config.${NotebookSetting.globalToolbarShowLabel}`, false)), ( ContextKeyExpr.notEquals(`config.${NotebookSetting.globalToolbarShowLabel}`, 'never'))))
|
|
331
|
+
});
|
|
332
|
+
MenuRegistry.appendMenuItem(MenuId.NotebookCellListTop, {
|
|
333
|
+
command: {
|
|
334
|
+
id: INSERT_MARKDOWN_CELL_AT_TOP_COMMAND_ID,
|
|
335
|
+
title: '$(add) ' + ( localizeWithPath(
|
|
336
|
+
'vs/workbench/contrib/notebook/browser/controller/insertCellActions',
|
|
337
|
+
'notebookActions.menu.insertMarkdown',
|
|
338
|
+
"Markdown"
|
|
339
|
+
)),
|
|
340
|
+
tooltip: ( localizeWithPath(
|
|
341
|
+
'vs/workbench/contrib/notebook/browser/controller/insertCellActions',
|
|
342
|
+
'notebookActions.menu.insertMarkdown.tooltip',
|
|
343
|
+
"Add Markdown Cell"
|
|
344
|
+
))
|
|
345
|
+
},
|
|
346
|
+
order: 1,
|
|
347
|
+
group: 'inline',
|
|
348
|
+
when: ( ContextKeyExpr.and(( NOTEBOOK_EDITOR_EDITABLE.isEqualTo(true)), ( ContextKeyExpr.notEquals('config.notebook.experimental.insertToolbarAlignment', 'left'))))
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
export { InsertCellCommand, insertNewCell };
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
2
|
+
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
3
|
+
import { localize2WithPath, localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
4
|
+
import { Categories } from 'vscode/vscode/vs/platform/action/common/actionCommonCategories';
|
|
5
|
+
import { registerAction2, Action2, MenuId, MenuRegistry } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
6
|
+
import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands';
|
|
7
|
+
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
8
|
+
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
9
|
+
import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput';
|
|
10
|
+
import { NOTEBOOK_ACTIONS_CATEGORY } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/coreActions';
|
|
11
|
+
import { getNotebookEditorFromEditorPane } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
|
|
12
|
+
import { INotebookEditorService } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/services/notebookEditorService';
|
|
13
|
+
import { NotebookSetting } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
14
|
+
import { NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_EDITOR_FOCUSED } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
|
|
15
|
+
import { INotebookService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookService';
|
|
16
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
17
|
+
import { IPreferencesService } from 'vscode/vscode/vs/workbench/services/preferences/common/preferences';
|
|
18
|
+
|
|
19
|
+
registerAction2(class NotebookConfigureLayoutAction extends Action2 {
|
|
20
|
+
constructor() {
|
|
21
|
+
super({
|
|
22
|
+
id: 'workbench.notebook.layout.select',
|
|
23
|
+
title: ( localize2WithPath(
|
|
24
|
+
'vs/workbench/contrib/notebook/browser/controller/layoutActions',
|
|
25
|
+
'workbench.notebook.layout.select.label',
|
|
26
|
+
"Select between Notebook Layouts"
|
|
27
|
+
)),
|
|
28
|
+
f1: true,
|
|
29
|
+
precondition: ( ContextKeyExpr.equals(`config.${NotebookSetting.openGettingStarted}`, true)),
|
|
30
|
+
category: NOTEBOOK_ACTIONS_CATEGORY,
|
|
31
|
+
menu: [
|
|
32
|
+
{
|
|
33
|
+
id: MenuId.EditorTitle,
|
|
34
|
+
group: 'notebookLayout',
|
|
35
|
+
when: ( ContextKeyExpr.and(NOTEBOOK_IS_ACTIVE_EDITOR, ( ContextKeyExpr.notEquals('config.notebook.globalToolbar', true)), ( ContextKeyExpr.equals(`config.${NotebookSetting.openGettingStarted}`, true)))),
|
|
36
|
+
order: 0
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: MenuId.NotebookToolbar,
|
|
40
|
+
group: 'notebookLayout',
|
|
41
|
+
when: ( ContextKeyExpr.and(( ContextKeyExpr.equals('config.notebook.globalToolbar', true)), ( ContextKeyExpr.equals(`config.${NotebookSetting.openGettingStarted}`, true)))),
|
|
42
|
+
order: 0
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
run(accessor) {
|
|
48
|
+
accessor.get(ICommandService).executeCommand('workbench.action.openWalkthrough', { category: 'notebooks', step: 'notebookProfile' }, true);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
registerAction2(class NotebookConfigureLayoutAction extends Action2 {
|
|
52
|
+
constructor() {
|
|
53
|
+
super({
|
|
54
|
+
id: 'workbench.notebook.layout.configure',
|
|
55
|
+
title: ( localize2WithPath(
|
|
56
|
+
'vs/workbench/contrib/notebook/browser/controller/layoutActions',
|
|
57
|
+
'workbench.notebook.layout.configure.label',
|
|
58
|
+
"Customize Notebook Layout"
|
|
59
|
+
)),
|
|
60
|
+
f1: true,
|
|
61
|
+
category: NOTEBOOK_ACTIONS_CATEGORY,
|
|
62
|
+
menu: [
|
|
63
|
+
{
|
|
64
|
+
id: MenuId.NotebookToolbar,
|
|
65
|
+
group: 'notebookLayout',
|
|
66
|
+
when: ( ContextKeyExpr.equals('config.notebook.globalToolbar', true)),
|
|
67
|
+
order: 1
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
run(accessor) {
|
|
73
|
+
accessor.get(IPreferencesService).openSettings({ jsonEditor: false, query: '@tag:notebookLayout' });
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
registerAction2(class NotebookConfigureLayoutFromEditorTitle extends Action2 {
|
|
77
|
+
constructor() {
|
|
78
|
+
super({
|
|
79
|
+
id: 'workbench.notebook.layout.configure.editorTitle',
|
|
80
|
+
title: ( localize2WithPath(
|
|
81
|
+
'vs/workbench/contrib/notebook/browser/controller/layoutActions',
|
|
82
|
+
'workbench.notebook.layout.configure.label',
|
|
83
|
+
"Customize Notebook Layout"
|
|
84
|
+
)),
|
|
85
|
+
f1: false,
|
|
86
|
+
category: NOTEBOOK_ACTIONS_CATEGORY,
|
|
87
|
+
menu: [
|
|
88
|
+
{
|
|
89
|
+
id: MenuId.NotebookEditorLayoutConfigure,
|
|
90
|
+
group: 'notebookLayout',
|
|
91
|
+
when: NOTEBOOK_IS_ACTIVE_EDITOR,
|
|
92
|
+
order: 1
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
run(accessor) {
|
|
98
|
+
accessor.get(IPreferencesService).openSettings({ jsonEditor: false, query: '@tag:notebookLayout' });
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
|
|
102
|
+
submenu: MenuId.NotebookEditorLayoutConfigure,
|
|
103
|
+
rememberDefaultAction: false,
|
|
104
|
+
title: ( localize2WithPath(
|
|
105
|
+
'vs/workbench/contrib/notebook/browser/controller/layoutActions',
|
|
106
|
+
'customizeNotebook',
|
|
107
|
+
"Customize Notebook..."
|
|
108
|
+
)),
|
|
109
|
+
icon: Codicon.gear,
|
|
110
|
+
group: 'navigation',
|
|
111
|
+
order: -1,
|
|
112
|
+
when: NOTEBOOK_IS_ACTIVE_EDITOR
|
|
113
|
+
});
|
|
114
|
+
registerAction2(class ToggleLineNumberFromEditorTitle extends Action2 {
|
|
115
|
+
constructor() {
|
|
116
|
+
super({
|
|
117
|
+
id: 'notebook.toggleLineNumbersFromEditorTitle',
|
|
118
|
+
title: ( localize2WithPath(
|
|
119
|
+
'vs/workbench/contrib/notebook/browser/controller/layoutActions',
|
|
120
|
+
'notebook.toggleLineNumbers',
|
|
121
|
+
'Toggle Notebook Line Numbers'
|
|
122
|
+
)),
|
|
123
|
+
precondition: NOTEBOOK_EDITOR_FOCUSED,
|
|
124
|
+
menu: [
|
|
125
|
+
{
|
|
126
|
+
id: MenuId.NotebookEditorLayoutConfigure,
|
|
127
|
+
group: 'notebookLayoutDetails',
|
|
128
|
+
order: 1,
|
|
129
|
+
when: NOTEBOOK_IS_ACTIVE_EDITOR
|
|
130
|
+
}
|
|
131
|
+
],
|
|
132
|
+
category: NOTEBOOK_ACTIONS_CATEGORY,
|
|
133
|
+
f1: true,
|
|
134
|
+
toggled: {
|
|
135
|
+
condition: ( ContextKeyExpr.notEquals('config.notebook.lineNumbers', 'off')),
|
|
136
|
+
title: ( localizeWithPath(
|
|
137
|
+
'vs/workbench/contrib/notebook/browser/controller/layoutActions',
|
|
138
|
+
'notebook.showLineNumbers',
|
|
139
|
+
"Notebook Line Numbers"
|
|
140
|
+
)),
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
async run(accessor) {
|
|
145
|
+
return accessor.get(ICommandService).executeCommand('notebook.toggleLineNumbers');
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
registerAction2(class ToggleCellToolbarPositionFromEditorTitle extends Action2 {
|
|
149
|
+
constructor() {
|
|
150
|
+
super({
|
|
151
|
+
id: 'notebook.toggleCellToolbarPositionFromEditorTitle',
|
|
152
|
+
title: ( localize2WithPath(
|
|
153
|
+
'vs/workbench/contrib/notebook/browser/controller/layoutActions',
|
|
154
|
+
'notebook.toggleCellToolbarPosition',
|
|
155
|
+
'Toggle Cell Toolbar Position'
|
|
156
|
+
)),
|
|
157
|
+
menu: [{
|
|
158
|
+
id: MenuId.NotebookEditorLayoutConfigure,
|
|
159
|
+
group: 'notebookLayoutDetails',
|
|
160
|
+
order: 3
|
|
161
|
+
}],
|
|
162
|
+
category: NOTEBOOK_ACTIONS_CATEGORY,
|
|
163
|
+
f1: false
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
async run(accessor, ...args) {
|
|
167
|
+
return accessor.get(ICommandService).executeCommand('notebook.toggleCellToolbarPosition', ...args);
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
registerAction2(class ToggleBreadcrumbFromEditorTitle extends Action2 {
|
|
171
|
+
constructor() {
|
|
172
|
+
super({
|
|
173
|
+
id: 'breadcrumbs.toggleFromEditorTitle',
|
|
174
|
+
title: ( localize2WithPath(
|
|
175
|
+
'vs/workbench/contrib/notebook/browser/controller/layoutActions',
|
|
176
|
+
'notebook.toggleBreadcrumb',
|
|
177
|
+
'Toggle Breadcrumbs'
|
|
178
|
+
)),
|
|
179
|
+
menu: [{
|
|
180
|
+
id: MenuId.NotebookEditorLayoutConfigure,
|
|
181
|
+
group: 'notebookLayoutDetails',
|
|
182
|
+
order: 2
|
|
183
|
+
}],
|
|
184
|
+
f1: false
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
async run(accessor) {
|
|
188
|
+
return accessor.get(ICommandService).executeCommand('breadcrumbs.toggle');
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
registerAction2(class SaveMimeTypeDisplayOrder extends Action2 {
|
|
192
|
+
constructor() {
|
|
193
|
+
super({
|
|
194
|
+
id: 'notebook.saveMimeTypeOrder',
|
|
195
|
+
title: ( localize2WithPath(
|
|
196
|
+
'vs/workbench/contrib/notebook/browser/controller/layoutActions',
|
|
197
|
+
'notebook.saveMimeTypeOrder',
|
|
198
|
+
"Save Mimetype Display Order"
|
|
199
|
+
)),
|
|
200
|
+
f1: true,
|
|
201
|
+
category: NOTEBOOK_ACTIONS_CATEGORY,
|
|
202
|
+
precondition: NOTEBOOK_IS_ACTIVE_EDITOR,
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
run(accessor) {
|
|
206
|
+
const service = accessor.get(INotebookService);
|
|
207
|
+
const qp = accessor.get(IQuickInputService).createQuickPick();
|
|
208
|
+
qp.placeholder = ( localizeWithPath(
|
|
209
|
+
'vs/workbench/contrib/notebook/browser/controller/layoutActions',
|
|
210
|
+
'notebook.placeholder',
|
|
211
|
+
'Settings file to save in'
|
|
212
|
+
));
|
|
213
|
+
qp.items = [
|
|
214
|
+
{ target: 2 , label: ( localizeWithPath(
|
|
215
|
+
'vs/workbench/contrib/notebook/browser/controller/layoutActions',
|
|
216
|
+
'saveTarget.machine',
|
|
217
|
+
'User Settings'
|
|
218
|
+
)) },
|
|
219
|
+
{ target: 5 , label: ( localizeWithPath(
|
|
220
|
+
'vs/workbench/contrib/notebook/browser/controller/layoutActions',
|
|
221
|
+
'saveTarget.workspace',
|
|
222
|
+
'Workspace Settings'
|
|
223
|
+
)) },
|
|
224
|
+
];
|
|
225
|
+
qp.onDidAccept(() => {
|
|
226
|
+
const target = qp.selectedItems[0]?.target;
|
|
227
|
+
if (target !== undefined) {
|
|
228
|
+
service.saveMimeDisplayOrder(target);
|
|
229
|
+
}
|
|
230
|
+
qp.dispose();
|
|
231
|
+
});
|
|
232
|
+
qp.onDidHide(() => qp.dispose());
|
|
233
|
+
qp.show();
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
registerAction2(class NotebookWebviewResetAction extends Action2 {
|
|
237
|
+
constructor() {
|
|
238
|
+
super({
|
|
239
|
+
id: 'workbench.notebook.layout.webview.reset',
|
|
240
|
+
title: ( localize2WithPath(
|
|
241
|
+
'vs/workbench/contrib/notebook/browser/controller/layoutActions',
|
|
242
|
+
'workbench.notebook.layout.webview.reset.label',
|
|
243
|
+
"Reset Notebook Webview"
|
|
244
|
+
)),
|
|
245
|
+
f1: false,
|
|
246
|
+
category: NOTEBOOK_ACTIONS_CATEGORY
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
run(accessor, args) {
|
|
250
|
+
const editorService = accessor.get(IEditorService);
|
|
251
|
+
if (args) {
|
|
252
|
+
const uri = URI.revive(args);
|
|
253
|
+
const notebookEditorService = accessor.get(INotebookEditorService);
|
|
254
|
+
const widgets = notebookEditorService.listNotebookEditors().filter(widget => widget.hasModel() && ( widget.textModel.uri.toString()) === ( uri.toString()));
|
|
255
|
+
for (const widget of widgets) {
|
|
256
|
+
if (widget.hasModel()) {
|
|
257
|
+
widget.getInnerWebview()?.reload();
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
const editor = getNotebookEditorFromEditorPane(editorService.activeEditorPane);
|
|
263
|
+
if (!editor) {
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
editor.getInnerWebview()?.reload();
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
registerAction2(class ToggleNotebookStickyScroll extends Action2 {
|
|
271
|
+
constructor() {
|
|
272
|
+
super({
|
|
273
|
+
id: 'notebook.action.toggleNotebookStickyScroll',
|
|
274
|
+
title: {
|
|
275
|
+
...( localize2WithPath(
|
|
276
|
+
'vs/workbench/contrib/notebook/browser/controller/layoutActions',
|
|
277
|
+
'toggleStickyScroll',
|
|
278
|
+
"Toggle Notebook Sticky Scroll"
|
|
279
|
+
)),
|
|
280
|
+
mnemonicTitle: ( localizeWithPath(
|
|
281
|
+
'vs/workbench/contrib/notebook/browser/controller/layoutActions',
|
|
282
|
+
{ key: 'mitoggleNotebookStickyScroll', comment: ['&& denotes a mnemonic'] },
|
|
283
|
+
"&&Toggle Notebook Sticky Scroll"
|
|
284
|
+
)),
|
|
285
|
+
},
|
|
286
|
+
category: Categories.View,
|
|
287
|
+
toggled: {
|
|
288
|
+
condition: ( ContextKeyExpr.equals('config.notebook.stickyScroll.enabled', true)),
|
|
289
|
+
title: ( localizeWithPath(
|
|
290
|
+
'vs/workbench/contrib/notebook/browser/controller/layoutActions',
|
|
291
|
+
'notebookStickyScroll',
|
|
292
|
+
"Toggle Notebook Sticky Scroll"
|
|
293
|
+
)),
|
|
294
|
+
mnemonicTitle: ( localizeWithPath(
|
|
295
|
+
'vs/workbench/contrib/notebook/browser/controller/layoutActions',
|
|
296
|
+
{ key: 'mitoggleNotebookStickyScroll', comment: ['&& denotes a mnemonic'] },
|
|
297
|
+
"&&Toggle Notebook Sticky Scroll"
|
|
298
|
+
)),
|
|
299
|
+
},
|
|
300
|
+
menu: [
|
|
301
|
+
{ id: MenuId.CommandPalette },
|
|
302
|
+
{
|
|
303
|
+
id: MenuId.NotebookStickyScrollContext,
|
|
304
|
+
group: 'notebookView',
|
|
305
|
+
order: 2
|
|
306
|
+
}
|
|
307
|
+
]
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
async run(accessor) {
|
|
311
|
+
const configurationService = accessor.get(IConfigurationService);
|
|
312
|
+
const newValue = !configurationService.getValue('notebook.stickyScroll.enabled');
|
|
313
|
+
return configurationService.updateValue('notebook.stickyScroll.enabled', newValue);
|
|
314
|
+
}
|
|
315
|
+
});
|