@codingame/monaco-vscode-notebook-service-override 9.0.2 → 10.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.
Files changed (60) hide show
  1. package/package.json +2 -2
  2. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +16 -19
  3. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +62 -63
  4. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticsActions.js +4 -6
  5. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib.js +5 -5
  6. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +8 -9
  7. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +35 -37
  8. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +1 -2
  9. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +1 -2
  10. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +2 -2
  11. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +16 -17
  12. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +17 -20
  13. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +15 -18
  14. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +4 -6
  15. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +1 -2
  16. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +1 -1
  17. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +2 -2
  18. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookMulticursor.js +319 -67
  19. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +64 -61
  20. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +2 -2
  21. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +1 -1
  22. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +10 -9
  23. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +48 -24
  24. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +35 -37
  25. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +1 -1
  26. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +45 -31
  27. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +4 -5
  28. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +2 -2
  29. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +2 -2
  30. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +124 -71
  31. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.js +179 -7
  32. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.js +52 -55
  33. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +30 -32
  34. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +28 -30
  35. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +17 -18
  36. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/notebookIndentationActions.js +7 -7
  37. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +20 -22
  38. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +126 -46
  39. package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +171 -83
  40. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityHelp.js +19 -19
  41. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibleView.js +5 -6
  42. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +33 -33
  43. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +4 -5
  44. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +1 -1
  45. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +6 -6
  46. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +7 -8
  47. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +3 -5
  48. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +6 -9
  49. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +1 -1
  50. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +13 -21
  51. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +90 -39
  52. package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +3 -5
  53. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +40 -31
  54. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +7 -7
  55. package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +10 -11
  56. package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorker.js +29 -55
  57. package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +15 -17
  58. package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +12 -14
  59. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +2 -4
  60. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.js +0 -33
@@ -1,37 +1,36 @@
1
1
  import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
2
2
  import { localize } from 'vscode/vscode/vs/nls';
3
3
  import { Emitter } from 'vscode/vscode/vs/base/common/event';
4
- import { KeyMod, KeyCode } from 'vscode/vscode/vs/base/common/keyCodes';
5
4
  import { Disposable, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
6
5
  import { ResourceMap } from 'vscode/vscode/vs/base/common/map';
7
6
  import { EditorConfiguration } from 'vscode/vscode/vs/editor/browser/config/editorConfiguration';
7
+ import { CoreEditingCommands } from 'vscode/vscode/vs/editor/browser/coreCommands';
8
+ import { UndoCommand, RedoCommand } from 'vscode/vscode/vs/editor/browser/editorExtensions';
8
9
  import { CodeEditorWidget } from 'vscode/vscode/vs/editor/browser/widget/codeEditor/codeEditorWidget';
9
- import { Selection, SelectionDirection } from 'vscode/vscode/vs/editor/common/core/selection';
10
+ import { cursorStyleFromString, cursorBlinkingStyleFromString, TextEditorCursorStyle } from 'vscode/vscode/vs/editor/common/config/editorOptions';
11
+ import { Selection } from 'vscode/vscode/vs/editor/common/core/selection';
10
12
  import { USUAL_WORD_SEPARATORS } from 'vscode/vscode/vs/editor/common/core/wordHelper';
11
13
  import { CursorsController, CommandExecutor } from 'vscode/vscode/vs/editor/common/cursor/cursor';
12
14
  import { DeleteOperations } from 'vscode/vscode/vs/editor/common/cursor/cursorDeleteOperations';
13
15
  import { CursorConfiguration } from 'vscode/vscode/vs/editor/common/cursorCommon';
14
- import { CursorChangeReason } from 'vscode/vscode/vs/editor/common/cursorEvents';
15
16
  import { ILanguageConfigurationService } from 'vscode/vscode/vs/editor/common/languages/languageConfigurationRegistry';
16
17
  import { indentOfLine } from 'vscode/vscode/vs/editor/common/model/textModel';
17
18
  import { ITextModelService } from 'vscode/vscode/vs/editor/common/services/resolverService';
18
19
  import { ViewModelEventsCollector } from 'vscode/vscode/vs/editor/common/viewModelEventDispatcher';
20
+ import { WordHighlighterContribution } from 'vscode/vscode/vs/editor/contrib/wordHighlighter/browser/wordHighlighter';
19
21
  import { IAccessibilityService } from 'vscode/vscode/vs/platform/accessibility/common/accessibility.service';
20
22
  import { MenuId, registerAction2 } from 'vscode/vscode/vs/platform/actions/common/actions';
21
23
  import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
22
24
  import { RawContextKey, ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
23
25
  import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
24
- import { KeybindingWeight } from 'vscode/vscode/vs/platform/keybinding/common/keybindingsRegistry';
25
- import { UndoRedoElementType } from 'vscode/vscode/vs/platform/undoRedo/common/undoRedo';
26
26
  import { IUndoRedoService } from 'vscode/vscode/vs/platform/undoRedo/common/undoRedo.service';
27
+ import { registerWorkbenchContribution2 } from 'vscode/vscode/vs/workbench/common/contributions';
28
+ import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
29
+ import { NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_CELL_EDITOR_FOCUSED } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
27
30
  import { NotebookAction } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/coreActions';
28
31
  import { getNotebookEditorFromEditorPane } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
29
32
  import { registerNotebookContribution } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookEditorExtensions';
30
33
  import { CellEditorOptions } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/view/cellParts/cellEditorOptions';
31
- import { NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_CELL_EDITOR_FOCUSED } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
32
- import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
33
- import { UndoCommand, RedoCommand } from 'vscode/vscode/vs/editor/browser/editorExtensions';
34
- import { registerWorkbenchContribution2, WorkbenchPhase } from 'vscode/vscode/vs/workbench/common/contributions';
35
34
 
36
35
  const NOTEBOOK_ADD_FIND_MATCH_TO_SELECTION_ID = 'notebook.addFindMatchToSelection';
37
36
  var NotebookMultiCursorState;
@@ -40,12 +39,15 @@ var NotebookMultiCursorState;
40
39
  NotebookMultiCursorState[NotebookMultiCursorState["Selecting"] = 1] = "Selecting";
41
40
  NotebookMultiCursorState[NotebookMultiCursorState["Editing"] = 2] = "Editing";
42
41
  })(NotebookMultiCursorState || (NotebookMultiCursorState = {}))));
