@codingame/monaco-vscode-notebook-service-override 7.1.0 → 7.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +14 -20
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +22 -23
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticsActions.js +3 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib.js +2 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +5 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +7 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +12 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +3 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +5 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +2 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +2 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +16 -19
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +2 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +2 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +3 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +4 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +13 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +2 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +15 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +4 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +25 -26
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.js +3 -20
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.js +629 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +23 -24
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +25 -26
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +18 -19
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/notebookIndentationActions.js +208 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +13 -14
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +2 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +11 -15
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +12 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +2 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +95 -163
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityHelp.js +38 -50
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibleView.js +11 -12
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +43 -53
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +2 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +2 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +5 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +2 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +2 -3
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +16 -20
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +2 -3
package/vscode/src/vs/workbench/contrib/notebook/browser/controller/notebookIndentationActions.js
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { localize } from 'vscode/vscode/vs/nls';
|
|
2
|
+
import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
3
|
+
import { IBulkEditService, ResourceTextEdit } from 'vscode/vscode/vs/editor/browser/services/bulkEditService';
|
|
4
|
+
import { Range } from 'vscode/vscode/vs/editor/common/core/range';
|
|
5
|
+
import { ITextModelService } from 'vscode/vscode/vs/editor/common/services/resolverService';
|
|
6
|
+
import { Action2, registerAction2 } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
7
|
+
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
8
|
+
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
9
|
+
import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput.service';
|
|
10
|
+
import { INotebookEditorService } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/services/notebookEditorService.service';
|
|
11
|
+
import { NotebookSetting } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
12
|
+
import { isNotebookEditorInput } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookEditorInput';
|
|
13
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
14
|
+
|
|
15
|
+
class NotebookIndentUsingTabs extends Action2 {
|
|
16
|
+
static { this.ID = 'notebook.action.indentUsingTabs'; }
|
|
17
|
+
constructor() {
|
|
18
|
+
super({
|
|
19
|
+
id: NotebookIndentUsingTabs.ID,
|
|
20
|
+
title: ( localize(10686, "Indent Using Tabs")),
|
|
21
|
+
precondition: undefined,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
run(accessor, ...args) {
|
|
25
|
+
changeNotebookIndentation(accessor, false, false);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
class NotebookIndentUsingSpaces extends Action2 {
|
|
29
|
+
static { this.ID = 'notebook.action.indentUsingSpaces'; }
|
|
30
|
+
constructor() {
|
|
31
|
+
super({
|
|
32
|
+
id: NotebookIndentUsingSpaces.ID,
|
|
33
|
+
title: ( localize(10687, "Indent Using Spaces")),
|
|
34
|
+
precondition: undefined,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
run(accessor, ...args) {
|
|
38
|
+
changeNotebookIndentation(accessor, true, false);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
class NotebookChangeTabDisplaySize extends Action2 {
|
|
42
|
+
static { this.ID = 'notebook.action.changeTabDisplaySize'; }
|
|
43
|
+
constructor() {
|
|
44
|
+
super({
|
|
45
|
+
id: NotebookChangeTabDisplaySize.ID,
|
|
46
|
+
title: ( localize(10688, "Change Tab Display Size")),
|
|
47
|
+
precondition: undefined,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
run(accessor, ...args) {
|
|
51
|
+
changeNotebookIndentation(accessor, true, true);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
class NotebookIndentationToSpacesAction extends Action2 {
|
|
55
|
+
static { this.ID = 'notebook.action.convertIndentationToSpaces'; }
|
|
56
|
+
constructor() {
|
|
57
|
+
super({
|
|
58
|
+
id: NotebookIndentationToSpacesAction.ID,
|
|
59
|
+
title: ( localize(10689, "Convert Indentation to Spaces")),
|
|
60
|
+
precondition: undefined,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
run(accessor, ...args) {
|
|
64
|
+
convertNotebookIndentation(accessor, true);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
class NotebookIndentationToTabsAction extends Action2 {
|
|
68
|
+
static { this.ID = 'notebook.action.convertIndentationToTabs'; }
|
|
69
|
+
constructor() {
|
|
70
|
+
super({
|
|
71
|
+
id: NotebookIndentationToTabsAction.ID,
|
|
72
|
+
title: ( localize(10690, "Convert Indentation to Tabs")),
|
|
73
|
+
precondition: undefined,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
run(accessor, ...args) {
|
|
77
|
+
convertNotebookIndentation(accessor, false);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function changeNotebookIndentation(accessor, insertSpaces, displaySizeOnly) {
|
|
81
|
+
const editorService = accessor.get(IEditorService);
|
|
82
|
+
const configurationService = accessor.get(IConfigurationService);
|
|
83
|
+
const notebookEditorService = accessor.get(INotebookEditorService);
|
|
84
|
+
const quickInputService = accessor.get(IQuickInputService);
|
|
85
|
+
const activeInput = editorService.activeEditorPane?.input;
|
|
86
|
+
const isNotebook = isNotebookEditorInput(activeInput);
|
|
87
|
+
if (!isNotebook) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const notebookEditor = notebookEditorService.retrieveExistingWidgetFromURI(activeInput.resource)?.value;
|
|
91
|
+
if (!notebookEditor) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const picks = ( ([1, 2, 3, 4, 5, 6, 7, 8].map(n => ({
|
|
95
|
+
id: ( (n.toString())),
|
|
96
|
+
label: ( (n.toString())),
|
|
97
|
+
}))));
|
|
98
|
+
const initialConfig = configurationService.getValue(NotebookSetting.cellEditorOptionsCustomizations);
|
|
99
|
+
const initialInsertSpaces = initialConfig['editor.insertSpaces'];
|
|
100
|
+
delete initialConfig['editor.indentSize'];
|
|
101
|
+
delete initialConfig['editor.tabSize'];
|
|
102
|
+
delete initialConfig['editor.insertSpaces'];
|
|
103
|
+
setTimeout(() => {
|
|
104
|
+
quickInputService.pick(picks, { placeHolder: ( localize(10691, "Select Tab Size for Current File")) }).then(pick => {
|
|
105
|
+
if (pick) {
|
|
106
|
+
const pickedVal = parseInt(pick.label, 10);
|
|
107
|
+
if (displaySizeOnly) {
|
|
108
|
+
configurationService.updateValue(NotebookSetting.cellEditorOptionsCustomizations, {
|
|
109
|
+
...initialConfig,
|
|
110
|
+
'editor.tabSize': pickedVal,
|
|
111
|
+
'editor.indentSize': pickedVal,
|
|
112
|
+
'editor.insertSpaces': initialInsertSpaces
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
configurationService.updateValue(NotebookSetting.cellEditorOptionsCustomizations, {
|
|
117
|
+
...initialConfig,
|
|
118
|
+
'editor.tabSize': pickedVal,
|
|
119
|
+
'editor.indentSize': pickedVal,
|
|
120
|
+
'editor.insertSpaces': insertSpaces
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}, 50 );
|
|
126
|
+
}
|
|
127
|
+
function convertNotebookIndentation(accessor, tabsToSpaces) {
|
|
128
|
+
const editorService = accessor.get(IEditorService);
|
|
129
|
+
const configurationService = accessor.get(IConfigurationService);
|
|
130
|
+
const logService = accessor.get(ILogService);
|
|
131
|
+
const textModelService = accessor.get(ITextModelService);
|
|
132
|
+
const notebookEditorService = accessor.get(INotebookEditorService);
|
|
133
|
+
const bulkEditService = accessor.get(IBulkEditService);
|
|
134
|
+
const activeInput = editorService.activeEditorPane?.input;
|
|
135
|
+
const isNotebook = isNotebookEditorInput(activeInput);
|
|
136
|
+
if (!isNotebook) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
const notebookTextModel = notebookEditorService.retrieveExistingWidgetFromURI(activeInput.resource)?.value?.textModel;
|
|
140
|
+
if (!notebookTextModel) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
const disposable = ( (new DisposableStore()));
|
|
144
|
+
try {
|
|
145
|
+
Promise.all(( (notebookTextModel.cells.map(async (cell) => {
|
|
146
|
+
const ref = await textModelService.createModelReference(cell.uri);
|
|
147
|
+
disposable.add(ref);
|
|
148
|
+
const textEditorModel = ref.object.textEditorModel;
|
|
149
|
+
const modelOpts = cell.textModel?.getOptions();
|
|
150
|
+
if (!modelOpts) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const edits = getIndentationEditOperations(textEditorModel, modelOpts.tabSize, tabsToSpaces);
|
|
154
|
+
bulkEditService.apply(edits, { label: ( localize(10692, "Convert Indentation")), code: 'undoredo.convertIndentation', });
|
|
155
|
+
})))).then(() => {
|
|
156
|
+
const initialConfig = configurationService.getValue(NotebookSetting.cellEditorOptionsCustomizations);
|
|
157
|
+
const initialIndentSize = initialConfig['editor.indentSize'];
|
|
158
|
+
const initialTabSize = initialConfig['editor.tabSize'];
|
|
159
|
+
delete initialConfig['editor.indentSize'];
|
|
160
|
+
delete initialConfig['editor.tabSize'];
|
|
161
|
+
delete initialConfig['editor.insertSpaces'];
|
|
162
|
+
configurationService.updateValue(NotebookSetting.cellEditorOptionsCustomizations, {
|
|
163
|
+
...initialConfig,
|
|
164
|
+
'editor.tabSize': initialTabSize,
|
|
165
|
+
'editor.indentSize': initialIndentSize,
|
|
166
|
+
'editor.insertSpaces': tabsToSpaces
|
|
167
|
+
});
|
|
168
|
+
disposable.dispose();
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
catch {
|
|
172
|
+
logService.error('Failed to convert indentation to spaces for notebook cells.');
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
function getIndentationEditOperations(model, tabSize, tabsToSpaces) {
|
|
176
|
+
if (model.getLineCount() === 1 && model.getLineMaxColumn(1) === 1) {
|
|
177
|
+
return [];
|
|
178
|
+
}
|
|
179
|
+
let spaces = '';
|
|
180
|
+
for (let i = 0; i < tabSize; i++) {
|
|
181
|
+
spaces += ' ';
|
|
182
|
+
}
|
|
183
|
+
const spacesRegExp = ( (new RegExp(spaces, 'gi')));
|
|
184
|
+
const edits = [];
|
|
185
|
+
for (let lineNumber = 1, lineCount = model.getLineCount(); lineNumber <= lineCount; lineNumber++) {
|
|
186
|
+
let lastIndentationColumn = model.getLineFirstNonWhitespaceColumn(lineNumber);
|
|
187
|
+
if (lastIndentationColumn === 0) {
|
|
188
|
+
lastIndentationColumn = model.getLineMaxColumn(lineNumber);
|
|
189
|
+
}
|
|
190
|
+
if (lastIndentationColumn === 1) {
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
const originalIndentationRange = ( (new Range(lineNumber, 1, lineNumber, lastIndentationColumn)));
|
|
194
|
+
const originalIndentation = model.getValueInRange(originalIndentationRange);
|
|
195
|
+
const newIndentation = (tabsToSpaces
|
|
196
|
+
? originalIndentation.replace(/\t/ig, spaces)
|
|
197
|
+
: originalIndentation.replace(spacesRegExp, '\t'));
|
|
198
|
+
edits.push(( (new ResourceTextEdit(model.uri, { range: originalIndentationRange, text: newIndentation }))));
|
|
199
|
+
}
|
|
200
|
+
return edits;
|
|
201
|
+
}
|
|
202
|
+
registerAction2(NotebookIndentUsingSpaces);
|
|
203
|
+
registerAction2(NotebookIndentUsingTabs);
|
|
204
|
+
registerAction2(NotebookChangeTabDisplaySize);
|
|
205
|
+
registerAction2(NotebookIndentationToSpacesAction);
|
|
206
|
+
registerAction2(NotebookIndentationToTabsAction);
|
|
207
|
+
|
|
208
|
+
export { NotebookChangeTabDisplaySize, NotebookIndentUsingSpaces, NotebookIndentUsingTabs, NotebookIndentationToSpacesAction, NotebookIndentationToTabsAction };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { localize2, localize } from 'vscode/vscode/vs/nls';
|
|
2
2
|
import { Action2, MenuId, registerAction2 } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
3
3
|
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
4
4
|
import { NotebookOutlineContext } from '../contrib/outline/notebookOutline.js';
|
|
@@ -8,16 +8,15 @@ import { executeIcon } from 'vscode/vscode/vs/workbench/contrib/notebook/browser
|
|
|
8
8
|
import { CellKind } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
9
9
|
import { OutlineTarget } from 'vscode/vscode/vs/workbench/services/outline/browser/outline';
|
|
10
10
|
|
|
11
|
-
const _moduleId = "vs/workbench/contrib/notebook/browser/controller/sectionActions";
|
|
12
11
|
class NotebookRunSingleCellInSection extends Action2 {
|
|
13
12
|
constructor() {
|
|
14
13
|
super({
|
|
15
14
|
id: 'notebook.section.runSingleCell',
|
|
16
15
|
title: {
|
|
17
|
-
...(
|
|
18
|
-
mnemonicTitle: (
|
|
16
|
+
...( localize2(7888, "Run Cell")),
|
|
17
|
+
mnemonicTitle: ( localize(7889, "&&Run Cell")),
|
|
19
18
|
},
|
|
20
|
-
shortTitle: (
|
|
19
|
+
shortTitle: ( localize(7889, "Run Cell")),
|
|
21
20
|
icon: executeIcon,
|
|
22
21
|
menu: [
|
|
23
22
|
{
|
|
@@ -46,10 +45,10 @@ class NotebookRunCellsInSection extends Action2 {
|
|
|
46
45
|
super({
|
|
47
46
|
id: 'notebook.section.runCells',
|
|
48
47
|
title: {
|
|
49
|
-
...(
|
|
50
|
-
mnemonicTitle: (
|
|
48
|
+
...( localize2(7890, "Run Cells In Section")),
|
|
49
|
+
mnemonicTitle: ( localize(7891, "&&Run Cells In Section")),
|
|
51
50
|
},
|
|
52
|
-
shortTitle: (
|
|
51
|
+
shortTitle: ( localize(7891, "Run Cells In Section")),
|
|
53
52
|
menu: [
|
|
54
53
|
{
|
|
55
54
|
id: MenuId.NotebookStickyScrollContext,
|
|
@@ -92,10 +91,10 @@ class NotebookFoldSection extends Action2 {
|
|
|
92
91
|
super({
|
|
93
92
|
id: 'notebook.section.foldSection',
|
|
94
93
|
title: {
|
|
95
|
-
...(
|
|
96
|
-
mnemonicTitle: (
|
|
94
|
+
...( localize2(7892, "Fold Section")),
|
|
95
|
+
mnemonicTitle: ( localize(7893, "&&Fold Section")),
|
|
97
96
|
},
|
|
98
|
-
shortTitle: (
|
|
97
|
+
shortTitle: ( localize(7893, "Fold Section")),
|
|
99
98
|
menu: [
|
|
100
99
|
{
|
|
101
100
|
id: MenuId.NotebookOutlineActionMenu,
|
|
@@ -131,10 +130,10 @@ class NotebookExpandSection extends Action2 {
|
|
|
131
130
|
super({
|
|
132
131
|
id: 'notebook.section.expandSection',
|
|
133
132
|
title: {
|
|
134
|
-
...(
|
|
135
|
-
mnemonicTitle: (
|
|
133
|
+
...( localize2(7894, "Expand Section")),
|
|
134
|
+
mnemonicTitle: ( localize(7895, "&&Expand Section")),
|
|
136
135
|
},
|
|
137
|
-
shortTitle: (
|
|
136
|
+
shortTitle: ( localize(7895, "Expand Section")),
|
|
138
137
|
menu: [
|
|
139
138
|
{
|
|
140
139
|
id: MenuId.NotebookOutlineActionMenu,
|
|
@@ -1207,11 +1207,10 @@ let ModifiedElement = class ModifiedElement extends AbstractElementRenderer {
|
|
|
1207
1207
|
inputChanged.set(false);
|
|
1208
1208
|
}
|
|
1209
1209
|
}));
|
|
1210
|
-
const menu = this.menuService.
|
|
1210
|
+
const menu = this.menuService.getMenuActions(MenuId.NotebookDiffCellInputTitle, scopedContextKeyService, { shouldForwardArgs: true });
|
|
1211
1211
|
const actions = [];
|
|
1212
|
-
createAndFillInActionBarActions(menu,
|
|
1212
|
+
createAndFillInActionBarActions(menu, actions);
|
|
1213
1213
|
this._toolbar.setActions(actions);
|
|
1214
|
-
menu.dispose();
|
|
1215
1214
|
}
|
|
1216
1215
|
async _initializeSourceDiffEditor() {
|
|
1217
1216
|
const originalCell = this.cell.original;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
2
|
import { $, addStandardDisposableListener, addDisposableListener, EventType, append } from 'vscode/vscode/vs/base/browser/dom';
|
|
3
|
-
import {
|
|
3
|
+
import { localize } from 'vscode/vscode/vs/nls';
|
|
4
4
|
import { Disposable, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
5
5
|
import { SideBySideDiffElementViewModel } from './diffElementViewModel.js';
|
|
6
6
|
import { DiffSide } from './notebookDiffEditorBrowser.js';
|
|
@@ -12,7 +12,6 @@ import { StandardKeyboardEvent } from 'vscode/vscode/vs/base/browser/keyboardEve
|
|
|
12
12
|
import { KeyCode } from 'vscode/vscode/vs/base/common/keyCodes';
|
|
13
13
|
import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput.service';
|
|
14
14
|
|
|
15
|
-
const _moduleId = "vs/workbench/contrib/notebook/browser/diff/diffElementOutputs";
|
|
16
15
|
class OutputElement extends Disposable {
|
|
17
16
|
constructor(_notebookEditor, _notebookTextModel, _notebookService, _quickInputService, _diffElementViewModel, _diffSide, _nestedCell, _outputContainer, output) {
|
|
18
17
|
super();
|
|
@@ -37,9 +36,8 @@ class OutputElement extends Disposable {
|
|
|
37
36
|
const mimeTypePicker = $('.multi-mimetype-output');
|
|
38
37
|
mimeTypePicker.classList.add(...ThemeIcon.asClassNameArray(mimetypeIcon));
|
|
39
38
|
mimeTypePicker.tabIndex = 0;
|
|
40
|
-
mimeTypePicker.title = (
|
|
41
|
-
|
|
42
|
-
0,
|
|
39
|
+
mimeTypePicker.title = ( localize(
|
|
40
|
+
11533,
|
|
43
41
|
"Choose a different output mimetype, available mimetypes: {0}",
|
|
44
42
|
( (mimeTypes.map(mimeType => mimeType.mimeType))).join(', ')
|
|
45
43
|
));
|
|
@@ -86,14 +84,13 @@ class OutputElement extends Disposable {
|
|
|
86
84
|
}
|
|
87
85
|
_renderMissingRenderer(viewModel, preferredMimeType) {
|
|
88
86
|
if (!viewModel.model.outputs.length) {
|
|
89
|
-
return this._renderMessage(viewModel, (
|
|
87
|
+
return this._renderMessage(viewModel, ( localize(11534, "Cell has no output")));
|
|
90
88
|
}
|
|
91
89
|
if (!preferredMimeType) {
|
|
92
90
|
const mimeTypes = ( (viewModel.model.outputs.map(op => op.mime)));
|
|
93
91
|
const mimeTypesMessage = mimeTypes.join(', ');
|
|
94
|
-
return this._renderMessage(viewModel, (
|
|
95
|
-
|
|
96
|
-
2,
|
|
92
|
+
return this._renderMessage(viewModel, ( localize(
|
|
93
|
+
11535,
|
|
97
94
|
"No renderer could be found for output. It has the following mimetypes: {0}",
|
|
98
95
|
mimeTypesMessage
|
|
99
96
|
)));
|
|
@@ -122,18 +119,17 @@ class OutputElement extends Disposable {
|
|
|
122
119
|
index: index,
|
|
123
120
|
picked: index === currIndex,
|
|
124
121
|
detail: this.generateRendererInfo(mimeType.rendererId),
|
|
125
|
-
description: index === currIndex ? (
|
|
122
|
+
description: index === currIndex ? ( localize(11536, "Currently Active")) : undefined
|
|
126
123
|
}))));
|
|
127
124
|
const picker = this._quickInputService.createQuickPick();
|
|
128
125
|
picker.items = items;
|
|
129
126
|
picker.activeItems = items.filter(item => !!item.picked);
|
|
130
127
|
picker.placeholder = items.length !== mimeTypes.length
|
|
131
|
-
? (
|
|
132
|
-
|
|
133
|
-
4,
|
|
128
|
+
? ( localize(
|
|
129
|
+
11537,
|
|
134
130
|
"Select mimetype to render for current output. Rich mimetypes are available only when the notebook is trusted"
|
|
135
131
|
))
|
|
136
|
-
: (
|
|
132
|
+
: ( localize(11538, "Select mimetype to render for current output"));
|
|
137
133
|
const pick = await ( (new Promise(resolve => {
|
|
138
134
|
picker.onDidAccept(() => {
|
|
139
135
|
resolve(picker.selectedItems.length === 1 ? picker.selectedItems[0].index : undefined);
|
|
@@ -163,7 +159,7 @@ class OutputElement extends Disposable {
|
|
|
163
159
|
const displayName = renderInfo.displayName !== '' ? renderInfo.displayName : renderInfo.id;
|
|
164
160
|
return `${displayName} (${renderInfo.extensionId.value})`;
|
|
165
161
|
}
|
|
166
|
-
return (
|
|
162
|
+
return ( localize(11539, "built-in"));
|
|
167
163
|
}
|
|
168
164
|
getCellOutputCurrentIndex() {
|
|
169
165
|
return this._diffElementViewModel.getNestedCellViewModel(this._diffSide).outputs.indexOf(this.output.model);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IBulkEditService, ResourceTextEdit } from 'vscode/vscode/vs/editor/browser/services/bulkEditService';
|
|
2
|
-
import {
|
|
2
|
+
import { localize2, localize } from 'vscode/vscode/vs/nls';
|
|
3
3
|
import { registerAction2, Action2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
4
4
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
5
5
|
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
@@ -16,13 +16,12 @@ import { KeybindingWeight } from 'vscode/vscode/vs/platform/keybinding/common/ke
|
|
|
16
16
|
import { KeyMod, KeyCode } from 'vscode/vscode/vs/base/common/keyCodes';
|
|
17
17
|
import { CellEditType, NOTEBOOK_DIFF_EDITOR_ID } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
18
18
|
|
|
19
|
-
const _moduleId = "vs/workbench/contrib/notebook/browser/diff/notebookDiffActions";
|
|
20
19
|
registerAction2(class extends Action2 {
|
|
21
20
|
constructor() {
|
|
22
21
|
super({
|
|
23
22
|
id: 'notebook.diff.switchToText',
|
|
24
23
|
icon: openAsTextIcon,
|
|
25
|
-
title: (
|
|
24
|
+
title: ( localize2(8042, 'Open Text Diff Editor')),
|
|
26
25
|
precondition: ( (ActiveEditorContext.isEqualTo(NotebookTextDiffEditor.ID))),
|
|
27
26
|
menu: [{
|
|
28
27
|
id: MenuId.EditorTitle,
|
|
@@ -52,7 +51,7 @@ registerAction2(class extends Action2 {
|
|
|
52
51
|
constructor() {
|
|
53
52
|
super({
|
|
54
53
|
id: 'notebook.diff.cell.revertMetadata',
|
|
55
|
-
title: (
|
|
54
|
+
title: ( localize(8043, "Revert Metadata")),
|
|
56
55
|
icon: revertIcon,
|
|
57
56
|
f1: false,
|
|
58
57
|
menu: {
|
|
@@ -78,7 +77,7 @@ registerAction2(class extends Action2 {
|
|
|
78
77
|
constructor() {
|
|
79
78
|
super({
|
|
80
79
|
id: 'notebook.diff.cell.switchOutputRenderingStyleToText',
|
|
81
|
-
title: (
|
|
80
|
+
title: ( localize(8044, "Switch Output Rendering")),
|
|
82
81
|
icon: renderOutputIcon,
|
|
83
82
|
f1: false,
|
|
84
83
|
menu: {
|
|
@@ -98,7 +97,7 @@ registerAction2(class extends Action2 {
|
|
|
98
97
|
constructor() {
|
|
99
98
|
super({
|
|
100
99
|
id: 'notebook.diff.cell.revertOutputs',
|
|
101
|
-
title: (
|
|
100
|
+
title: ( localize(8045, "Revert Outputs")),
|
|
102
101
|
icon: revertIcon,
|
|
103
102
|
f1: false,
|
|
104
103
|
menu: {
|
|
@@ -130,7 +129,7 @@ registerAction2(class extends Action2 {
|
|
|
130
129
|
constructor() {
|
|
131
130
|
super({
|
|
132
131
|
id: 'notebook.diff.cell.revertInput',
|
|
133
|
-
title: (
|
|
132
|
+
title: ( localize(8046, "Revert Input")),
|
|
134
133
|
icon: revertIcon,
|
|
135
134
|
f1: false,
|
|
136
135
|
menu: {
|
|
@@ -189,19 +188,19 @@ class ToggleRenderAction extends Action2 {
|
|
|
189
188
|
}
|
|
190
189
|
registerAction2(class extends ToggleRenderAction {
|
|
191
190
|
constructor() {
|
|
192
|
-
super('notebook.diff.showOutputs', (
|
|
191
|
+
super('notebook.diff.showOutputs', ( localize2(8047, 'Show Outputs Differences')), ( (ActiveEditorContext.isEqualTo(NotebookTextDiffEditor.ID))), ( (ContextKeyExpr.notEquals('config.notebook.diff.ignoreOutputs', true))), 2, true, undefined);
|
|
193
192
|
}
|
|
194
193
|
});
|
|
195
194
|
registerAction2(class extends ToggleRenderAction {
|
|
196
195
|
constructor() {
|
|
197
|
-
super('notebook.diff.showMetadata', (
|
|
196
|
+
super('notebook.diff.showMetadata', ( localize2(8048, 'Show Metadata Differences')), ( (ActiveEditorContext.isEqualTo(NotebookTextDiffEditor.ID))), ( (ContextKeyExpr.notEquals('config.notebook.diff.ignoreMetadata', true))), 1, undefined, true);
|
|
198
197
|
}
|
|
199
198
|
});
|
|
200
199
|
registerAction2(class extends Action2 {
|
|
201
200
|
constructor() {
|
|
202
201
|
super({
|
|
203
202
|
id: 'notebook.diff.action.previous',
|
|
204
|
-
title: (
|
|
203
|
+
title: ( localize(8049, "Show Previous Change")),
|
|
205
204
|
icon: previousChangeIcon,
|
|
206
205
|
f1: false,
|
|
207
206
|
keybinding: {
|
|
@@ -229,7 +228,7 @@ registerAction2(class extends Action2 {
|
|
|
229
228
|
constructor() {
|
|
230
229
|
super({
|
|
231
230
|
id: 'notebook.diff.action.next',
|
|
232
|
-
title: (
|
|
231
|
+
title: ( localize(8050, "Show Next Change")),
|
|
233
232
|
icon: nextChangeIcon,
|
|
234
233
|
f1: false,
|
|
235
234
|
keybinding: {
|
|
@@ -261,12 +260,12 @@ registerAction2(class extends Action2 {
|
|
|
261
260
|
'notebook.diff.ignoreMetadata': {
|
|
262
261
|
type: 'boolean',
|
|
263
262
|
default: false,
|
|
264
|
-
markdownDescription: (
|
|
263
|
+
markdownDescription: ( localize(8051, "Hide Metadata Differences"))
|
|
265
264
|
},
|
|
266
265
|
'notebook.diff.ignoreOutputs': {
|
|
267
266
|
type: 'boolean',
|
|
268
267
|
default: false,
|
|
269
|
-
markdownDescription: (
|
|
268
|
+
markdownDescription: ( localize(8052, "Hide Outputs Differences"))
|
|
270
269
|
},
|
|
271
270
|
}
|
|
272
271
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
-
import {
|
|
2
|
+
import { localize } from 'vscode/vscode/vs/nls';
|
|
3
3
|
import { $ as $$1, append, addStandardDisposableGenericMouseDownListener, addStandardDisposableGenericMouseUpListener, scheduleAtNextAnimationFrame } from 'vscode/vscode/vs/base/browser/dom';
|
|
4
4
|
import { findLastIdx } from 'vscode/vscode/vs/base/common/arraysFind';
|
|
5
5
|
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
@@ -45,7 +45,6 @@ import { NotebookDiffOverviewRuler } from './notebookDiffOverviewRuler.js';
|
|
|
45
45
|
import { registerZIndex, ZIndex } from 'vscode/vscode/vs/platform/layout/browser/zIndexRegistry';
|
|
46
46
|
|
|
47
47
|
var NotebookTextDiffEditor_1;
|
|
48
|
-
const _moduleId = "vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor";
|
|
49
48
|
const $ = $$1;
|
|
50
49
|
class NotebookDiffEditorSelection {
|
|
51
50
|
constructor(selections) {
|
|
@@ -241,7 +240,7 @@ let NotebookTextDiffEditor = class NotebookTextDiffEditor extends EditorPane {
|
|
|
241
240
|
accessibilityProvider: {
|
|
242
241
|
getAriaLabel() { return null; },
|
|
243
242
|
getWidgetAriaLabel() {
|
|
244
|
-
return (
|
|
243
|
+
return ( localize(7871, "Notebook Text Diff"));
|
|
245
244
|
}
|
|
246
245
|
},
|
|
247
246
|
});
|