@codingame/monaco-vscode-notebook-service-override 8.0.4 → 9.0.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/package.json +3 -2
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +8 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +21 -21
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticsActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +6 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +26 -24
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookMulticursor.js +624 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +13 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +4 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +9 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +12 -12
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +24 -24
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.js +54 -55
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +22 -22
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +24 -24
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +23 -21
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/notebookIndentationActions.js +7 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +12 -12
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +297 -21
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +124 -73
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityHelp.js +27 -19
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +33 -33
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +62 -39
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +7 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +7 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +18 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +15 -40
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.js +0 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +28 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +55 -45
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorker.js +6 -6
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +12 -12
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +0 -47
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +0 -1303
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +0 -267
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +0 -569
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +0 -115
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +0 -39
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +0 -903
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +0 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +0 -397
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +0 -186
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +0 -107
|
@@ -4,10 +4,10 @@ import { registerAction2, Action2, MenuId } from 'vscode/vscode/vs/platform/acti
|
|
|
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';
|
|
6
6
|
import { ActiveEditorContext } from 'vscode/vscode/vs/workbench/common/contextkeys';
|
|
7
|
-
import { SideBySideDiffElementViewModel } from '
|
|
8
|
-
import { NOTEBOOK_DIFF_CELL_PROPERTY, NOTEBOOK_DIFF_CELL_PROPERTY_EXPANDED, NOTEBOOK_DIFF_CELL_INPUT } from '
|
|
9
|
-
import { NotebookTextDiffEditor } from '
|
|
10
|
-
import { openAsTextIcon, revertIcon, renderOutputIcon, previousChangeIcon, nextChangeIcon } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookIcons';
|
|
7
|
+
import { SideBySideDiffElementViewModel } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel';
|
|
8
|
+
import { NOTEBOOK_DIFF_HAS_UNCHANGED_CELLS, NOTEBOOK_DIFF_UNCHANGED_CELLS_HIDDEN, NOTEBOOK_DIFF_ITEM_KIND, NOTEBOOK_DIFF_ITEM_DIFF_STATE, NOTEBOOK_DIFF_CELL_PROPERTY, NOTEBOOK_DIFF_CELL_PROPERTY_EXPANDED, NOTEBOOK_DIFF_CELL_INPUT, NOTEBOOK_DIFF_CELL_IGNORE_WHITESPACE_KEY } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser';
|
|
9
|
+
import { NotebookTextDiffEditor } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor';
|
|
10
|
+
import { openAsTextIcon, revertIcon, renderOutputIcon, toggleWhitespace, previousChangeIcon, nextChangeIcon } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookIcons';
|
|
11
11
|
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
12
12
|
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
13
13
|
import { Extensions } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
|
|
@@ -15,25 +15,38 @@ import { DEFAULT_EDITOR_ASSOCIATION } from 'vscode/vscode/vs/workbench/common/ed
|
|
|
15
15
|
import { KeybindingWeight } from 'vscode/vscode/vs/platform/keybinding/common/keybindingsRegistry';
|
|
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
|
+
import { ITextResourceConfigurationService } from 'vscode/vscode/vs/editor/common/services/textResourceConfiguration';
|
|
19
|
+
import { NotebookMultiTextDiffEditor } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor';
|
|
20
|
+
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
21
|
+
import { TextEditorSelectionRevealType } from 'vscode/vscode/vs/platform/editor/common/editor';
|
|
18
22
|
|
|
19
23
|
registerAction2(class extends Action2 {
|
|
20
24
|
constructor() {
|
|
21
25
|
super({
|
|
22
26
|
id: 'notebook.diff.switchToText',
|
|
23
27
|
icon: openAsTextIcon,
|
|
24
|
-
title: ( localize2(
|
|
25
|
-
precondition: ( (
|
|
28
|
+
title: ( localize2(8052, 'Open Text Diff Editor')),
|
|
29
|
+
precondition: ( (ContextKeyExpr.or(
|
|
30
|
+
(ActiveEditorContext.isEqualTo(NotebookTextDiffEditor.ID)),
|
|
31
|
+
(ActiveEditorContext.isEqualTo(NotebookMultiTextDiffEditor.ID))
|
|
32
|
+
))),
|
|
26
33
|
menu: [{
|
|
27
34
|
id: MenuId.EditorTitle,
|
|
28
35
|
group: 'navigation',
|
|
29
|
-
when: ( (
|
|
36
|
+
when: ( (ContextKeyExpr.or(
|
|
37
|
+
(ActiveEditorContext.isEqualTo(NotebookTextDiffEditor.ID)),
|
|
38
|
+
(ActiveEditorContext.isEqualTo(NotebookMultiTextDiffEditor.ID))
|
|
39
|
+
))),
|
|
30
40
|
}]
|
|
31
41
|
});
|
|
32
42
|
}
|
|
33
43
|
async run(accessor) {
|
|
34
44
|
const editorService = accessor.get(IEditorService);
|
|
35
45
|
const activeEditor = editorService.activeEditorPane;
|
|
36
|
-
if (activeEditor
|
|
46
|
+
if (!activeEditor) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (activeEditor instanceof NotebookTextDiffEditor || activeEditor instanceof NotebookMultiTextDiffEditor) {
|
|
37
50
|
const diffEditorInput = activeEditor.input;
|
|
38
51
|
await editorService.openEditor({
|
|
39
52
|
original: { resource: diffEditorInput.original.resource },
|
|
@@ -47,11 +60,231 @@ registerAction2(class extends Action2 {
|
|
|
47
60
|
}
|
|
48
61
|
}
|
|
49
62
|
});
|
|
63
|
+
registerAction2(class extends Action2 {
|
|
64
|
+
constructor() {
|
|
65
|
+
super({
|
|
66
|
+
id: 'notebook.diffEditor.showUnchangedCells',
|
|
67
|
+
title: ( localize2(8053, 'Show Unchanged Cells')),
|
|
68
|
+
icon: Codicon.unfold,
|
|
69
|
+
precondition: ( (ContextKeyExpr.and(
|
|
70
|
+
(ActiveEditorContext.isEqualTo(NotebookMultiTextDiffEditor.ID)),
|
|
71
|
+
(ContextKeyExpr.has(NOTEBOOK_DIFF_HAS_UNCHANGED_CELLS.key))
|
|
72
|
+
))),
|
|
73
|
+
menu: {
|
|
74
|
+
when: ( (ContextKeyExpr.and(
|
|
75
|
+
(ActiveEditorContext.isEqualTo(NotebookMultiTextDiffEditor.ID)),
|
|
76
|
+
(ContextKeyExpr.has(NOTEBOOK_DIFF_HAS_UNCHANGED_CELLS.key)),
|
|
77
|
+
(ContextKeyExpr.equals(NOTEBOOK_DIFF_UNCHANGED_CELLS_HIDDEN.key, true))
|
|
78
|
+
))),
|
|
79
|
+
id: MenuId.EditorTitle,
|
|
80
|
+
order: 22,
|
|
81
|
+
group: 'navigation',
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
run(accessor, ...args) {
|
|
86
|
+
const activeEditor = accessor.get(IEditorService).activeEditorPane;
|
|
87
|
+
if (!activeEditor) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (activeEditor instanceof NotebookMultiTextDiffEditor) {
|
|
91
|
+
activeEditor.showUnchanged();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
registerAction2(class extends Action2 {
|
|
96
|
+
constructor() {
|
|
97
|
+
super({
|
|
98
|
+
id: 'notebook.diffEditor.hideUnchangedCells',
|
|
99
|
+
title: ( localize2(8054, 'Hide Unchanged Cells')),
|
|
100
|
+
icon: Codicon.fold,
|
|
101
|
+
precondition: ( (ContextKeyExpr.and(
|
|
102
|
+
(ActiveEditorContext.isEqualTo(NotebookMultiTextDiffEditor.ID)),
|
|
103
|
+
(ContextKeyExpr.has(NOTEBOOK_DIFF_HAS_UNCHANGED_CELLS.key))
|
|
104
|
+
))),
|
|
105
|
+
menu: {
|
|
106
|
+
when: ( (ContextKeyExpr.and(
|
|
107
|
+
(ActiveEditorContext.isEqualTo(NotebookMultiTextDiffEditor.ID)),
|
|
108
|
+
(ContextKeyExpr.has(NOTEBOOK_DIFF_HAS_UNCHANGED_CELLS.key)),
|
|
109
|
+
(ContextKeyExpr.equals(NOTEBOOK_DIFF_UNCHANGED_CELLS_HIDDEN.key, false))
|
|
110
|
+
))),
|
|
111
|
+
id: MenuId.EditorTitle,
|
|
112
|
+
order: 22,
|
|
113
|
+
group: 'navigation',
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
run(accessor, ...args) {
|
|
118
|
+
const activeEditor = accessor.get(IEditorService).activeEditorPane;
|
|
119
|
+
if (!activeEditor) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
if (activeEditor instanceof NotebookMultiTextDiffEditor) {
|
|
123
|
+
activeEditor.hideUnchanged();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
registerAction2(class GoToFileAction extends Action2 {
|
|
128
|
+
constructor() {
|
|
129
|
+
super({
|
|
130
|
+
id: 'notebook.diffEditor.2.goToCell',
|
|
131
|
+
title: ( localize2(8055, 'Go To Cell')),
|
|
132
|
+
icon: Codicon.goToFile,
|
|
133
|
+
menu: {
|
|
134
|
+
when: ( (ContextKeyExpr.and(
|
|
135
|
+
(ActiveEditorContext.isEqualTo(NotebookMultiTextDiffEditor.ID)),
|
|
136
|
+
(ContextKeyExpr.equals(NOTEBOOK_DIFF_ITEM_KIND.key, 'Cell')),
|
|
137
|
+
(ContextKeyExpr.notEquals(NOTEBOOK_DIFF_ITEM_DIFF_STATE.key, 'delete'))
|
|
138
|
+
))),
|
|
139
|
+
id: MenuId.MultiDiffEditorFileToolbar,
|
|
140
|
+
order: 0,
|
|
141
|
+
group: 'navigation',
|
|
142
|
+
},
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
async run(accessor, ...args) {
|
|
146
|
+
const uri = args[0];
|
|
147
|
+
const editorService = accessor.get(IEditorService);
|
|
148
|
+
const activeEditorPane = editorService.activeEditorPane;
|
|
149
|
+
if (!(activeEditorPane instanceof NotebookMultiTextDiffEditor)) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
await editorService.openEditor({
|
|
153
|
+
resource: uri,
|
|
154
|
+
options: {
|
|
155
|
+
selectionRevealType: TextEditorSelectionRevealType.CenterIfOutsideViewport,
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
const revertInput = ( localize(8056, "Revert Input"));
|
|
161
|
+
registerAction2(class extends Action2 {
|
|
162
|
+
constructor() {
|
|
163
|
+
super({
|
|
164
|
+
id: 'notebook.diffEditor.2.cell.revertInput',
|
|
165
|
+
title: revertInput,
|
|
166
|
+
icon: revertIcon,
|
|
167
|
+
menu: {
|
|
168
|
+
when: ( (ContextKeyExpr.and(
|
|
169
|
+
(ActiveEditorContext.isEqualTo(NotebookMultiTextDiffEditor.ID)),
|
|
170
|
+
(ContextKeyExpr.equals(NOTEBOOK_DIFF_ITEM_KIND.key, 'Cell')),
|
|
171
|
+
(ContextKeyExpr.equals(NOTEBOOK_DIFF_ITEM_DIFF_STATE.key, 'modified'))
|
|
172
|
+
))),
|
|
173
|
+
id: MenuId.MultiDiffEditorFileToolbar,
|
|
174
|
+
order: 2,
|
|
175
|
+
group: 'navigation',
|
|
176
|
+
},
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
async run(accessor, ...args) {
|
|
180
|
+
const uri = args[0];
|
|
181
|
+
const editorService = accessor.get(IEditorService);
|
|
182
|
+
const activeEditorPane = editorService.activeEditorPane;
|
|
183
|
+
if (!(activeEditorPane instanceof NotebookMultiTextDiffEditor)) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
const item = activeEditorPane.getDiffElementViewModel(uri);
|
|
187
|
+
if (item && item instanceof SideBySideDiffElementViewModel) {
|
|
188
|
+
const modified = item.modified;
|
|
189
|
+
const original = item.original;
|
|
190
|
+
if (!original || !modified) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
const bulkEditService = accessor.get(IBulkEditService);
|
|
194
|
+
await bulkEditService.apply([
|
|
195
|
+
( (new ResourceTextEdit(
|
|
196
|
+
modified.uri,
|
|
197
|
+
{ range: modified.textModel.getFullModelRange(), text: original.textModel.getValue() }
|
|
198
|
+
))),
|
|
199
|
+
], { quotableLabel: 'Revert Notebook Cell Content Change' });
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
const revertOutputs = ( localize(8057, "Revert Outputs"));
|
|
204
|
+
registerAction2(class extends Action2 {
|
|
205
|
+
constructor() {
|
|
206
|
+
super({
|
|
207
|
+
id: 'notebook.diffEditor.2.cell.revertOutputs',
|
|
208
|
+
title: revertOutputs,
|
|
209
|
+
icon: revertIcon,
|
|
210
|
+
f1: false,
|
|
211
|
+
menu: {
|
|
212
|
+
when: ( (ContextKeyExpr.and(
|
|
213
|
+
(ActiveEditorContext.isEqualTo(NotebookMultiTextDiffEditor.ID)),
|
|
214
|
+
(ContextKeyExpr.equals(NOTEBOOK_DIFF_ITEM_KIND.key, 'Output')),
|
|
215
|
+
(ContextKeyExpr.equals(NOTEBOOK_DIFF_ITEM_DIFF_STATE.key, 'modified'))
|
|
216
|
+
))),
|
|
217
|
+
id: MenuId.MultiDiffEditorFileToolbar,
|
|
218
|
+
order: 2,
|
|
219
|
+
group: 'navigation',
|
|
220
|
+
},
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
async run(accessor, ...args) {
|
|
224
|
+
const uri = args[0];
|
|
225
|
+
const editorService = accessor.get(IEditorService);
|
|
226
|
+
const activeEditorPane = editorService.activeEditorPane;
|
|
227
|
+
if (!(activeEditorPane instanceof NotebookMultiTextDiffEditor)) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
const item = activeEditorPane.getDiffElementViewModel(uri);
|
|
231
|
+
if (item && item instanceof SideBySideDiffElementViewModel) {
|
|
232
|
+
const original = item.original;
|
|
233
|
+
const modifiedCellIndex = item.modifiedDocument.cells.findIndex(cell => cell.handle === item.modified.handle);
|
|
234
|
+
if (modifiedCellIndex === -1) {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
item.mainDocumentTextModel.applyEdits([{
|
|
238
|
+
editType: CellEditType.Output, index: modifiedCellIndex, outputs: original.outputs
|
|
239
|
+
}], true, undefined, () => undefined, undefined, true);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
const revertMetadata = ( localize(8058, "Revert Metadata"));
|
|
244
|
+
registerAction2(class extends Action2 {
|
|
245
|
+
constructor() {
|
|
246
|
+
super({
|
|
247
|
+
id: 'notebook.diffEditor.2.cell.revertMetadata',
|
|
248
|
+
title: revertMetadata,
|
|
249
|
+
icon: revertIcon,
|
|
250
|
+
f1: false,
|
|
251
|
+
menu: {
|
|
252
|
+
when: ( (ContextKeyExpr.and(
|
|
253
|
+
(ActiveEditorContext.isEqualTo(NotebookMultiTextDiffEditor.ID)),
|
|
254
|
+
(ContextKeyExpr.equals(NOTEBOOK_DIFF_ITEM_KIND.key, 'Metadata')),
|
|
255
|
+
(ContextKeyExpr.equals(NOTEBOOK_DIFF_ITEM_DIFF_STATE.key, 'modified'))
|
|
256
|
+
))),
|
|
257
|
+
id: MenuId.MultiDiffEditorFileToolbar,
|
|
258
|
+
order: 2,
|
|
259
|
+
group: 'navigation',
|
|
260
|
+
},
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
async run(accessor, ...args) {
|
|
264
|
+
const uri = args[0];
|
|
265
|
+
const editorService = accessor.get(IEditorService);
|
|
266
|
+
const activeEditorPane = editorService.activeEditorPane;
|
|
267
|
+
if (!(activeEditorPane instanceof NotebookMultiTextDiffEditor)) {
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
const item = activeEditorPane.getDiffElementViewModel(uri);
|
|
271
|
+
if (item && item instanceof SideBySideDiffElementViewModel) {
|
|
272
|
+
const original = item.original;
|
|
273
|
+
const modifiedCellIndex = item.modifiedDocument.cells.findIndex(cell => cell.handle === item.modified.handle);
|
|
274
|
+
if (modifiedCellIndex === -1) {
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
item.mainDocumentTextModel.applyEdits([{
|
|
278
|
+
editType: CellEditType.Metadata, index: modifiedCellIndex, metadata: original.metadata
|
|
279
|
+
}], true, undefined, () => undefined, undefined, true);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
});
|
|
50
283
|
registerAction2(class extends Action2 {
|
|
51
284
|
constructor() {
|
|
52
285
|
super({
|
|
53
286
|
id: 'notebook.diff.cell.revertMetadata',
|
|
54
|
-
title:
|
|
287
|
+
title: revertMetadata,
|
|
55
288
|
icon: revertIcon,
|
|
56
289
|
f1: false,
|
|
57
290
|
menu: {
|
|
@@ -65,19 +298,27 @@ registerAction2(class extends Action2 {
|
|
|
65
298
|
if (!context) {
|
|
66
299
|
return;
|
|
67
300
|
}
|
|
301
|
+
if (!(context.cell instanceof SideBySideDiffElementViewModel)) {
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
68
304
|
const original = context.cell.original;
|
|
69
305
|
const modified = context.cell.modified;
|
|
70
|
-
|
|
306
|
+
const modifiedCellIndex = context.cell.mainDocumentTextModel.cells.indexOf(modified.textModel);
|
|
307
|
+
if (modifiedCellIndex === -1) {
|
|
71
308
|
return;
|
|
72
309
|
}
|
|
73
|
-
|
|
310
|
+
const rawEdits = [{ editType: CellEditType.Metadata, index: modifiedCellIndex, metadata: original.metadata }];
|
|
311
|
+
if (context.cell.original.language && context.cell.modified.language !== context.cell.original.language) {
|
|
312
|
+
rawEdits.push({ editType: CellEditType.CellLanguage, index: modifiedCellIndex, language: context.cell.original.language });
|
|
313
|
+
}
|
|
314
|
+
context.cell.modifiedDocument.applyEdits(rawEdits, true, undefined, () => undefined, undefined, true);
|
|
74
315
|
}
|
|
75
316
|
});
|
|
76
317
|
registerAction2(class extends Action2 {
|
|
77
318
|
constructor() {
|
|
78
319
|
super({
|
|
79
320
|
id: 'notebook.diff.cell.switchOutputRenderingStyleToText',
|
|
80
|
-
title: ( localize(
|
|
321
|
+
title: ( localize(8059, "Switch Output Rendering")),
|
|
81
322
|
icon: renderOutputIcon,
|
|
82
323
|
f1: false,
|
|
83
324
|
menu: {
|
|
@@ -97,7 +338,7 @@ registerAction2(class extends Action2 {
|
|
|
97
338
|
constructor() {
|
|
98
339
|
super({
|
|
99
340
|
id: 'notebook.diff.cell.revertOutputs',
|
|
100
|
-
title: ( localize(
|
|
341
|
+
title: ( localize(8057, "Revert Outputs")),
|
|
101
342
|
icon: revertIcon,
|
|
102
343
|
f1: false,
|
|
103
344
|
menu: {
|
|
@@ -125,16 +366,45 @@ registerAction2(class extends Action2 {
|
|
|
125
366
|
}], true, undefined, () => undefined, undefined, true);
|
|
126
367
|
}
|
|
127
368
|
});
|
|
369
|
+
registerAction2(class extends Action2 {
|
|
370
|
+
constructor() {
|
|
371
|
+
super({
|
|
372
|
+
id: 'notebook.toggle.diff.cell.ignoreTrimWhitespace',
|
|
373
|
+
title: ( localize(8060, "Show Leading/Trailing Whitespace Differences")),
|
|
374
|
+
icon: toggleWhitespace,
|
|
375
|
+
f1: false,
|
|
376
|
+
menu: {
|
|
377
|
+
id: MenuId.NotebookDiffCellInputTitle,
|
|
378
|
+
when: NOTEBOOK_DIFF_CELL_INPUT,
|
|
379
|
+
order: 1,
|
|
380
|
+
},
|
|
381
|
+
precondition: NOTEBOOK_DIFF_CELL_INPUT,
|
|
382
|
+
toggled: ( (ContextKeyExpr.equals(NOTEBOOK_DIFF_CELL_IGNORE_WHITESPACE_KEY, false))),
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
run(accessor, context) {
|
|
386
|
+
const cell = context?.cell;
|
|
387
|
+
if (!cell?.modified) {
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
const uri = cell.modified.uri;
|
|
391
|
+
const configService = accessor.get(ITextResourceConfigurationService);
|
|
392
|
+
const key = 'diffEditor.ignoreTrimWhitespace';
|
|
393
|
+
const val = configService.getValue(uri, key);
|
|
394
|
+
configService.updateValue(uri, key, !val);
|
|
395
|
+
}
|
|
396
|
+
});
|
|
128
397
|
registerAction2(class extends Action2 {
|
|
129
398
|
constructor() {
|
|
130
399
|
super({
|
|
131
400
|
id: 'notebook.diff.cell.revertInput',
|
|
132
|
-
title:
|
|
401
|
+
title: revertInput,
|
|
133
402
|
icon: revertIcon,
|
|
134
403
|
f1: false,
|
|
135
404
|
menu: {
|
|
136
405
|
id: MenuId.NotebookDiffCellInputTitle,
|
|
137
|
-
when: NOTEBOOK_DIFF_CELL_INPUT
|
|
406
|
+
when: NOTEBOOK_DIFF_CELL_INPUT,
|
|
407
|
+
order: 2
|
|
138
408
|
},
|
|
139
409
|
precondition: NOTEBOOK_DIFF_CELL_INPUT
|
|
140
410
|
});
|
|
@@ -188,19 +458,25 @@ class ToggleRenderAction extends Action2 {
|
|
|
188
458
|
}
|
|
189
459
|
registerAction2(class extends ToggleRenderAction {
|
|
190
460
|
constructor() {
|
|
191
|
-
super('notebook.diff.showOutputs', ( localize2(
|
|
461
|
+
super('notebook.diff.showOutputs', ( localize2(8061, 'Show Outputs Differences')), ( (ContextKeyExpr.or(
|
|
462
|
+
(ActiveEditorContext.isEqualTo(NotebookTextDiffEditor.ID)),
|
|
463
|
+
(ActiveEditorContext.isEqualTo(NotebookMultiTextDiffEditor.ID))
|
|
464
|
+
))), ( (ContextKeyExpr.notEquals('config.notebook.diff.ignoreOutputs', true))), 2, true, undefined);
|
|
192
465
|
}
|
|
193
466
|
});
|
|
194
467
|
registerAction2(class extends ToggleRenderAction {
|
|
195
468
|
constructor() {
|
|
196
|
-
super('notebook.diff.showMetadata', ( localize2(
|
|
469
|
+
super('notebook.diff.showMetadata', ( localize2(8062, 'Show Metadata Differences')), ( (ContextKeyExpr.or(
|
|
470
|
+
(ActiveEditorContext.isEqualTo(NotebookTextDiffEditor.ID)),
|
|
471
|
+
(ActiveEditorContext.isEqualTo(NotebookMultiTextDiffEditor.ID))
|
|
472
|
+
))), ( (ContextKeyExpr.notEquals('config.notebook.diff.ignoreMetadata', true))), 1, undefined, true);
|
|
197
473
|
}
|
|
198
474
|
});
|
|
199
475
|
registerAction2(class extends Action2 {
|
|
200
476
|
constructor() {
|
|
201
477
|
super({
|
|
202
478
|
id: 'notebook.diff.action.previous',
|
|
203
|
-
title: ( localize(
|
|
479
|
+
title: ( localize(8063, "Show Previous Change")),
|
|
204
480
|
icon: previousChangeIcon,
|
|
205
481
|
f1: false,
|
|
206
482
|
keybinding: {
|
|
@@ -228,7 +504,7 @@ registerAction2(class extends Action2 {
|
|
|
228
504
|
constructor() {
|
|
229
505
|
super({
|
|
230
506
|
id: 'notebook.diff.action.next',
|
|
231
|
-
title: ( localize(
|
|
507
|
+
title: ( localize(8064, "Show Next Change")),
|
|
232
508
|
icon: nextChangeIcon,
|
|
233
509
|
f1: false,
|
|
234
510
|
keybinding: {
|
|
@@ -260,12 +536,12 @@ registerAction2(class extends Action2 {
|
|
|
260
536
|
'notebook.diff.ignoreMetadata': {
|
|
261
537
|
type: 'boolean',
|
|
262
538
|
default: false,
|
|
263
|
-
markdownDescription: ( localize(
|
|
539
|
+
markdownDescription: ( localize(8065, "Hide Metadata Differences"))
|
|
264
540
|
},
|
|
265
541
|
'notebook.diff.ignoreOutputs': {
|
|
266
542
|
type: 'boolean',
|
|
267
543
|
default: false,
|
|
268
|
-
markdownDescription: ( localize(
|
|
544
|
+
markdownDescription: ( localize(8066, "Hide Outputs Differences"))
|
|
269
545
|
},
|
|
270
546
|
}
|
|
271
547
|
});
|