43
- const NOTEBOOK_MULTI_SELECTION_CONTEXT = {
44
- IsNotebookMultiSelect: ( (new RawContextKey('isNotebookMultiSelect', false))),
45
- NotebookMultiSelectState: ( (new RawContextKey('notebookMultiSelectState', NotebookMultiCursorState.Idle))),
42
+ const NOTEBOOK_MULTI_CURSOR_CONTEXT = {
43
+ IsNotebookMultiCursor: ( (new RawContextKey('isNotebookMultiSelect', false))),
44
+ NotebookMultiSelectCursorState: ( (new RawContextKey('notebookMultiSelectCursorState', NotebookMultiCursorState.Idle))),
46
45
  };
47
46
  let NotebookMultiCursorController = class NotebookMultiCursorController extends Disposable {
48
47
  static { this.id = 'notebook.multiCursorController'; }
48
+ getState() {
49
+ return this.state;
50
+ }
49
51
  constructor(notebookEditor, contextKeyService, textModelService, languageConfigurationService, accessibilityService, configurationService, undoRedoService) {
50
52
  super();
51
53
  this.notebookEditor = notebookEditor;
@@ -55,7 +57,6 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
55
57
  this.accessibilityService = accessibilityService;
56
58
  this.configurationService = configurationService;
57
59
  this.undoRedoService = undoRedoService;
58
- this.state = NotebookMultiCursorState.Idle;
59
60
  this.word = '';
60
61
  this.trackedMatches = [];
61
62
  this._onDidChangeAnchorCell = this._register(( (new Emitter())));
@@ -63,11 +64,9 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
63
64
  this.anchorDisposables = this._register(( (new DisposableStore())));
64
65
  this.cursorsDisposables = this._register(( (new DisposableStore())));
65
66
  this.cursorsControllers = ( (new ResourceMap()));
66
- this._nbIsMultiSelectSession = NOTEBOOK_MULTI_SELECTION_CONTEXT.IsNotebookMultiSelect.bindTo(this.contextKeyService);
67
- this._nbMultiSelectState = NOTEBOOK_MULTI_SELECTION_CONTEXT.NotebookMultiSelectState.bindTo(this.contextKeyService);
68
- if (!this.configurationService.getValue('notebook.multiSelect.enabled')) {
69
- return;
70
- }
67
+ this.state = NotebookMultiCursorState.Idle;
68
+ this._nbIsMultiSelectSession = NOTEBOOK_MULTI_CURSOR_CONTEXT.IsNotebookMultiCursor.bindTo(this.contextKeyService);
69
+ this._nbMultiSelectState = NOTEBOOK_MULTI_CURSOR_CONTEXT.NotebookMultiSelectCursorState.bindTo(this.contextKeyService);
71
70
  this.anchorCell = this.notebookEditor.activeCellAndCodeEditor;
72
71
  this._register(this.onDidChangeAnchorCell(() => {
73
72
  this.updateCursorsControllers();
@@ -84,7 +83,7 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
84
83
  }
85
84
  const cursorSimpleModel = this.constructCursorSimpleModel(match.cellViewModel);
86
85
  const converter = this.constructCoordinatesConverter();
87
- const editorConfig = match.config;
86
+ const editorConfig = match.editorConfig;
88
87
  const controller = this.cursorsDisposables.add(( (new CursorsController(
89
88
  textModel,
90
89
  cursorSimpleModel,
@@ -96,7 +95,7 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
96
95
  this.languageConfigurationService
97
96
  ))
98
97
  ))));
99
- controller.setSelections(( (new ViewModelEventsCollector())), undefined, match.wordSelections, CursorChangeReason.Explicit);
98
+ controller.setSelections(( (new ViewModelEventsCollector())), undefined, match.wordSelections, 3 );
100
99
  this.cursorsControllers.set(match.cellViewModel.uri, controller);
101
100
  });
102
101
  }
