@codingame/monaco-vscode-notebook-service-override 2.2.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +6 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +101 -161
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +4 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +85 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +8 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +3 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +34 -12
- 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 +55 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +39 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +1 -41
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +17 -26
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +3 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +565 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.js +31 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatController.js +744 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +28 -23
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +351 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +41 -42
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +31 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +25 -16
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +118 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +6 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +6 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +2 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +3 -39
- package/vscode/src/vs/workbench/contrib/search/browser/notebookSearch/notebookSearchService.js +43 -11
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +5 -1
|
@@ -2,8 +2,8 @@ import { Iterable } from 'vscode/vscode/vs/base/common/iterator';
|
|
|
2
2
|
import { isEqual } from 'vscode/vscode/vs/base/common/resources';
|
|
3
3
|
import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
|
|
4
4
|
import { ILanguageService } from 'vscode/vscode/vs/editor/common/languages/language';
|
|
5
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
6
|
-
import { registerAction2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
5
|
+
import { localizeWithPath, localize2WithPath } from 'vscode/vscode/vs/nls';
|
|
6
|
+
import { registerAction2, MenuId, MenuRegistry } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
7
7
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
8
8
|
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
9
9
|
import { IDebugService } from 'vscode/vscode/vs/workbench/contrib/debug/common/debug';
|
|
@@ -507,14 +507,11 @@ registerAction2(class CancelAllNotebook extends CancelNotebook {
|
|
|
507
507
|
constructor() {
|
|
508
508
|
super({
|
|
509
509
|
id: CANCEL_NOTEBOOK_COMMAND_ID,
|
|
510
|
-
title:
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
)),
|
|
516
|
-
original: 'Stop Execution'
|
|
517
|
-
},
|
|
510
|
+
title: ( localize2WithPath(
|
|
511
|
+
'vs/workbench/contrib/notebook/browser/controller/executeActions',
|
|
512
|
+
'notebookActions.cancelNotebook',
|
|
513
|
+
"Stop Execution"
|
|
514
|
+
)),
|
|
518
515
|
icon: stopIcon,
|
|
519
516
|
menu: [
|
|
520
517
|
{
|
|
@@ -537,14 +534,11 @@ registerAction2(class InterruptNotebook extends CancelNotebook {
|
|
|
537
534
|
constructor() {
|
|
538
535
|
super({
|
|
539
536
|
id: INTERRUPT_NOTEBOOK_COMMAND_ID,
|
|
540
|
-
title:
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
)),
|
|
546
|
-
original: 'Interrupt'
|
|
547
|
-
},
|
|
537
|
+
title: ( localize2WithPath(
|
|
538
|
+
'vs/workbench/contrib/notebook/browser/controller/executeActions',
|
|
539
|
+
'notebookActions.interruptNotebook',
|
|
540
|
+
"Interrupt"
|
|
541
|
+
)),
|
|
548
542
|
precondition: ( ContextKeyExpr.and(NOTEBOOK_HAS_SOMETHING_RUNNING, NOTEBOOK_INTERRUPTIBLE_KERNEL)),
|
|
549
543
|
icon: stopIcon,
|
|
550
544
|
menu: [
|
|
@@ -577,6 +571,17 @@ registerAction2(class InterruptNotebook extends CancelNotebook {
|
|
|
577
571
|
});
|
|
578
572
|
}
|
|
579
573
|
});
|
|
574
|
+
MenuRegistry.appendMenuItem(MenuId.NotebookToolbar, {
|
|
575
|
+
title: ( localizeWithPath(
|
|
576
|
+
'vs/workbench/contrib/notebook/browser/controller/executeActions',
|
|
577
|
+
'revealRunningCellShort',
|
|
578
|
+
"Go To"
|
|
579
|
+
)),
|
|
580
|
+
submenu: MenuId.NotebookCellExecuteGoTo,
|
|
581
|
+
group: 'navigation/execute',
|
|
582
|
+
order: 20,
|
|
583
|
+
icon: ThemeIcon.modify(executingStateIcon, 'spin')
|
|
584
|
+
});
|
|
580
585
|
registerAction2(class RevealRunningCellAction extends NotebookAction {
|
|
581
586
|
constructor() {
|
|
582
587
|
super({
|
|
@@ -593,8 +598,8 @@ registerAction2(class RevealRunningCellAction extends NotebookAction {
|
|
|
593
598
|
)),
|
|
594
599
|
shortTitle: ( localizeWithPath(
|
|
595
600
|
'vs/workbench/contrib/notebook/browser/controller/executeActions',
|
|
596
|
-
'
|
|
597
|
-
"Go
|
|
601
|
+
'revealRunningCell',
|
|
602
|
+
"Go to Running Cell"
|
|
598
603
|
)),
|
|
599
604
|
precondition: NOTEBOOK_HAS_RUNNING_CELL,
|
|
600
605
|
menu: [
|
|
@@ -605,7 +610,7 @@ registerAction2(class RevealRunningCellAction extends NotebookAction {
|
|
|
605
610
|
order: 0
|
|
606
611
|
},
|
|
607
612
|
{
|
|
608
|
-
id: MenuId.
|
|
613
|
+
id: MenuId.NotebookCellExecuteGoTo,
|
|
609
614
|
when: ( ContextKeyExpr.and(NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_HAS_RUNNING_CELL, ( ContextKeyExpr.equals('config.notebook.globalToolbar', true)))),
|
|
610
615
|
group: 'navigation/execute',
|
|
611
616
|
order: 20
|
|
@@ -666,7 +671,7 @@ registerAction2(class RevealLastFailedCellAction extends NotebookAction {
|
|
|
666
671
|
shortTitle: ( localizeWithPath(
|
|
667
672
|
'vs/workbench/contrib/notebook/browser/controller/executeActions',
|
|
668
673
|
'revealLastFailedCellShort',
|
|
669
|
-
"Go
|
|
674
|
+
"Go to Most Recently Failed Cell"
|
|
670
675
|
)),
|
|
671
676
|
precondition: NOTEBOOK_LAST_CELL_FAILED,
|
|
672
677
|
menu: [
|
|
@@ -677,7 +682,7 @@ registerAction2(class RevealLastFailedCellAction extends NotebookAction {
|
|
|
677
682
|
order: 0
|
|
678
683
|
},
|
|
679
684
|
{
|
|
680
|
-
id: MenuId.
|
|
685
|
+
id: MenuId.NotebookCellExecuteGoTo,
|
|
681
686
|
when: ( ContextKeyExpr.and(NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_LAST_CELL_FAILED, ( NOTEBOOK_HAS_RUNNING_CELL.toNegated()), ( ContextKeyExpr.equals('config.notebook.globalToolbar', true)))),
|
|
682
687
|
group: 'navigation/execute',
|
|
683
688
|
order: 20
|
|
@@ -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 './chat/notebookChatContext.js';
|
|
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 };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
1
2
|
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
2
|
-
import {
|
|
3
|
-
import { registerAction2, Action2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
3
|
+
import { localize2WithPath, localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
4
|
+
import { registerAction2, Action2, MenuId, MenuRegistry } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
4
5
|
import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands';
|
|
5
6
|
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
6
7
|
import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput';
|
|
@@ -17,14 +18,11 @@ registerAction2(class NotebookConfigureLayoutAction extends Action2 {
|
|
|
17
18
|
constructor() {
|
|
18
19
|
super({
|
|
19
20
|
id: 'workbench.notebook.layout.select',
|
|
20
|
-
title:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
)),
|
|
26
|
-
original: 'Select between Notebook Layouts'
|
|
27
|
-
},
|
|
21
|
+
title: ( localize2WithPath(
|
|
22
|
+
'vs/workbench/contrib/notebook/browser/controller/layoutActions',
|
|
23
|
+
'workbench.notebook.layout.select.label',
|
|
24
|
+
"Select between Notebook Layouts"
|
|
25
|
+
)),
|
|
28
26
|
f1: true,
|
|
29
27
|
precondition: ( ContextKeyExpr.equals(`config.${NotebookSetting.openGettingStarted}`, true)),
|
|
30
28
|
category: NOTEBOOK_ACTIONS_CATEGORY,
|
|
@@ -52,14 +50,11 @@ registerAction2(class NotebookConfigureLayoutAction extends Action2 {
|
|
|
52
50
|
constructor() {
|
|
53
51
|
super({
|
|
54
52
|
id: 'workbench.notebook.layout.configure',
|
|
55
|
-
title:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
)),
|
|
61
|
-
original: 'Customize Notebook Layout'
|
|
62
|
-
},
|
|
53
|
+
title: ( localize2WithPath(
|
|
54
|
+
'vs/workbench/contrib/notebook/browser/controller/layoutActions',
|
|
55
|
+
'workbench.notebook.layout.configure.label',
|
|
56
|
+
"Customize Notebook Layout"
|
|
57
|
+
)),
|
|
63
58
|
f1: true,
|
|
64
59
|
category: NOTEBOOK_ACTIONS_CATEGORY,
|
|
65
60
|
menu: [
|
|
@@ -80,14 +75,11 @@ registerAction2(class NotebookConfigureLayoutFromEditorTitle extends Action2 {
|
|
|
80
75
|
constructor() {
|
|
81
76
|
super({
|
|
82
77
|
id: 'workbench.notebook.layout.configure.editorTitle',
|
|
83
|
-
title:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
)),
|
|
89
|
-
original: 'Customize Notebook Layout'
|
|
90
|
-
},
|
|
78
|
+
title: ( localize2WithPath(
|
|
79
|
+
'vs/workbench/contrib/notebook/browser/controller/layoutActions',
|
|
80
|
+
'workbench.notebook.layout.configure.label',
|
|
81
|
+
"Customize Notebook Layout"
|
|
82
|
+
)),
|
|
91
83
|
f1: false,
|
|
92
84
|
category: NOTEBOOK_ACTIONS_CATEGORY,
|
|
93
85
|
menu: [
|
|
@@ -104,6 +96,19 @@ registerAction2(class NotebookConfigureLayoutFromEditorTitle extends Action2 {
|
|
|
104
96
|
accessor.get(IPreferencesService).openSettings({ jsonEditor: false, query: '@tag:notebookLayout' });
|
|
105
97
|
}
|
|
106
98
|
});
|
|
99
|
+
MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
|
|
100
|
+
submenu: MenuId.NotebookEditorLayoutConfigure,
|
|
101
|
+
rememberDefaultAction: false,
|
|
102
|
+
title: ( localize2WithPath(
|
|
103
|
+
'vs/workbench/contrib/notebook/browser/controller/layoutActions',
|
|
104
|
+
'customizeNotebook',
|
|
105
|
+
"Customize Notebook..."
|
|
106
|
+
)),
|
|
107
|
+
icon: Codicon.gear,
|
|
108
|
+
group: 'navigation',
|
|
109
|
+
order: -1,
|
|
110
|
+
when: NOTEBOOK_IS_ACTIVE_EDITOR
|
|
111
|
+
});
|
|
107
112
|
registerAction2(class ToggleLineNumberFromEditorTitle extends Action2 {
|
|
108
113
|
constructor() {
|
|
109
114
|
super({
|
|
@@ -185,14 +190,11 @@ registerAction2(class SaveMimeTypeDisplayOrder extends Action2 {
|
|
|
185
190
|
constructor() {
|
|
186
191
|
super({
|
|
187
192
|
id: 'notebook.saveMimeTypeOrder',
|
|
188
|
-
title:
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
)),
|
|
194
|
-
original: 'Save Mimetype Display Order'
|
|
195
|
-
},
|
|
193
|
+
title: ( localize2WithPath(
|
|
194
|
+
'vs/workbench/contrib/notebook/browser/controller/layoutActions',
|
|
195
|
+
'notebook.saveMimeTypeOrder',
|
|
196
|
+
"Save Mimetype Display Order"
|
|
197
|
+
)),
|
|
196
198
|
f1: true,
|
|
197
199
|
category: NOTEBOOK_ACTIONS_CATEGORY,
|
|
198
200
|
precondition: NOTEBOOK_IS_ACTIVE_EDITOR,
|
|
@@ -233,14 +235,11 @@ registerAction2(class NotebookWebviewResetAction extends Action2 {
|
|
|
233
235
|
constructor() {
|
|
234
236
|
super({
|
|
235
237
|
id: 'workbench.notebook.layout.webview.reset',
|
|
236
|
-
title:
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
)),
|
|
242
|
-
original: 'Reset Notebook Webview'
|
|
243
|
-
},
|
|
238
|
+
title: ( localize2WithPath(
|
|
239
|
+
'vs/workbench/contrib/notebook/browser/controller/layoutActions',
|
|
240
|
+
'workbench.notebook.layout.webview.reset.label',
|
|
241
|
+
"Reset Notebook Webview"
|
|
242
|
+
)),
|
|
244
243
|
f1: false,
|
|
245
244
|
category: NOTEBOOK_ACTIONS_CATEGORY
|
|
246
245
|
});
|