@codingame/monaco-vscode-notebook-service-override 25.1.2 → 26.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +2 -2
- package/package.json +3 -3
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +112 -94
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +95 -96
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticEditorContrib.js +28 -19
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticsActions.js +15 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib.js +22 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +25 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +37 -44
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +211 -115
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +16 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +5 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +57 -49
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +24 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +78 -76
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +14 -15
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +43 -28
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +65 -34
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +19 -16
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +6 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +15 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +28 -16
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookMulticursor.js +211 -170
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookSelectionHighlight.js +11 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +158 -156
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookInlineVariables.js +109 -105
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +28 -22
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +26 -17
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +23 -16
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +72 -40
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +233 -186
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +22 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +239 -151
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +85 -86
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +25 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +13 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +8 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.js +218 -196
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +258 -255
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +106 -98
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/notebookIndentationActions.js +63 -49
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +55 -64
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/variablesActions.js +21 -25
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +149 -129
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.d.ts +57 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.js +286 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.js +82 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +452 -363
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityHelp.js +44 -61
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibleView.js +9 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +203 -207
- package/vscode/src/vs/workbench/contrib/notebook/browser/outputEditor/notebookOutputEditor.js +148 -104
- package/vscode/src/vs/workbench/contrib/notebook/browser/outputEditor/notebookOutputEditorInput.js +19 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/replEditorAccessibleView.js +9 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookCellStatusBarServiceImpl.js +9 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +34 -22
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +29 -18
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +70 -52
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +31 -19
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +78 -41
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +37 -27
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +9 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +8 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +214 -119
- package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +38 -36
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSource.js +24 -25
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSourceFactory.js +2 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.js +26 -15
- package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +35 -15
- package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +468 -258
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.d.ts +33 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +113 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +74 -58
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +7 -10
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookCellMatching.js +72 -16
- package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookWebWorker.js +70 -51
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/repl.contribution.js +195 -149
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorAccessibilityHelp.js +60 -81
- package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +7 -12
- package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +104 -66
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +115 -77
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +42 -26
- package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.js +19 -12
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.d.ts +0 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +0 -198
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.d.ts +0 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.js +0 -333
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.js +0 -7
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +0 -261
package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookMulticursor.js
CHANGED
|
@@ -37,27 +37,37 @@ import { NotebookAction } from '@codingame/monaco-vscode-api/vscode/vs/workbench
|
|
|
37
37
|
import { getNotebookEditorFromEditorPane } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
|
|
38
38
|
import { registerNotebookContribution } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/notebookEditorExtensions';
|
|
39
39
|
import { CellEditorOptions } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/view/cellParts/cellEditorOptions';
|
|
40
|
-
import { NotebookFindContrib } from '@codingame/monaco-vscode-
|
|
40
|
+
import { NotebookFindContrib } from '@codingame/monaco-vscode-katex-common/vscode/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget';
|
|
41
41
|
import { NotebookCellTextModel } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/model/notebookCellTextModel';
|
|
42
42
|
|
|
43
|
-
const NOTEBOOK_ADD_FIND_MATCH_TO_SELECTION_ID =
|
|
44
|
-
const NOTEBOOK_SELECT_ALL_FIND_MATCHES_ID =
|
|
43
|
+
const NOTEBOOK_ADD_FIND_MATCH_TO_SELECTION_ID = "notebook.addFindMatchToSelection";
|
|
44
|
+
const NOTEBOOK_SELECT_ALL_FIND_MATCHES_ID = "notebook.selectAllFindMatches";
|
|
45
45
|
var NotebookMultiCursorState;
|
|
46
|
-
(function
|
|
46
|
+
(function(NotebookMultiCursorState) {
|
|
47
47
|
NotebookMultiCursorState[NotebookMultiCursorState["Idle"] = 0] = "Idle";
|
|
48
48
|
NotebookMultiCursorState[NotebookMultiCursorState["Selecting"] = 1] = "Selecting";
|
|
49
49
|
NotebookMultiCursorState[NotebookMultiCursorState["Editing"] = 2] = "Editing";
|
|
50
50
|
})(NotebookMultiCursorState || (NotebookMultiCursorState = {}));
|
|
51
51
|
const NOTEBOOK_MULTI_CURSOR_CONTEXT = {
|
|
52
|
-
IsNotebookMultiCursor: ( new RawContextKey(
|
|
53
|
-
NotebookMultiSelectCursorState: ( new RawContextKey(
|
|
52
|
+
IsNotebookMultiCursor: ( new RawContextKey("isNotebookMultiSelect", false)),
|
|
53
|
+
NotebookMultiSelectCursorState: ( new RawContextKey("notebookMultiSelectCursorState", NotebookMultiCursorState.Idle))
|
|
54
54
|
};
|
|
55
55
|
let NotebookMultiCursorController = class NotebookMultiCursorController extends Disposable {
|
|
56
|
-
static {
|
|
56
|
+
static {
|
|
57
|
+
this.id = "notebook.multiCursorController";
|
|
58
|
+
}
|
|
57
59
|
getState() {
|
|
58
60
|
return this.state;
|
|
59
61
|
}
|
|
60
|
-
constructor(
|
|
62
|
+
constructor(
|
|
63
|
+
notebookEditor,
|
|
64
|
+
contextKeyService,
|
|
65
|
+
textModelService,
|
|
66
|
+
languageConfigurationService,
|
|
67
|
+
accessibilityService,
|
|
68
|
+
configurationService,
|
|
69
|
+
undoRedoService
|
|
70
|
+
) {
|
|
61
71
|
super();
|
|
62
72
|
this.notebookEditor = notebookEditor;
|
|
63
73
|
this.contextKeyService = contextKeyService;
|
|
@@ -66,7 +76,7 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
|
|
|
66
76
|
this.accessibilityService = accessibilityService;
|
|
67
77
|
this.configurationService = configurationService;
|
|
68
78
|
this.undoRedoService = undoRedoService;
|
|
69
|
-
this.word =
|
|
79
|
+
this.word = "";
|
|
70
80
|
this.trackedCells = [];
|
|
71
81
|
this.totalMatchesCount = 0;
|
|
72
82
|
this._onDidChangeAnchorCell = this._register(( new Emitter()));
|
|
@@ -86,9 +96,9 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
|
|
|
86
96
|
syncAnchorListeners() {
|
|
87
97
|
this.anchorDisposables.clear();
|
|
88
98
|
if (!this.anchorCell) {
|
|
89
|
-
throw ( new Error(
|
|
99
|
+
throw ( new Error("Anchor cell is undefined"));
|
|
90
100
|
}
|
|
91
|
-
this.anchorDisposables.add(this.anchorCell[1].onWillType(
|
|
101
|
+
this.anchorDisposables.add(this.anchorCell[1].onWillType(input => {
|
|
92
102
|
const collector = ( new ViewModelEventsCollector());
|
|
93
103
|
this.trackedCells.forEach(cell => {
|
|
94
104
|
const controller = this.cursorsControllers.get(cell.cellViewModel.uri);
|
|
@@ -96,7 +106,7 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
|
|
|
96
106
|
return;
|
|
97
107
|
}
|
|
98
108
|
if (cell.cellViewModel.handle !== this.anchorCell?.[0].handle) {
|
|
99
|
-
controller.type(collector, input,
|
|
109
|
+
controller.type(collector, input, "keyboard");
|
|
100
110
|
}
|
|
101
111
|
});
|
|
102
112
|
}));
|
|
@@ -111,7 +121,7 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
|
|
|
111
121
|
if (!activeSelections) {
|
|
112
122
|
return;
|
|
113
123
|
}
|
|
114
|
-
anchorController.setSelections(( new ViewModelEventsCollector()),
|
|
124
|
+
anchorController.setSelections(( new ViewModelEventsCollector()), "keyboard", activeSelections, CursorChangeReason.Explicit);
|
|
115
125
|
this.trackedCells.forEach(cell => {
|
|
116
126
|
const controller = this.cursorsControllers.get(cell.cellViewModel.uri);
|
|
117
127
|
if (!controller) {
|
|
@@ -122,8 +132,8 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
|
|
|
122
132
|
});
|
|
123
133
|
this.updateLazyDecorations();
|
|
124
134
|
}));
|
|
125
|
-
this.anchorDisposables.add(this.anchorCell[1].onDidChangeCursorSelection(
|
|
126
|
-
if (e.source ===
|
|
135
|
+
this.anchorDisposables.add(this.anchorCell[1].onDidChangeCursorSelection(e => {
|
|
136
|
+
if (e.source === "mouse") {
|
|
127
137
|
this.resetToIdleState();
|
|
128
138
|
return;
|
|
129
139
|
}
|
|
@@ -134,7 +144,7 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
|
|
|
134
144
|
deltaStartCol: e.selection.startColumn - e.oldSelections[0].startColumn,
|
|
135
145
|
deltaStartLine: e.selection.startLineNumber - e.oldSelections[0].startLineNumber,
|
|
136
146
|
deltaEndCol: e.selection.endColumn - e.oldSelections[0].endColumn,
|
|
137
|
-
deltaEndLine: e.selection.endLineNumber - e.oldSelections[0].endLineNumber
|
|
147
|
+
deltaEndLine: e.selection.endLineNumber - e.oldSelections[0].endLineNumber
|
|
138
148
|
};
|
|
139
149
|
const translationDir = e.selection.getDirection();
|
|
140
150
|
this.trackedCells.forEach(cell => {
|
|
@@ -153,7 +163,7 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
|
|
|
153
163
|
});
|
|
154
164
|
this.updateLazyDecorations();
|
|
155
165
|
}));
|
|
156
|
-
this.anchorDisposables.add(this.anchorCell[1].onWillTriggerEditorOperationEvent(
|
|
166
|
+
this.anchorDisposables.add(this.anchorCell[1].onWillTriggerEditorOperationEvent(e => {
|
|
157
167
|
this.handleEditorOperationEvent(e);
|
|
158
168
|
}));
|
|
159
169
|
this.anchorDisposables.add(this.anchorCell[1].onDidBlurEditorWidget(() => {
|
|
@@ -164,7 +174,7 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
|
|
|
164
174
|
}
|
|
165
175
|
async syncCursorsControllers() {
|
|
166
176
|
this.cursorsDisposables.clear();
|
|
167
|
-
await Promise.all(( this.trackedCells.map(async
|
|
177
|
+
await Promise.all(( this.trackedCells.map(async cell => {
|
|
168
178
|
const controller = await this.createCursorController(cell);
|
|
169
179
|
if (!controller) {
|
|
170
180
|
return;
|
|
@@ -267,30 +277,46 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
|
|
|
267
277
|
}
|
|
268
278
|
executeEditorOperation(controller, eventsCollector, e) {
|
|
269
279
|
switch (e.handlerId) {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
280
|
+
case Handler.CompositionStart:
|
|
281
|
+
controller.startComposition(eventsCollector);
|
|
282
|
+
break;
|
|
283
|
+
case Handler.CompositionEnd:
|
|
284
|
+
controller.endComposition(eventsCollector, e.source);
|
|
285
|
+
break;
|
|
286
|
+
case Handler.ReplacePreviousChar:
|
|
287
|
+
{
|
|
277
288
|
const args = e.payload;
|
|
278
|
-
controller.compositionType(eventsCollector, args.text ||
|
|
289
|
+
controller.compositionType(eventsCollector, args.text || "", args.replaceCharCnt || 0, 0, 0, e.source);
|
|
279
290
|
break;
|
|
280
291
|
}
|
|
281
|
-
|
|
292
|
+
case Handler.CompositionType:
|
|
293
|
+
{
|
|
282
294
|
const args = e.payload;
|
|
283
|
-
controller.compositionType(
|
|
295
|
+
controller.compositionType(
|
|
296
|
+
eventsCollector,
|
|
297
|
+
args.text || "",
|
|
298
|
+
args.replacePrevCharCnt || 0,
|
|
299
|
+
args.replaceNextCharCnt || 0,
|
|
300
|
+
args.positionDelta || 0,
|
|
301
|
+
e.source
|
|
302
|
+
);
|
|
284
303
|
break;
|
|
285
304
|
}
|
|
286
|
-
|
|
305
|
+
case Handler.Paste:
|
|
306
|
+
{
|
|
287
307
|
const args = e.payload;
|
|
288
|
-
controller.paste(
|
|
308
|
+
controller.paste(
|
|
309
|
+
eventsCollector,
|
|
310
|
+
args.text || "",
|
|
311
|
+
args.pasteOnNewLine || false,
|
|
312
|
+
args.multicursorText || null,
|
|
313
|
+
e.source
|
|
314
|
+
);
|
|
289
315
|
break;
|
|
290
316
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
317
|
+
case Handler.Cut:
|
|
318
|
+
controller.cut(eventsCollector, e.source);
|
|
319
|
+
break;
|
|
294
320
|
}
|
|
295
321
|
}
|
|
296
322
|
updateViewModelSelections() {
|
|
@@ -330,19 +356,19 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
|
|
|
330
356
|
this.undoRedoService.pushElement({
|
|
331
357
|
type: UndoRedoElementType.Workspace,
|
|
332
358
|
resources: resources,
|
|
333
|
-
label:
|
|
334
|
-
code:
|
|
359
|
+
label: "Multi Cursor Edit",
|
|
360
|
+
code: "multiCursorEdit",
|
|
335
361
|
confirmBeforeUndo: false,
|
|
336
362
|
undo: async () => {
|
|
337
|
-
newElementsMap.forEach(async
|
|
338
|
-
value.reverse().forEach(async
|
|
363
|
+
newElementsMap.forEach(async value => {
|
|
364
|
+
value.reverse().forEach(async element => {
|
|
339
365
|
await element.undo();
|
|
340
366
|
});
|
|
341
367
|
});
|
|
342
368
|
},
|
|
343
369
|
redo: async () => {
|
|
344
|
-
newElementsMap.forEach(async
|
|
345
|
-
value.forEach(async
|
|
370
|
+
newElementsMap.forEach(async value => {
|
|
371
|
+
value.forEach(async element => {
|
|
346
372
|
await element.redo();
|
|
347
373
|
});
|
|
348
374
|
});
|
|
@@ -365,7 +391,7 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
|
|
|
365
391
|
this.trackedCells = [];
|
|
366
392
|
this.totalMatchesCount = 0;
|
|
367
393
|
this.startPosition = undefined;
|
|
368
|
-
this.word =
|
|
394
|
+
this.word = "";
|
|
369
395
|
}
|
|
370
396
|
async findAndTrackNextSelection(focusedCell) {
|
|
371
397
|
if (this.state === NotebookMultiCursorState.Idle) {
|
|
@@ -390,7 +416,7 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
|
|
|
390
416
|
}
|
|
391
417
|
this.startPosition = {
|
|
392
418
|
cellIndex: index,
|
|
393
|
-
position: ( new Position(inputSelection.startLineNumber, word.startColumn))
|
|
419
|
+
position: ( new Position(inputSelection.startLineNumber, word.startColumn))
|
|
394
420
|
};
|
|
395
421
|
const newSelection = ( new Selection(
|
|
396
422
|
inputSelection.startLineNumber,
|
|
@@ -401,18 +427,17 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
|
|
|
401
427
|
focusedCell.setSelections([newSelection]);
|
|
402
428
|
this.anchorCell = this.notebookEditor.activeCellAndCodeEditor;
|
|
403
429
|
if (!this.anchorCell || this.anchorCell[0].handle !== focusedCell.handle) {
|
|
404
|
-
throw ( new Error(
|
|
430
|
+
throw ( new Error("Active cell is not the same as the cell passed as context"));
|
|
405
431
|
}
|
|
406
432
|
if (!(this.anchorCell[1] instanceof CodeEditorWidget)) {
|
|
407
|
-
throw ( new Error(
|
|
433
|
+
throw ( new Error("Active cell is not an instance of CodeEditorWidget"));
|
|
408
434
|
}
|
|
409
435
|
await this.updateTrackedCell(focusedCell, [newSelection]);
|
|
410
436
|
this._nbIsMultiSelectSession.set(true);
|
|
411
437
|
this.state = NotebookMultiCursorState.Selecting;
|
|
412
438
|
this._nbMultiSelectState.set(NotebookMultiCursorState.Selecting);
|
|
413
439
|
this._onDidChangeAnchorCell.fire();
|
|
414
|
-
}
|
|
415
|
-
else if (this.state === NotebookMultiCursorState.Selecting) {
|
|
440
|
+
} else if (this.state === NotebookMultiCursorState.Selecting) {
|
|
416
441
|
const notebookTextModel = this.notebookEditor.textModel;
|
|
417
442
|
if (!notebookTextModel) {
|
|
418
443
|
return;
|
|
@@ -428,7 +453,10 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
|
|
|
428
453
|
if (totalSelections >= this.totalMatchesCount) {
|
|
429
454
|
return;
|
|
430
455
|
}
|
|
431
|
-
const findResult = notebookTextModel.findNextMatch(this.word, {
|
|
456
|
+
const findResult = notebookTextModel.findNextMatch(this.word, {
|
|
457
|
+
cellIndex: index,
|
|
458
|
+
position: focusedCell.getSelections()[focusedCell.getSelections().length - 1].getEndPosition()
|
|
459
|
+
}, false, true, USUAL_WORD_SEPARATORS, this.startPosition);
|
|
432
460
|
if (!findResult) {
|
|
433
461
|
return;
|
|
434
462
|
}
|
|
@@ -437,21 +465,28 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
|
|
|
437
465
|
return;
|
|
438
466
|
}
|
|
439
467
|
if (findResult.cell.handle === focusedCell.handle) {
|
|
440
|
-
const selections = [
|
|
468
|
+
const selections = [
|
|
469
|
+
...focusedCell.getSelections(),
|
|
470
|
+
Selection.fromRange(findResult.match.range, SelectionDirection.LTR)
|
|
471
|
+
];
|
|
441
472
|
const trackedCell = await this.updateTrackedCell(focusedCell, selections);
|
|
442
473
|
findResultCellViewModel.setSelections(trackedCell.matchSelections);
|
|
443
|
-
}
|
|
444
|
-
else if (findResult.cell.handle !== focusedCell.handle) {
|
|
474
|
+
} else if (findResult.cell.handle !== focusedCell.handle) {
|
|
445
475
|
await this.notebookEditor.revealRangeInViewAsync(findResultCellViewModel, findResult.match.range);
|
|
446
|
-
await this.notebookEditor.focusNotebookCell(findResultCellViewModel,
|
|
447
|
-
const trackedCell = await this.updateTrackedCell(
|
|
476
|
+
await this.notebookEditor.focusNotebookCell(findResultCellViewModel, "editor");
|
|
477
|
+
const trackedCell = await this.updateTrackedCell(
|
|
478
|
+
findResultCellViewModel,
|
|
479
|
+
[Selection.fromRange(findResult.match.range, SelectionDirection.LTR)]
|
|
480
|
+
);
|
|
448
481
|
findResultCellViewModel.setSelections(trackedCell.matchSelections);
|
|
449
482
|
this.anchorCell = this.notebookEditor.activeCellAndCodeEditor;
|
|
450
483
|
if (!this.anchorCell || !(this.anchorCell[1] instanceof CodeEditorWidget)) {
|
|
451
|
-
throw ( new Error(
|
|
484
|
+
throw ( new Error("Active cell is not an instance of CodeEditorWidget"));
|
|
452
485
|
}
|
|
453
486
|
this._onDidChangeAnchorCell.fire();
|
|
454
|
-
this.initializeMultiSelectDecorations(
|
|
487
|
+
this.initializeMultiSelectDecorations(
|
|
488
|
+
this.trackedCells.find(trackedCell => trackedCell.cellViewModel.handle === focusedCell.handle)
|
|
489
|
+
);
|
|
455
490
|
}
|
|
456
491
|
}
|
|
457
492
|
}
|
|
@@ -462,8 +497,7 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
|
|
|
462
497
|
}
|
|
463
498
|
if (matches) {
|
|
464
499
|
await this.handleFindWidgetSelectAllMatches(matches);
|
|
465
|
-
}
|
|
466
|
-
else {
|
|
500
|
+
} else {
|
|
467
501
|
await this.handleCellEditorSelectAllMatches(notebookTextModel, focusedCell);
|
|
468
502
|
}
|
|
469
503
|
await this.syncCursorsControllers();
|
|
@@ -477,7 +511,7 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
|
|
|
477
511
|
if (!matches.length) {
|
|
478
512
|
return;
|
|
479
513
|
}
|
|
480
|
-
await this.notebookEditor.focusNotebookCell(matches[0].cell,
|
|
514
|
+
await this.notebookEditor.focusNotebookCell(matches[0].cell, "editor");
|
|
481
515
|
this.anchorCell = this.notebookEditor.activeCellAndCodeEditor;
|
|
482
516
|
this.trackedCells = [];
|
|
483
517
|
for (const match of matches) {
|
|
@@ -508,14 +542,14 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
|
|
|
508
542
|
}
|
|
509
543
|
this.startPosition = {
|
|
510
544
|
cellIndex: index,
|
|
511
|
-
position: ( new Position(inputSelection.startLineNumber, word.startColumn))
|
|
545
|
+
position: ( new Position(inputSelection.startLineNumber, word.startColumn))
|
|
512
546
|
};
|
|
513
547
|
this.anchorCell = this.notebookEditor.activeCellAndCodeEditor;
|
|
514
548
|
if (!this.anchorCell || this.anchorCell[0].handle !== focusedCell.handle) {
|
|
515
|
-
throw ( new Error(
|
|
549
|
+
throw ( new Error("Active cell is not the same as the cell passed as context"));
|
|
516
550
|
}
|
|
517
551
|
if (!(this.anchorCell[1] instanceof CodeEditorWidget)) {
|
|
518
|
-
throw ( new Error(
|
|
552
|
+
throw ( new Error("Active cell is not an instance of CodeEditorWidget"));
|
|
519
553
|
}
|
|
520
554
|
const findResults = notebookTextModel.findMatches(this.word, false, true, USUAL_WORD_SEPARATORS);
|
|
521
555
|
this.trackedCells = [];
|
|
@@ -531,8 +565,7 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
|
|
|
531
565
|
this._nbIsMultiSelectSession.set(true);
|
|
532
566
|
this.state = NotebookMultiCursorState.Selecting;
|
|
533
567
|
this._nbMultiSelectState.set(NotebookMultiCursorState.Selecting);
|
|
534
|
-
}
|
|
535
|
-
else if (this.state === NotebookMultiCursorState.Selecting) {
|
|
568
|
+
} else if (this.state === NotebookMultiCursorState.Selecting) {
|
|
536
569
|
const findResults = notebookTextModel.findMatches(this.word, false, true, USUAL_WORD_SEPARATORS);
|
|
537
570
|
for (const res of findResults) {
|
|
538
571
|
await this.updateTrackedCell(res.cell, ( res.matches.map(match => Selection.fromRange(match.range, SelectionDirection.LTR))));
|
|
@@ -542,14 +575,13 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
|
|
|
542
575
|
async updateTrackedCell(cell, selections) {
|
|
543
576
|
const cellViewModel = cell instanceof NotebookCellTextModel ? this.notebookEditor.getCellByHandle(cell.handle) : cell;
|
|
544
577
|
if (!cellViewModel) {
|
|
545
|
-
throw ( new Error(
|
|
578
|
+
throw ( new Error("Cell not found"));
|
|
546
579
|
}
|
|
547
580
|
let trackedMatch = this.trackedCells.find(trackedCell => trackedCell.cellViewModel.handle === cellViewModel.handle);
|
|
548
581
|
if (trackedMatch) {
|
|
549
582
|
this.clearDecorations(trackedMatch);
|
|
550
583
|
trackedMatch.matchSelections = selections;
|
|
551
|
-
}
|
|
552
|
-
else {
|
|
584
|
+
} else {
|
|
553
585
|
const initialSelection = cellViewModel.getSelections()[0];
|
|
554
586
|
const textModel = await cellViewModel.resolveTextModel();
|
|
555
587
|
textModel.pushStackElement();
|
|
@@ -579,7 +611,13 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
|
|
|
579
611
|
if (!controller) {
|
|
580
612
|
return;
|
|
581
613
|
}
|
|
582
|
-
const [, commands] = DeleteOperations.deleteLeft(
|
|
614
|
+
const [, commands] = DeleteOperations.deleteLeft(
|
|
615
|
+
controller.getPrevEditOperationType(),
|
|
616
|
+
controller.context.cursorConfig,
|
|
617
|
+
controller.context.model,
|
|
618
|
+
controller.getSelections(),
|
|
619
|
+
controller.getAutoClosedCharacters()
|
|
620
|
+
);
|
|
583
621
|
const delSelections = CommandExecutor.executeCommands(controller.context.model, controller.getSelections(), commands);
|
|
584
622
|
if (!delSelections) {
|
|
585
623
|
return;
|
|
@@ -594,15 +632,19 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
|
|
|
594
632
|
if (!controller) {
|
|
595
633
|
return;
|
|
596
634
|
}
|
|
597
|
-
const [, commands] = DeleteOperations.deleteRight(
|
|
635
|
+
const [, commands] = DeleteOperations.deleteRight(
|
|
636
|
+
controller.getPrevEditOperationType(),
|
|
637
|
+
controller.context.cursorConfig,
|
|
638
|
+
controller.context.model,
|
|
639
|
+
controller.getSelections()
|
|
640
|
+
);
|
|
598
641
|
if (cell.cellViewModel.handle !== this.anchorCell?.[0].handle) {
|
|
599
642
|
const delSelections = CommandExecutor.executeCommands(controller.context.model, controller.getSelections(), commands);
|
|
600
643
|
if (!delSelections) {
|
|
601
644
|
return;
|
|
602
645
|
}
|
|
603
646
|
controller.setSelections(( new ViewModelEventsCollector()), undefined, delSelections, CursorChangeReason.Explicit);
|
|
604
|
-
}
|
|
605
|
-
else {
|
|
647
|
+
} else {
|
|
606
648
|
controller.setSelections(( new ViewModelEventsCollector()), undefined, cell.cellViewModel.getSelections(), CursorChangeReason.Explicit);
|
|
607
649
|
}
|
|
608
650
|
});
|
|
@@ -658,8 +700,8 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
|
|
|
658
700
|
decorations.push({
|
|
659
701
|
range: Selection.fromPositions(selection.getEndPosition()),
|
|
660
702
|
options: {
|
|
661
|
-
description:
|
|
662
|
-
className: this.getClassName(cell.cursorConfig, true)
|
|
703
|
+
description: "",
|
|
704
|
+
className: this.getClassName(cell.cursorConfig, true)
|
|
663
705
|
}
|
|
664
706
|
});
|
|
665
707
|
});
|
|
@@ -682,17 +724,17 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
|
|
|
682
724
|
newDecorations.push({
|
|
683
725
|
range: selection,
|
|
684
726
|
options: {
|
|
685
|
-
description:
|
|
686
|
-
className: this.getClassName(cell.cursorConfig, false)
|
|
727
|
+
description: "",
|
|
728
|
+
className: this.getClassName(cell.cursorConfig, false)
|
|
687
729
|
}
|
|
688
730
|
});
|
|
689
731
|
}
|
|
690
732
|
newDecorations.push({
|
|
691
733
|
range: Selection.fromPositions(selection.getPosition()),
|
|
692
734
|
options: {
|
|
693
|
-
description:
|
|
735
|
+
description: "",
|
|
694
736
|
zIndex: 10000,
|
|
695
|
-
className: this.getClassName(cell.cursorConfig, true)
|
|
737
|
+
className: this.getClassName(cell.cursorConfig, true)
|
|
696
738
|
}
|
|
697
739
|
});
|
|
698
740
|
});
|
|
@@ -714,49 +756,49 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
|
|
|
714
756
|
});
|
|
715
757
|
}
|
|
716
758
|
getClassName(cursorConfig, isCursor) {
|
|
717
|
-
let result = isCursor ?
|
|
759
|
+
let result = isCursor ? ".nb-multicursor-cursor" : ".nb-multicursor-selection";
|
|
718
760
|
if (isCursor) {
|
|
719
761
|
switch (cursorConfig.cursorStyle) {
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
762
|
+
case TextEditorCursorStyle.Line:
|
|
763
|
+
break;
|
|
764
|
+
case TextEditorCursorStyle.Block:
|
|
765
|
+
result += ".nb-cursor-block-style";
|
|
766
|
+
break;
|
|
767
|
+
case TextEditorCursorStyle.Underline:
|
|
768
|
+
result += ".nb-cursor-underline-style";
|
|
769
|
+
break;
|
|
770
|
+
case TextEditorCursorStyle.LineThin:
|
|
771
|
+
result += ".nb-cursor-line-thin-style";
|
|
772
|
+
break;
|
|
773
|
+
case TextEditorCursorStyle.BlockOutline:
|
|
774
|
+
result += ".nb-cursor-block-outline-style";
|
|
775
|
+
break;
|
|
776
|
+
case TextEditorCursorStyle.UnderlineThin:
|
|
777
|
+
result += ".nb-cursor-underline-thin-style";
|
|
778
|
+
break;
|
|
737
779
|
}
|
|
738
780
|
switch (cursorConfig.cursorBlinking) {
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
}
|
|
758
|
-
if (cursorConfig.cursorSmoothCaretAnimation ===
|
|
759
|
-
result +=
|
|
781
|
+
case TextEditorCursorBlinkingStyle.Blink:
|
|
782
|
+
result += ".nb-blink";
|
|
783
|
+
break;
|
|
784
|
+
case TextEditorCursorBlinkingStyle.Smooth:
|
|
785
|
+
result += ".nb-smooth";
|
|
786
|
+
break;
|
|
787
|
+
case TextEditorCursorBlinkingStyle.Phase:
|
|
788
|
+
result += ".nb-phase";
|
|
789
|
+
break;
|
|
790
|
+
case TextEditorCursorBlinkingStyle.Expand:
|
|
791
|
+
result += ".nb-expand";
|
|
792
|
+
break;
|
|
793
|
+
case TextEditorCursorBlinkingStyle.Solid:
|
|
794
|
+
result += ".nb-solid";
|
|
795
|
+
break;
|
|
796
|
+
default:
|
|
797
|
+
result += ".nb-solid";
|
|
798
|
+
break;
|
|
799
|
+
}
|
|
800
|
+
if (cursorConfig.cursorSmoothCaretAnimation === "on" || cursorConfig.cursorSmoothCaretAnimation === "explicit") {
|
|
801
|
+
result += ".nb-smooth-caret-animation";
|
|
760
802
|
}
|
|
761
803
|
}
|
|
762
804
|
return result;
|
|
@@ -771,22 +813,15 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
|
|
|
771
813
|
this.trackedCells = [];
|
|
772
814
|
}
|
|
773
815
|
};
|
|
774
|
-
NotebookMultiCursorController = ( __decorate([
|
|
775
|
-
( __param(1, IContextKeyService)),
|
|
776
|
-
( __param(2, ITextModelService)),
|
|
777
|
-
( __param(3, ILanguageConfigurationService)),
|
|
778
|
-
( __param(4, IAccessibilityService)),
|
|
779
|
-
( __param(5, IConfigurationService)),
|
|
780
|
-
( __param(6, IUndoRedoService))
|
|
781
|
-
], NotebookMultiCursorController));
|
|
816
|
+
NotebookMultiCursorController = ( __decorate([( __param(1, IContextKeyService)), ( __param(2, ITextModelService)), ( __param(3, ILanguageConfigurationService)), ( __param(4, IAccessibilityService)), ( __param(5, IConfigurationService)), ( __param(6, IUndoRedoService))], NotebookMultiCursorController));
|
|
782
817
|
class NotebookSelectAllFindMatches extends NotebookAction {
|
|
783
818
|
constructor() {
|
|
784
819
|
super({
|
|
785
820
|
id: NOTEBOOK_SELECT_ALL_FIND_MATCHES_ID,
|
|
786
|
-
title: ( localize(
|
|
787
|
-
precondition: ( ContextKeyExpr.and(( ContextKeyExpr.equals(
|
|
821
|
+
title: ( localize(9619, "Select All Occurrences of Find Match")),
|
|
822
|
+
precondition: ( ContextKeyExpr.and(( ContextKeyExpr.equals("config.notebook.multiCursor.enabled", true)))),
|
|
788
823
|
keybinding: {
|
|
789
|
-
when: ( ContextKeyExpr.or(( ContextKeyExpr.and(( ContextKeyExpr.equals(
|
|
824
|
+
when: ( ContextKeyExpr.or(( ContextKeyExpr.and(( ContextKeyExpr.equals("config.notebook.multiCursor.enabled", true)), NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_CELL_EDITOR_FOCUSED)), ( ContextKeyExpr.and(( ContextKeyExpr.equals("config.notebook.multiCursor.enabled", true)), KEYBINDING_CONTEXT_NOTEBOOK_FIND_WIDGET_FOCUSED)))),
|
|
790
825
|
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KeyL,
|
|
791
826
|
weight: KeybindingWeight.WorkbenchContrib
|
|
792
827
|
}
|
|
@@ -806,8 +841,7 @@ class NotebookSelectAllFindMatches extends NotebookAction {
|
|
|
806
841
|
if (findController.widget.isFocused) {
|
|
807
842
|
const findModel = findController.widget.findModel;
|
|
808
843
|
cursorController.selectAllMatches(context.cell, findModel.findMatches);
|
|
809
|
-
}
|
|
810
|
-
else {
|
|
844
|
+
} else {
|
|
811
845
|
cursorController.selectAllMatches(context.cell);
|
|
812
846
|
}
|
|
813
847
|
}
|
|
@@ -816,10 +850,10 @@ class NotebookAddMatchToMultiSelectionAction extends NotebookAction {
|
|
|
816
850
|
constructor() {
|
|
817
851
|
super({
|
|
818
852
|
id: NOTEBOOK_ADD_FIND_MATCH_TO_SELECTION_ID,
|
|
819
|
-
title: ( localize(
|
|
820
|
-
precondition: ( ContextKeyExpr.and(( ContextKeyExpr.equals(
|
|
853
|
+
title: ( localize(9620, "Add Selection to Next Find Match")),
|
|
854
|
+
precondition: ( ContextKeyExpr.and(( ContextKeyExpr.equals("config.notebook.multiCursor.enabled", true)), NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_CELL_EDITOR_FOCUSED)),
|
|
821
855
|
keybinding: {
|
|
822
|
-
when: ( ContextKeyExpr.and(( ContextKeyExpr.equals(
|
|
856
|
+
when: ( ContextKeyExpr.and(( ContextKeyExpr.equals("config.notebook.multiCursor.enabled", true)), NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_CELL_EDITOR_FOCUSED)),
|
|
823
857
|
primary: KeyMod.CtrlCmd | KeyCode.KeyD,
|
|
824
858
|
weight: KeybindingWeight.WorkbenchContrib
|
|
825
859
|
}
|
|
@@ -841,11 +875,11 @@ class NotebookAddMatchToMultiSelectionAction extends NotebookAction {
|
|
|
841
875
|
class NotebookExitMultiSelectionAction extends NotebookAction {
|
|
842
876
|
constructor() {
|
|
843
877
|
super({
|
|
844
|
-
id:
|
|
845
|
-
title: ( localize(
|
|
846
|
-
precondition: ( ContextKeyExpr.and(( ContextKeyExpr.equals(
|
|
878
|
+
id: "noteMultiCursor.exit",
|
|
879
|
+
title: ( localize(9621, "Exit Multi Cursor Mode")),
|
|
880
|
+
precondition: ( ContextKeyExpr.and(( ContextKeyExpr.equals("config.notebook.multiCursor.enabled", true)), NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_MULTI_CURSOR_CONTEXT.IsNotebookMultiCursor)),
|
|
847
881
|
keybinding: {
|
|
848
|
-
when: ( ContextKeyExpr.and(( ContextKeyExpr.equals(
|
|
882
|
+
when: ( ContextKeyExpr.and(( ContextKeyExpr.equals("config.notebook.multiCursor.enabled", true)), NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_MULTI_CURSOR_CONTEXT.IsNotebookMultiCursor)),
|
|
849
883
|
primary: KeyCode.Escape,
|
|
850
884
|
weight: KeybindingWeight.WorkbenchContrib
|
|
851
885
|
}
|
|
@@ -864,11 +898,11 @@ class NotebookExitMultiSelectionAction extends NotebookAction {
|
|
|
864
898
|
class NotebookDeleteLeftMultiSelectionAction extends NotebookAction {
|
|
865
899
|
constructor() {
|
|
866
900
|
super({
|
|
867
|
-
id:
|
|
868
|
-
title: ( localize(
|
|
869
|
-
precondition: ( ContextKeyExpr.and(( ContextKeyExpr.equals(
|
|
901
|
+
id: "noteMultiCursor.deleteLeft",
|
|
902
|
+
title: ( localize(9622, "Delete Left")),
|
|
903
|
+
precondition: ( ContextKeyExpr.and(( ContextKeyExpr.equals("config.notebook.multiCursor.enabled", true)), NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_MULTI_CURSOR_CONTEXT.IsNotebookMultiCursor, ( ContextKeyExpr.or(( NOTEBOOK_MULTI_CURSOR_CONTEXT.NotebookMultiSelectCursorState.isEqualTo(NotebookMultiCursorState.Selecting)), ( NOTEBOOK_MULTI_CURSOR_CONTEXT.NotebookMultiSelectCursorState.isEqualTo(NotebookMultiCursorState.Editing)))))),
|
|
870
904
|
keybinding: {
|
|
871
|
-
when: ( ContextKeyExpr.and(( ContextKeyExpr.equals(
|
|
905
|
+
when: ( ContextKeyExpr.and(( ContextKeyExpr.equals("config.notebook.multiCursor.enabled", true)), NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_MULTI_CURSOR_CONTEXT.IsNotebookMultiCursor, ( ContextKeyExpr.or(( NOTEBOOK_MULTI_CURSOR_CONTEXT.NotebookMultiSelectCursorState.isEqualTo(NotebookMultiCursorState.Selecting)), ( NOTEBOOK_MULTI_CURSOR_CONTEXT.NotebookMultiSelectCursorState.isEqualTo(NotebookMultiCursorState.Editing)))))),
|
|
872
906
|
primary: KeyCode.Backspace,
|
|
873
907
|
weight: KeybindingWeight.WorkbenchContrib
|
|
874
908
|
}
|
|
@@ -887,11 +921,11 @@ class NotebookDeleteLeftMultiSelectionAction extends NotebookAction {
|
|
|
887
921
|
class NotebookDeleteRightMultiSelectionAction extends NotebookAction {
|
|
888
922
|
constructor() {
|
|
889
923
|
super({
|
|
890
|
-
id:
|
|
891
|
-
title: ( localize(
|
|
892
|
-
precondition: ( ContextKeyExpr.and(( ContextKeyExpr.equals(
|
|
924
|
+
id: "noteMultiCursor.deleteRight",
|
|
925
|
+
title: ( localize(9623, "Delete Right")),
|
|
926
|
+
precondition: ( ContextKeyExpr.and(( ContextKeyExpr.equals("config.notebook.multiCursor.enabled", true)), NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_MULTI_CURSOR_CONTEXT.IsNotebookMultiCursor, ( ContextKeyExpr.or(( NOTEBOOK_MULTI_CURSOR_CONTEXT.NotebookMultiSelectCursorState.isEqualTo(NotebookMultiCursorState.Selecting)), ( NOTEBOOK_MULTI_CURSOR_CONTEXT.NotebookMultiSelectCursorState.isEqualTo(NotebookMultiCursorState.Editing)))))),
|
|
893
927
|
keybinding: {
|
|
894
|
-
when: ( ContextKeyExpr.and(( ContextKeyExpr.equals(
|
|
928
|
+
when: ( ContextKeyExpr.and(( ContextKeyExpr.equals("config.notebook.multiCursor.enabled", true)), NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_MULTI_CURSOR_CONTEXT.IsNotebookMultiCursor, ( ContextKeyExpr.or(( NOTEBOOK_MULTI_CURSOR_CONTEXT.NotebookMultiSelectCursorState.isEqualTo(NotebookMultiCursorState.Selecting)), ( NOTEBOOK_MULTI_CURSOR_CONTEXT.NotebookMultiSelectCursorState.isEqualTo(NotebookMultiCursorState.Editing)))))),
|
|
895
929
|
primary: KeyCode.Delete,
|
|
896
930
|
weight: KeybindingWeight.WorkbenchContrib
|
|
897
931
|
}
|
|
@@ -913,45 +947,52 @@ class NotebookDeleteRightMultiSelectionAction extends NotebookAction {
|
|
|
913
947
|
}
|
|
914
948
|
}
|
|
915
949
|
let NotebookMultiCursorUndoRedoContribution = class NotebookMultiCursorUndoRedoContribution extends Disposable {
|
|
916
|
-
static {
|
|
950
|
+
static {
|
|
951
|
+
this.ID = "workbench.contrib.notebook.multiCursorUndoRedo";
|
|
952
|
+
}
|
|
917
953
|
constructor(_editorService, configurationService) {
|
|
918
954
|
super();
|
|
919
955
|
this._editorService = _editorService;
|
|
920
956
|
this.configurationService = configurationService;
|
|
921
|
-
if (!this.configurationService.getValue(
|
|
957
|
+
if (!this.configurationService.getValue("notebook.multiCursor.enabled")) {
|
|
922
958
|
return;
|
|
923
959
|
}
|
|
924
960
|
const PRIORITY = 10005;
|
|
925
|
-
this._register(
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
961
|
+
this._register(
|
|
962
|
+
UndoCommand.addImplementation(PRIORITY, "notebook-multicursor-undo-redo", () => {
|
|
963
|
+
const editor = getNotebookEditorFromEditorPane(this._editorService.activeEditorPane);
|
|
964
|
+
if (!editor) {
|
|
965
|
+
return false;
|
|
966
|
+
}
|
|
967
|
+
if (!editor.hasModel()) {
|
|
968
|
+
return false;
|
|
969
|
+
}
|
|
970
|
+
const controller = editor.getContribution(NotebookMultiCursorController.id);
|
|
971
|
+
return controller.undo();
|
|
972
|
+
}, ( ContextKeyExpr.and(( ContextKeyExpr.equals("config.notebook.multiCursor.enabled", true)), NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_MULTI_CURSOR_CONTEXT.IsNotebookMultiCursor)))
|
|
973
|
+
);
|
|
974
|
+
this._register(
|
|
975
|
+
RedoCommand.addImplementation(PRIORITY, "notebook-multicursor-undo-redo", () => {
|
|
976
|
+
const editor = getNotebookEditorFromEditorPane(this._editorService.activeEditorPane);
|
|
977
|
+
if (!editor) {
|
|
978
|
+
return false;
|
|
979
|
+
}
|
|
980
|
+
if (!editor.hasModel()) {
|
|
981
|
+
return false;
|
|
982
|
+
}
|
|
983
|
+
const controller = editor.getContribution(NotebookMultiCursorController.id);
|
|
984
|
+
return controller.redo();
|
|
985
|
+
}, ( ContextKeyExpr.and(( ContextKeyExpr.equals("config.notebook.multiCursor.enabled", true)), NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_MULTI_CURSOR_CONTEXT.IsNotebookMultiCursor)))
|
|
986
|
+
);
|
|
947
987
|
}
|
|
948
988
|
};
|
|
949
|
-
NotebookMultiCursorUndoRedoContribution = ( __decorate([
|
|
950
|
-
( __param(0, IEditorService)),
|
|
951
|
-
( __param(1, IConfigurationService))
|
|
952
|
-
], NotebookMultiCursorUndoRedoContribution));
|
|
989
|
+
NotebookMultiCursorUndoRedoContribution = ( __decorate([( __param(0, IEditorService)), ( __param(1, IConfigurationService))], NotebookMultiCursorUndoRedoContribution));
|
|
953
990
|
registerNotebookContribution(NotebookMultiCursorController.id, NotebookMultiCursorController);
|
|
954
|
-
registerWorkbenchContribution2(
|
|
991
|
+
registerWorkbenchContribution2(
|
|
992
|
+
NotebookMultiCursorUndoRedoContribution.ID,
|
|
993
|
+
NotebookMultiCursorUndoRedoContribution,
|
|
994
|
+
WorkbenchPhase.BlockRestore
|
|
995
|
+
);
|
|
955
996
|
registerAction2(NotebookSelectAllFindMatches);
|
|
956
997
|
registerAction2(NotebookAddMatchToMultiSelectionAction);
|
|
957
998
|
registerAction2(NotebookExitMultiSelectionAction);
|