@@ -187,7 +186,7 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
187
186
  if (!activeSelections) {
188
187
  return;
189
188
  }
190
- anchorController.setSelections(( (new ViewModelEventsCollector())), 'keyboard', activeSelections, CursorChangeReason.Explicit);
189
+ anchorController.setSelections(( (new ViewModelEventsCollector())), 'keyboard', activeSelections, 3 );
191
190
  this.trackedMatches.forEach(match => {
192
191
  const controller = this.cursorsControllers.get(match.cellViewModel.uri);
193
192
  if (!controller) {
@@ -199,9 +198,73 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
199
198
  this.updateLazyDecorations();
200
199
  }));
201
200
  this.anchorDisposables.add(this.anchorCell[1].onDidChangeCursorSelection((e) => {
202
- if (e.source === 'mouse' || e.source === 'deleteRight') {
201
+ if (e.source === 'mouse') {
203
202
  this.resetToIdleState();
203
+ return;
204
204
  }
205
+ if (!e.oldSelections || e.reason === 0 || e.reason === 2 ) {
206
+ return;
207
+ }
208
+ const translation = {
209
+ deltaStartCol: e.selection.startColumn - e.oldSelections[0].startColumn,
210
+ deltaStartLine: e.selection.startLineNumber - e.oldSelections[0].startLineNumber,
211
+ deltaEndCol: e.selection.endColumn - e.oldSelections[0].endColumn,
212
+ deltaEndLine: e.selection.endLineNumber - e.oldSelections[0].endLineNumber,
213
+ };
214
+ const translationDir = e.selection.getDirection();
215
+ this.trackedMatches.forEach(match => {
216
+ const controller = this.cursorsControllers.get(match.cellViewModel.uri);
217
+ if (!controller) {
218
+ return;
219
+ }
220
+ const newSelections = ( (controller.getSelections().map(selection => {
221
+ const newStartCol = selection.startColumn + translation.deltaStartCol;
222
+ const newStartLine = selection.startLineNumber + translation.deltaStartLine;
223
+ const newEndCol = selection.endColumn + translation.deltaEndCol;
224
+ const newEndLine = selection.endLineNumber + translation.deltaEndLine;
225
+ return Selection.createWithDirection(newStartLine, newStartCol, newEndLine, newEndCol, translationDir);
226
+ })));
227
+ controller.setSelections(( (new ViewModelEventsCollector())), e.source, newSelections, 3 );
228
+ });
229
+ this.updateLazyDecorations();
230
+ }));
231
+ this.anchorDisposables.add(this.anchorCell[1].onWillTriggerEditorOperationEvent((e) => {
232
+ this.trackedMatches.forEach(match => {
233
+ if (match.cellViewModel.handle === this.anchorCell?.[0].handle) {
234
+ return;
235
+ }
236
+ const eventsCollector = ( (new ViewModelEventsCollector()));
237
+ const controller = this.cursorsControllers.get(match.cellViewModel.uri);
238
+ if (!controller) {
239
+ return;
240
+ }
241
+ switch (e.handlerId) {
242
+ case "compositionStart" :
243
+ controller.startComposition(eventsCollector);
244
+ return;
245
+ case "compositionEnd" :
246
+ controller.endComposition(eventsCollector, e.source);
247
+ return;
248
+ case "replacePreviousChar" : {
249
+ const args = e.payload;
250
+ controller.compositionType(eventsCollector, args.text || '', args.replaceCharCnt || 0, 0, 0, e.source);
251
+ return;
252
+ }
253
+ case "compositionType" : {
254
+ const args = e.payload;
255
+ controller.compositionType(eventsCollector, args.text || '', args.replacePrevCharCnt || 0, args.replaceNextCharCnt || 0, args.positionDelta || 0, e.source);
256
+ return;
257
+ }
258
+ case "paste" : {
259
+ const args = e.payload;
260
+ controller.paste(eventsCollector, args.text || '', args.pasteOnNewLine || false, args.multicursorText || null, e.source);
261
+ return;
262
+ }
263
+ case "cut" :
264
+ controller.cut(eventsCollector, e.source);
265
+ return;
266
+ }
267
+ });
205
268
  }));
206
269
  this.anchorDisposables.add(this.anchorCell[1].onDidBlurEditorWidget(() => {
207
270
  if (this.state === NotebookMultiCursorState.Selecting || this.state === NotebookMultiCursorState.Editing) {
@@ -235,7 +298,7 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
235
298
  });
236
299
  });
237
300
  this.undoRedoService.pushElement({
238
- type: UndoRedoElementType.Workspace,
301
+ type: 1 ,
239
302
  resources: resources,
240
303
  label: 'Multi Cursor Edit',
241
304
  code: 'multiCursorEdit',
@@ -266,6 +329,7 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
266
329
  match.cellViewModel.setSelections([match.initialSelection]);
267
330
  });
268
331
  this.anchorDisposables.clear();
332
+ this.anchorCell = undefined;
269
333
  this.cursorsDisposables.clear();
270
334
  this.cursorsControllers.clear();
271
335
  this.trackedMatches = [];
@@ -299,16 +363,22 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
299
363
  textModel.pushStackElement();
300
364
  this.trackedMatches = [];
301
365
  const editorConfig = this.constructCellEditorOptions(this.anchorCell[0]);
366
+ const rawEditorOptions = editorConfig.getRawOptions();
367
+ const cursorConfig = {
368
+ cursorStyle: cursorStyleFromString(rawEditorOptions.cursorStyle),
369
+ cursorBlinking: cursorBlinkingStyleFromString(rawEditorOptions.cursorBlinking),
370
+ cursorSmoothCaretAnimation: rawEditorOptions.cursorSmoothCaretAnimation
371
+ };
302
372
  const newMatch = {
303
373
  cellViewModel: cell,
304
374
  initialSelection: inputSelection,
305
375
  wordSelections: [newSelection],
306
- config: editorConfig,
376
+ editorConfig: editorConfig,
377
+ cursorConfig: cursorConfig,
307
378
  decorationIds: [],
308
379
  undoRedoHistory: this.undoRedoService.getElements(cell.uri)
309
380
  };
310
381
  this.trackedMatches.push(newMatch);
311
- this.initializeMultiSelectDecorations(newMatch);
312
382
  this._nbIsMultiSelectSession.set(true);
313
383
  this.state = NotebookMultiCursorState.Selecting;
314
384
  this._nbMultiSelectState.set(NotebookMultiCursorState.Selecting);
@@ -333,35 +403,54 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
333
403
  return;
334
404
  }
335
405
  let newMatch;
336
- if (findResult.cell.handle !== cell.handle) {
406
+ if (findResult.cell.handle === cell.handle) {
407
+ newMatch = this.trackedMatches.find(match => match.cellViewModel.handle === findResult.cell.handle);
408
+ newMatch.wordSelections.push(Selection.fromRange(findResult.match.range, 0 ));
409
+ resultCellViewModel.setSelections(newMatch.wordSelections);
410
+ const controller = this.cursorsControllers.get(newMatch.cellViewModel.uri);
411
+ if (!controller) {
412
+ return;
413
+ }
414
+ controller.setSelections(( (new ViewModelEventsCollector())), undefined, newMatch.wordSelections, 3 );
415
+ }
416
+ else if (findResult.cell.handle !== cell.handle) {
337
417
  await this.notebookEditor.revealRangeInViewAsync(resultCellViewModel, findResult.match.range);
338
418
  this.notebookEditor.focusNotebookCell(resultCellViewModel, 'editor');
339
419
  const initialSelection = resultCellViewModel.getSelections()[0];
340
- const newSelection = Selection.fromRange(findResult.match.range, SelectionDirection.LTR);
420
+ const newSelection = Selection.fromRange(findResult.match.range, 0 );
341
421
  resultCellViewModel.setSelections([newSelection]);
422
+ if (this.notebookEditor.activeCellAndCodeEditor?.[0].handle !== resultCellViewModel.handle) {
423
+ throw ( (new Error('Focused cell does not match the find match data')));
424
+ }
342
425
  this.anchorCell = this.notebookEditor.activeCellAndCodeEditor;
343
426
  if (!this.anchorCell || !(this.anchorCell[1] instanceof CodeEditorWidget)) {
344
427
  throw ( (new Error('Active cell is not an instance of CodeEditorWidget')));
345
428
  }
346
429
  const textModel = await resultCellViewModel.resolveTextModel();
347
430
  textModel.pushStackElement();
431
+ const editorConfig = this.constructCellEditorOptions(this.anchorCell[0]);
432
+ const rawEditorOptions = editorConfig.getRawOptions();
433
+ const cursorConfig = {
434
+ cursorStyle: cursorStyleFromString(rawEditorOptions.cursorStyle),
435
+ cursorBlinking: cursorBlinkingStyleFromString(rawEditorOptions.cursorBlinking),
436
+ cursorSmoothCaretAnimation: rawEditorOptions.cursorSmoothCaretAnimation
437
+ };
348
438
  newMatch = {
349
439
  cellViewModel: resultCellViewModel,
350
440
  initialSelection: initialSelection,
351
441
  wordSelections: [newSelection],
352
- config: this.constructCellEditorOptions(this.anchorCell[0]),
442
+ editorConfig: editorConfig,
443
+ cursorConfig: cursorConfig,
353
444
  decorationIds: [],
354
445
  undoRedoHistory: this.undoRedoService.getElements(resultCellViewModel.uri)
355
446
  };
356
447
  this.trackedMatches.push(newMatch);
357
448
  this._onDidChangeAnchorCell.fire();
449
+ this.initializeMultiSelectDecorations(this.trackedMatches.find(match => match.cellViewModel.handle === cell.handle));
358
450
  }
359
451
  else {
360
- newMatch = this.trackedMatches.find(match => match.cellViewModel.handle === findResult.cell.handle);
361
- newMatch.wordSelections.push(Selection.fromRange(findResult.match.range, SelectionDirection.LTR));
362
- resultCellViewModel.setSelections(newMatch.wordSelections);
452
+ return;
363
453
  }
364
- this.initializeMultiSelectDecorations(newMatch);
365
454
  }
366
455
  }
367
456
  async deleteLeft() {
@@ -375,8 +464,29 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
375
464
  if (!delSelections) {
376
465
  return;
377
466
  }
378
- controller.setSelections(( (new ViewModelEventsCollector())), undefined, delSelections, CursorChangeReason.Explicit);
467
+ controller.setSelections(( (new ViewModelEventsCollector())), undefined, delSelections, 3 );
468
+ });
469
+ this.updateLazyDecorations();
470
+ }
471
+ async deleteRight() {
472
+ this.trackedMatches.forEach(match => {
473
+ const controller = this.cursorsControllers.get(match.cellViewModel.uri);
474
+ if (!controller) {
475
+ return;
476
+ }
477
+ const [, commands] = DeleteOperations.deleteRight(controller.getPrevEditOperationType(), controller.context.cursorConfig, controller.context.model, controller.getSelections());
478
+ if (match.cellViewModel.handle !== this.anchorCell?.[0].handle) {
479
+ const delSelections = CommandExecutor.executeCommands(controller.context.model, controller.getSelections(), commands);
480
+ if (!delSelections) {
481
+ return;
482
+ }
483
+ controller.setSelections(( (new ViewModelEventsCollector())), undefined, delSelections, 3 );
484
+ }
485
+ else {
486
+ controller.setSelections(( (new ViewModelEventsCollector())), undefined, match.cellViewModel.getSelections(), 3 );
487
+ }
379
488
  });
489
+ this.updateLazyDecorations();
380
490
  }
381
491
  async undo() {
382
492
  const models = [];
@@ -385,8 +495,14 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
385
495
  if (model) {
386
496
  models.push(model);
387
497
  }
498
+ const controller = this.cursorsControllers.get(match.cellViewModel.uri);
499
+ if (!controller) {
500
+ return;
501
+ }
502
+ controller.setSelections(( (new ViewModelEventsCollector())), undefined, match.cellViewModel.getSelections(), 3 );
388
503
  }
389
504
  await Promise.all(( (models.map(model => model.undo()))));
505
+ this.updateLazyDecorations();
390
506
  }
391
507
  async redo() {
392
508
  const models = [];
@@ -395,8 +511,14 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
395
511
  if (model) {
396
512
  models.push(model);
397
513
  }
514
+ const controller = this.cursorsControllers.get(match.cellViewModel.uri);
515
+ if (!controller) {
516
+ return;
517
+ }
518
+ controller.setSelections(( (new ViewModelEventsCollector())), undefined, match.cellViewModel.getSelections(), 3 );
398
519
  }
399
520
  await Promise.all(( (models.map(model => model.redo()))));
521
+ this.updateLazyDecorations();
400
522
  }
401
523
  constructCellEditorOptions(cell) {
402
524
  const cellEditorOptions = ( (new CellEditorOptions(
@@ -416,14 +538,17 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
416
538
  ))
417
539
  );
418
540
  }
419
- initializeMultiSelectDecorations(match) {
541
+ initializeMultiSelectDecorations(match, isCurrentWord) {
542
+ if (!match) {
543
+ return;
544
+ }
420
545
  const decorations = [];
421
546
  match.wordSelections.forEach(selection => {
422
547
  decorations.push({
423
- range: selection,
548
+ range: Selection.fromPositions(selection.getEndPosition()),
424
549
  options: {
425
550
  description: '',
426
- className: 'nb-multicursor-selection',
551
+ className: this.getClassName(match.cursorConfig, true),
427
552
  }
428
553
  });
429
554
  });
@@ -431,8 +556,7 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
431
556
  }
432
557
  updateLazyDecorations() {
433
558
  this.trackedMatches.forEach(match => {
434
- const cellIndex = this.notebookEditor.getCellIndex(match.cellViewModel);
435
- if (cellIndex === undefined) {
559
+ if (match.cellViewModel.handle === this.anchorCell?.[0].handle) {
436
560
  return;
437
561
  }
438
562
  const controller = this.cursorsControllers.get(match.cellViewModel.uri);
@@ -440,16 +564,32 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
440
564
  return;
441
565
  }
442
566
  const selections = controller.getSelections();
443
- const newDecorations = selections?.map(selection => {
444
- return {
445
- range: selection,
567
+ const newDecorations = [];
568
+ selections?.map(selection => {
569
+ const isEmpty = selection.isEmpty();
570
+ if (!isEmpty) {
571
+ newDecorations.push({
572
+ range: selection,
573
+ options: {
574
+ description: '',
575
+ className: this.getClassName(match.cursorConfig, false),
576
+ }
577
+ });
578
+ }
579
+ newDecorations.push({
580
+ range: Selection.fromPositions(selection.getPosition()),
446
581
  options: {
447
582
  description: '',
448
- className: 'nb-multicursor-selection',
583
+ zIndex: 10000,
584
+ className: this.getClassName(match.cursorConfig, true),
449
585
  }
450
- };
586
+ });
451
587
  });
452
- match.decorationIds = match.cellViewModel.deltaModelDecorations(match.decorationIds, newDecorations ?? []);
588
+ match.decorationIds = match.cellViewModel.deltaModelDecorations(match.decorationIds, newDecorations);
589
+ const matchingEditor = this.notebookEditor.codeEditors.find(cellEditor => cellEditor[0] === match.cellViewModel);
590
+ if (matchingEditor) {
591
+ WordHighlighterContribution.get(matchingEditor[1])?.wordHighlighter?.trigger();
592
+ }
453
593
  });
454
594
  }
455
595
  clearDecorations(match) {
@@ -466,6 +606,54 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
466
606
  column: startColumn
467
607
  });
468
608
  }
609
+ getClassName(cursorConfig, isCursor) {
610
+ let result = isCursor ? '.nb-multicursor-cursor' : '.nb-multicursor-selection';
611
+ if (isCursor) {
612
+ switch (cursorConfig.cursorStyle) {
613
+ case TextEditorCursorStyle.Line:
614
+ break;
615
+ case TextEditorCursorStyle.Block:
616
+ result += '.nb-cursor-block-style';
617
+ break;
618
+ case TextEditorCursorStyle.Underline:
619
+ result += '.nb-cursor-underline-style';
620
+ break;
621
+ case TextEditorCursorStyle.LineThin:
622
+ result += '.nb-cursor-line-thin-style';
623
+ break;
624
+ case TextEditorCursorStyle.BlockOutline:
625
+ result += '.nb-cursor-block-outline-style';
626
+ break;
627
+ case TextEditorCursorStyle.UnderlineThin:
628
+ result += '.nb-cursor-underline-thin-style';
629
+ break;
630
+ }
631
+ switch (cursorConfig.cursorBlinking) {
632
+ case 1 :
633
+ result += '.nb-blink';
634
+ break;
635
+ case 2 :
636
+ result += '.nb-smooth';
637
+ break;
638
+ case 3 :
639
+ result += '.nb-phase';
640
+ break;
641
+ case 4 :
642
+ result += '.nb-expand';
643
+ break;
644
+ case 5 :
645
+ result += '.nb-solid';
646
+ break;
647
+ default:
648
+ result += '.nb-solid';
649
+ break;
650
+ }
651
+ if (cursorConfig.cursorSmoothCaretAnimation === 'on' || cursorConfig.cursorSmoothCaretAnimation === 'explicit') {
652
+ result += '.nb-smooth-caret-animation';
653
+ }
654
+ }
655
+ return result;
656
+ }
469
657
  dispose() {
470
658
  super.dispose();
471
659
  this.anchorDisposables.dispose();
@@ -488,15 +676,20 @@ class NotebookAddMatchToMultiSelectionAction extends NotebookAction {
488
676
  constructor() {
489
677
  super({
490
678
  id: NOTEBOOK_ADD_FIND_MATCH_TO_SELECTION_ID,
491
- title: ( localize(8049, "Add Find Match to Selection")),
679
+ title: ( localize(8109, "Add Find Match to Selection")),
680
+ precondition: ( (ContextKeyExpr.and(
681
+ (ContextKeyExpr.equals('config.notebook.multiCursor.enabled', true)),
682
+ NOTEBOOK_IS_ACTIVE_EDITOR,
683
+ NOTEBOOK_CELL_EDITOR_FOCUSED
684
+ ))),
492
685
  keybinding: {
493
686
  when: ( (ContextKeyExpr.and(
494
- (ContextKeyExpr.equals('config.notebook.multiSelect.enabled', true)),
687
+ (ContextKeyExpr.equals('config.notebook.multiCursor.enabled', true)),
495
688
  NOTEBOOK_IS_ACTIVE_EDITOR,
496
689
  NOTEBOOK_CELL_EDITOR_FOCUSED
497
690
  ))),
498
- primary: KeyMod.CtrlCmd | KeyCode.KeyD,
499
- weight: KeybindingWeight.WorkbenchContrib
691
+ primary: 2048 | 34 ,
692
+ weight: 200
500
693
  }
501
694
  });
502
695
  }
@@ -517,15 +710,20 @@ class NotebookExitMultiSelectionAction extends NotebookAction {
517
710
  constructor() {
518
711
  super({
519
712
  id: 'noteMultiCursor.exit',
520
- title: ( localize(8050, "Exit Multi Cursor Mode")),
713
+ title: ( localize(8110, "Exit Multi Cursor Mode")),
714
+ precondition: ( (ContextKeyExpr.and(
715
+ (ContextKeyExpr.equals('config.notebook.multiCursor.enabled', true)),
716
+ NOTEBOOK_IS_ACTIVE_EDITOR,
717
+ NOTEBOOK_MULTI_CURSOR_CONTEXT.IsNotebookMultiCursor
718
+ ))),
521
719
  keybinding: {
522
720
  when: ( (ContextKeyExpr.and(
523
- (ContextKeyExpr.equals('config.notebook.multiSelect.enabled', true)),
721
+ (ContextKeyExpr.equals('config.notebook.multiCursor.enabled', true)),
524
722
  NOTEBOOK_IS_ACTIVE_EDITOR,
525
- NOTEBOOK_MULTI_SELECTION_CONTEXT.IsNotebookMultiSelect
723
+ NOTEBOOK_MULTI_CURSOR_CONTEXT.IsNotebookMultiCursor
526
724
  ))),
527
- primary: KeyCode.Escape,
528
- weight: KeybindingWeight.WorkbenchContrib
725
+ primary: 9 ,
726
+ weight: 200
529
727
  }
530
728
  });
531
729
  }
@@ -543,19 +741,28 @@ class NotebookDeleteLeftMultiSelectionAction extends NotebookAction {
543
741
  constructor() {
544
742
  super({
545
743
  id: 'noteMultiCursor.deleteLeft',
546
- title: ( localize(8051, "Delete Left")),
744
+ title: ( localize(8111, "Delete Left")),
745
+ precondition: ( (ContextKeyExpr.and(
746
+ (ContextKeyExpr.equals('config.notebook.multiCursor.enabled', true)),
747
+ NOTEBOOK_IS_ACTIVE_EDITOR,
748
+ NOTEBOOK_MULTI_CURSOR_CONTEXT.IsNotebookMultiCursor,
749
+ (ContextKeyExpr.or(
750
+ (NOTEBOOK_MULTI_CURSOR_CONTEXT.NotebookMultiSelectCursorState.isEqualTo(NotebookMultiCursorState.Selecting)),
751
+ (NOTEBOOK_MULTI_CURSOR_CONTEXT.NotebookMultiSelectCursorState.isEqualTo(NotebookMultiCursorState.Editing))
752
+ ))
753
+ ))),
547
754
  keybinding: {
548
755
  when: ( (ContextKeyExpr.and(
549
- (ContextKeyExpr.equals('config.notebook.multiSelect.enabled', true)),
756
+ (ContextKeyExpr.equals('config.notebook.multiCursor.enabled', true)),
550
757
  NOTEBOOK_IS_ACTIVE_EDITOR,
551
- NOTEBOOK_MULTI_SELECTION_CONTEXT.IsNotebookMultiSelect,
758
+ NOTEBOOK_MULTI_CURSOR_CONTEXT.IsNotebookMultiCursor,
552
759
  (ContextKeyExpr.or(
553
- (NOTEBOOK_MULTI_SELECTION_CONTEXT.NotebookMultiSelectState.isEqualTo(NotebookMultiCursorState.Selecting)),
554
- (NOTEBOOK_MULTI_SELECTION_CONTEXT.NotebookMultiSelectState.isEqualTo(NotebookMultiCursorState.Editing))
760
+ (NOTEBOOK_MULTI_CURSOR_CONTEXT.NotebookMultiSelectCursorState.isEqualTo(NotebookMultiCursorState.Selecting)),
761
+ (NOTEBOOK_MULTI_CURSOR_CONTEXT.NotebookMultiSelectCursorState.isEqualTo(NotebookMultiCursorState.Editing))
555
762
  ))
556
763
  ))),
557
- primary: KeyCode.Backspace,
558
- weight: KeybindingWeight.WorkbenchContrib
764
+ primary: 1 ,
765
+ weight: 200
559
766
  }
560
767
  });
561
768
  }
@@ -569,13 +776,57 @@ class NotebookDeleteLeftMultiSelectionAction extends NotebookAction {
569
776
  controller.deleteLeft();
570
777
  }
571
778
  }
779
+ class NotebookDeleteRightMultiSelectionAction extends NotebookAction {
780
+ constructor() {
781
+ super({
782
+ id: 'noteMultiCursor.deleteRight',
783
+ title: ( localize(8112, "Delete Right")),
784
+ precondition: ( (ContextKeyExpr.and(
785
+ (ContextKeyExpr.equals('config.notebook.multiCursor.enabled', true)),
786
+ NOTEBOOK_IS_ACTIVE_EDITOR,
787
+ NOTEBOOK_MULTI_CURSOR_CONTEXT.IsNotebookMultiCursor,
788
+ (ContextKeyExpr.or(
789
+ (NOTEBOOK_MULTI_CURSOR_CONTEXT.NotebookMultiSelectCursorState.isEqualTo(NotebookMultiCursorState.Selecting)),
790
+ (NOTEBOOK_MULTI_CURSOR_CONTEXT.NotebookMultiSelectCursorState.isEqualTo(NotebookMultiCursorState.Editing))
791
+ ))
792
+ ))),
793
+ keybinding: {
794
+ when: ( (ContextKeyExpr.and(
795
+ (ContextKeyExpr.equals('config.notebook.multiCursor.enabled', true)),
796
+ NOTEBOOK_IS_ACTIVE_EDITOR,
797
+ NOTEBOOK_MULTI_CURSOR_CONTEXT.IsNotebookMultiCursor,
798
+ (ContextKeyExpr.or(
799
+ (NOTEBOOK_MULTI_CURSOR_CONTEXT.NotebookMultiSelectCursorState.isEqualTo(NotebookMultiCursorState.Selecting)),
800
+ (NOTEBOOK_MULTI_CURSOR_CONTEXT.NotebookMultiSelectCursorState.isEqualTo(NotebookMultiCursorState.Editing))
801
+ ))
802
+ ))),
803
+ primary: 20 ,
804
+ weight: 200
805
+ }
806
+ });
807
+ }
808
+ async runWithContext(accessor, context) {
809
+ const editorService = accessor.get(IEditorService);
810
+ const nbEditor = getNotebookEditorFromEditorPane(editorService.activeEditorPane);
811
+ if (!nbEditor) {
812
+ return;
813
+ }
814
+ const cellEditor = nbEditor.activeCodeEditor;
815
+ if (!cellEditor) {
816
+ return;
817
+ }
818
+ CoreEditingCommands.DeleteRight.runEditorCommand(accessor, cellEditor, null);
819
+ const controller = nbEditor.getContribution(NotebookMultiCursorController.id);
820
+ controller.deleteRight();
821
+ }
822
+ }
572
823
  let NotebookMultiCursorUndoRedoContribution = class NotebookMultiCursorUndoRedoContribution extends Disposable {
573
824
  static { this.ID = 'workbench.contrib.notebook.multiCursorUndoRedo'; }
574
825
  constructor(_editorService, configurationService) {
575
826
  super();
576
827
  this._editorService = _editorService;
577
828
  this.configurationService = configurationService;
578
- if (!this.configurationService.getValue('notebook.multiSelect.enabled')) {
829
+ if (!this.configurationService.getValue('notebook.multiCursor.enabled')) {
579
830
  return;
580
831
  }
581
832
  const PRIORITY = 10005;
@@ -590,9 +841,9 @@ let NotebookMultiCursorUndoRedoContribution = class NotebookMultiCursorUndoRedoC
590
841
  const controller = editor.getContribution(NotebookMultiCursorController.id);
591
842
  return controller.undo();
592
843
  }, ( (ContextKeyExpr.and(
593
- (ContextKeyExpr.equals('config.notebook.multiSelect.enabled', true)),
844
+ (ContextKeyExpr.equals('config.notebook.multiCursor.enabled', true)),
594
845
  NOTEBOOK_IS_ACTIVE_EDITOR,
595
- NOTEBOOK_MULTI_SELECTION_CONTEXT.IsNotebookMultiSelect
846
+ NOTEBOOK_MULTI_CURSOR_CONTEXT.IsNotebookMultiCursor
596
847
  )))));
597
848
  this._register(RedoCommand.addImplementation(PRIORITY, 'notebook-multicursor-undo-redo', () => {
598
849
  const editor = getNotebookEditorFromEditorPane(this._editorService.activeEditorPane);
@@ -605,9 +856,9 @@ let NotebookMultiCursorUndoRedoContribution = class NotebookMultiCursorUndoRedoC
605
856
  const controller = editor.getContribution(NotebookMultiCursorController.id);
606
857
  return controller.redo();
607
858
  }, ( (ContextKeyExpr.and(
608
- (ContextKeyExpr.equals('config.notebook.multiSelect.enabled', true)),
859
+ (ContextKeyExpr.equals('config.notebook.multiCursor.enabled', true)),
609
860
  NOTEBOOK_IS_ACTIVE_EDITOR,
610
- NOTEBOOK_MULTI_SELECTION_CONTEXT.IsNotebookMultiSelect
861
+ NOTEBOOK_MULTI_CURSOR_CONTEXT.IsNotebookMultiCursor
611
862
  )))));
612
863
  }
613
864
  };
@@ -616,9 +867,10 @@ NotebookMultiCursorUndoRedoContribution = ( (__decorate([
616
867
  ( (__param(1, IConfigurationService)))
617
868
  ], NotebookMultiCursorUndoRedoContribution)));
618
869
  registerNotebookContribution(NotebookMultiCursorController.id, NotebookMultiCursorController);
870
+ registerWorkbenchContribution2(NotebookMultiCursorUndoRedoContribution.ID, NotebookMultiCursorUndoRedoContribution, 2 );
619
871
  registerAction2(NotebookAddMatchToMultiSelectionAction);
620
872
  registerAction2(NotebookExitMultiSelectionAction);
621
873
  registerAction2(NotebookDeleteLeftMultiSelectionAction);
622
- registerWorkbenchContribution2(NotebookMultiCursorUndoRedoContribution.ID, NotebookMultiCursorUndoRedoContribution, WorkbenchPhase.BlockRestore);
874
+ registerAction2(NotebookDeleteRightMultiSelectionAction);
623
875
 
624
- export { NOTEBOOK_MULTI_SELECTION_CONTEXT, NotebookMultiCursorController };
876
+ export { NOTEBOOK_MULTI_CURSOR_CONTEXT, NotebookMultiCursorController, NotebookMultiCursorState };