@codingame/monaco-vscode-notebook-service-override 11.1.2 → 12.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 (157) hide show
  1. package/index.d.ts +2 -1
  2. package/index.js +64 -1
  3. package/package.json +47 -15
  4. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.css.js +1 -1
  5. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.d.ts +38 -0
  6. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +43 -41
  7. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.d.ts +1 -0
  8. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +109 -130
  9. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticEditorContrib.d.ts +25 -0
  10. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticEditorContrib.js +13 -11
  11. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticsActions.d.ts +3 -0
  12. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticsActions.js +72 -19
  13. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib.d.ts +7 -0
  14. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib.js +23 -17
  15. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.d.ts +14 -0
  16. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +4 -3
  17. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.d.ts +1 -0
  18. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +30 -28
  19. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookSynchronizerService.d.ts +18 -0
  20. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chatEdit/notebookSynchronizerService.js +76 -0
  21. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.d.ts +21 -0
  22. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +61 -58
  23. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.d.ts +1 -0
  24. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +5 -3
  25. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.d.ts +1 -0
  26. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +4 -2
  27. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.d.ts +28 -0
  28. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +8 -7
  29. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.d.ts +20 -0
  30. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +10 -9
  31. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.d.ts +1 -0
  32. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +52 -50
  33. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.d.ts +13 -0
  34. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +3 -2
  35. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/media/notebookFind.css.js +1 -1
  36. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.d.ts +1 -0
  37. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +28 -28
  38. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.d.ts +10 -0
  39. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +51 -50
  40. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.d.ts +10 -0
  41. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +21 -18
  42. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.d.ts +1 -0
  43. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +4 -2
  44. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.d.ts +11 -0
  45. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +3 -2
  46. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.d.ts +1 -0
  47. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +6 -5
  48. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookMulticursor.d.ts +69 -0
  49. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookMulticursor.js +460 -382
  50. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookSelectionHighlight.d.ts +1 -0
  51. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookSelectionHighlight.js +124 -0
  52. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.d.ts +1 -0
  53. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +87 -145
  54. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.d.ts +2 -0
  55. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.js +1 -0
  56. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.d.ts +27 -0
  57. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +16 -15
  58. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.d.ts +38 -0
  59. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +8 -7
  60. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.d.ts +34 -0
  61. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +9 -8
  62. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.d.ts +53 -0
  63. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +40 -36
  64. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.d.ts +112 -0
  65. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +115 -116
  66. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.d.ts +8 -0
  67. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +4 -3
  68. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.d.ts +32 -0
  69. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +111 -117
  70. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.d.ts +17 -0
  71. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +11 -9
  72. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.d.ts +1 -0
  73. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +5 -4
  74. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.d.ts +1 -0
  75. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +7 -6
  76. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.d.ts +1 -0
  77. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +1 -0
  78. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.d.ts +9 -0
  79. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +113 -198
  80. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.d.ts +8 -0
  81. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.js +25 -23
  82. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.d.ts +3 -0
  83. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.js +115 -145
  84. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.d.ts +3 -0
  85. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +76 -147
  86. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.d.ts +13 -0
  87. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +45 -77
  88. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.d.ts +1 -0
  89. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +30 -35
  90. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/notebookIndentationActions.d.ts +27 -0
  91. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/notebookIndentationActions.js +19 -18
  92. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.d.ts +30 -0
  93. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +59 -52
  94. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/variablesActions.d.ts +1 -0
  95. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/variablesActions.js +11 -21
  96. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.d.ts +1 -0
  97. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +69 -113
  98. package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.d.ts +14 -0
  99. package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +194 -184
  100. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityHelp.d.ts +10 -0
  101. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityHelp.js +51 -51
  102. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibleView.d.ts +12 -0
  103. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibleView.js +14 -36
  104. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.d.ts +48 -0
  105. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +57 -56
  106. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookCellStatusBarServiceImpl.d.ts +16 -0
  107. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookCellStatusBarServiceImpl.js +1 -0
  108. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.d.ts +43 -0
  109. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +29 -11
  110. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.d.ts +30 -0
  111. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +17 -16
  112. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.d.ts +46 -0
  113. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +14 -8
  114. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.d.ts +25 -0
  115. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +21 -19
  116. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.d.ts +57 -0
  117. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +7 -4
  118. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.d.ts +20 -0
  119. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +30 -26
  120. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.d.ts +13 -0
  121. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +6 -5
  122. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.d.ts +23 -0
  123. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +2 -1
  124. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.d.ts +134 -0
  125. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +164 -121
  126. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.d.ts +14 -0
  127. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +2 -1
  128. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.d.ts +21 -0
  129. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.js +37 -0
  130. package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.d.ts +56 -0
  131. package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +6 -3
  132. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.d.ts +101 -0
  133. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +131 -55
  134. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.d.ts +29 -0
  135. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +4 -3
  136. package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.d.ts +48 -0
  137. package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +12 -10
  138. package/vscode/src/vs/workbench/contrib/notebook/common/notebookProvider.d.ts +38 -0
  139. package/vscode/src/vs/workbench/contrib/notebook/common/notebookProvider.js +1 -0
  140. package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorker.d.ts +50 -0
  141. package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorker.js +75 -1
  142. package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorkerMain.d.ts +1 -0
  143. package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorkerMain.js +2 -1
  144. package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.d.ts +31 -0
  145. package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +2 -1
  146. package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.d.ts +78 -0
  147. package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +45 -42
  148. package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.d.ts +96 -0
  149. package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +57 -54
  150. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.d.ts +74 -0
  151. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +6 -3
  152. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.d.ts +53 -0
  153. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.js +2 -1
  154. package/worker.js +2 -1
  155. package/workers/notebook.worker.d.ts +1 -0
  156. package/notebook.js +0 -50
  157. package/workers/notebook.worker.js +0 -1
@@ -1,18 +1,23 @@
1
- import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
1
+
2
+ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
2
3
  import { localize } from 'vscode/vscode/vs/nls';
3
4
  import { Emitter } from 'vscode/vscode/vs/base/common/event';
5
+ import { KeyMod, KeyCode } from 'vscode/vscode/vs/base/common/keyCodes';
4
6
  import { Disposable, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
5
7
  import { ResourceMap } from 'vscode/vscode/vs/base/common/map';
6
8
  import { EditorConfiguration } from 'vscode/vscode/vs/editor/browser/config/editorConfiguration';
7
9
  import { CoreEditingCommands } from 'vscode/vscode/vs/editor/browser/coreCommands';
8
10
  import { UndoCommand, RedoCommand } from 'vscode/vscode/vs/editor/browser/editorExtensions';
9
11
  import { CodeEditorWidget } from 'vscode/vscode/vs/editor/browser/widget/codeEditor/codeEditorWidget';
10
- import { cursorStyleFromString, cursorBlinkingStyleFromString, TextEditorCursorStyle } from 'vscode/vscode/vs/editor/common/config/editorOptions';
11
- import { Selection } from 'vscode/vscode/vs/editor/common/core/selection';
12
+ import { cursorStyleFromString, cursorBlinkingStyleFromString, TextEditorCursorStyle, TextEditorCursorBlinkingStyle } from 'vscode/vscode/vs/editor/common/config/editorOptions';
13
+ import { Position } from 'vscode/vscode/vs/editor/common/core/position';
14
+ import { Selection, SelectionDirection } from 'vscode/vscode/vs/editor/common/core/selection';
12
15
  import { USUAL_WORD_SEPARATORS } from 'vscode/vscode/vs/editor/common/core/wordHelper';
13
16
  import { CursorsController, CommandExecutor } from 'vscode/vscode/vs/editor/common/cursor/cursor';
14
17
  import { DeleteOperations } from 'vscode/vscode/vs/editor/common/cursor/cursorDeleteOperations';
15
18
  import { CursorConfiguration } from 'vscode/vscode/vs/editor/common/cursorCommon';
19
+ import { CursorChangeReason } from 'vscode/vscode/vs/editor/common/cursorEvents';
20
+ import { Handler } from 'vscode/vscode/vs/editor/common/editorCommon';
16
21
  import { ILanguageConfigurationService } from 'vscode/vscode/vs/editor/common/languages/languageConfigurationRegistry';
17
22
  import { indentOfLine } from 'vscode/vscode/vs/editor/common/model/textModel';
18
23
  import { ITextModelService } from 'vscode/vscode/vs/editor/common/services/resolverService';
@@ -23,25 +28,30 @@ import { MenuId, registerAction2 } from 'vscode/vscode/vs/platform/actions/commo
23
28
  import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
24
29
  import { RawContextKey, ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
25
30
  import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
31
+ import { KeybindingWeight } from 'vscode/vscode/vs/platform/keybinding/common/keybindingsRegistry';
32
+ import { UndoRedoElementType } from 'vscode/vscode/vs/platform/undoRedo/common/undoRedo';
26
33
  import { IUndoRedoService } from 'vscode/vscode/vs/platform/undoRedo/common/undoRedo.service';
27
- import { registerWorkbenchContribution2 } from 'vscode/vscode/vs/workbench/common/contributions';
34
+ import { registerWorkbenchContribution2, WorkbenchPhase } from 'vscode/vscode/vs/workbench/common/contributions';
28
35
  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';
30
- import { NotebookAction } from '@codingame/monaco-vscode-chat-interactive-notebook-search-common/vscode/vs/workbench/contrib/notebook/browser/controller/coreActions';
31
- import { getNotebookEditorFromEditorPane } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
32
- import { registerNotebookContribution } from '@codingame/monaco-vscode-chat-interactive-notebook-search-common/vscode/vs/workbench/contrib/notebook/browser/notebookEditorExtensions';
33
- import { CellEditorOptions } from '@codingame/monaco-vscode-chat-interactive-notebook-search-common/vscode/vs/workbench/contrib/notebook/browser/view/cellParts/cellEditorOptions';
36
+ import { NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_CELL_EDITOR_FOCUSED, KEYBINDING_CONTEXT_NOTEBOOK_FIND_WIDGET_FOCUSED } from '@codingame/monaco-vscode-4a36e358-d94d-55e0-86ee-3bcd543d9d3f-common/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
37
+ import { NotebookAction } from '@codingame/monaco-vscode-e28ac690-06d5-5ee9-92d1-02df70296354-common/vscode/vs/workbench/contrib/notebook/browser/controller/coreActions';
38
+ import { getNotebookEditorFromEditorPane } from '@codingame/monaco-vscode-271a23cd-c7d7-5761-ae35-a923a42987b8-common/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
39
+ import { registerNotebookContribution } from '@codingame/monaco-vscode-c465110a-57c0-59d7-a6b2-be0a4db7e517-common/vscode/vs/workbench/contrib/notebook/browser/notebookEditorExtensions';
40
+ import { CellEditorOptions } from '@codingame/monaco-vscode-e28ac690-06d5-5ee9-92d1-02df70296354-common/vscode/vs/workbench/contrib/notebook/browser/view/cellParts/cellEditorOptions';
41
+ import { NotebookFindContrib } from '@codingame/monaco-vscode-1ae7d696-d960-5ac6-97a3-9fe7c8c3a793-common/vscode/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget';
42
+ import { NotebookCellTextModel } from '@codingame/monaco-vscode-c465110a-57c0-59d7-a6b2-be0a4db7e517-common/vscode/vs/workbench/contrib/notebook/common/model/notebookCellTextModel';
34
43
 
35
44
  const NOTEBOOK_ADD_FIND_MATCH_TO_SELECTION_ID = 'notebook.addFindMatchToSelection';
45
+ const NOTEBOOK_SELECT_ALL_FIND_MATCHES_ID = 'notebook.selectAllFindMatches';
36
46
  var NotebookMultiCursorState;
37
- ( ((function(NotebookMultiCursorState) {
47
+ (function (NotebookMultiCursorState) {
38
48
  NotebookMultiCursorState[NotebookMultiCursorState["Idle"] = 0] = "Idle";
39
49
  NotebookMultiCursorState[NotebookMultiCursorState["Selecting"] = 1] = "Selecting";
40
50
  NotebookMultiCursorState[NotebookMultiCursorState["Editing"] = 2] = "Editing";
41
- })(NotebookMultiCursorState || (NotebookMultiCursorState = {}))));
51
+ })(NotebookMultiCursorState || (NotebookMultiCursorState = {}));
42
52
  const NOTEBOOK_MULTI_CURSOR_CONTEXT = {
43
- IsNotebookMultiCursor: ( (new RawContextKey('isNotebookMultiSelect', false))),
44
- NotebookMultiSelectCursorState: ( (new RawContextKey('notebookMultiSelectCursorState', NotebookMultiCursorState.Idle))),
53
+ IsNotebookMultiCursor: ( new RawContextKey('isNotebookMultiSelect', false)),
54
+ NotebookMultiSelectCursorState: ( new RawContextKey('notebookMultiSelectCursorState', NotebookMultiCursorState.Idle)),
45
55
  };
46
56
  let NotebookMultiCursorController = class NotebookMultiCursorController extends Disposable {
47
57
  static { this.id = 'notebook.multiCursorController'; }
@@ -58,46 +68,130 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
58
68
  this.configurationService = configurationService;
59
69
  this.undoRedoService = undoRedoService;
60
70
  this.word = '';
61
- this.trackedMatches = [];
62
- this._onDidChangeAnchorCell = this._register(( (new Emitter())));
71
+ this.trackedCells = [];
72
+ this._onDidChangeAnchorCell = this._register(( new Emitter()));
63
73
  this.onDidChangeAnchorCell = this._onDidChangeAnchorCell.event;
64
- this.anchorDisposables = this._register(( (new DisposableStore())));
65
- this.cursorsDisposables = this._register(( (new DisposableStore())));
66
- this.cursorsControllers = ( (new ResourceMap()));
74
+ this.anchorDisposables = this._register(( new DisposableStore()));
75
+ this.cursorsDisposables = this._register(( new DisposableStore()));
76
+ this.cursorsControllers = ( new ResourceMap());
67
77
  this.state = NotebookMultiCursorState.Idle;
68
78
  this._nbIsMultiSelectSession = NOTEBOOK_MULTI_CURSOR_CONTEXT.IsNotebookMultiCursor.bindTo(this.contextKeyService);
69
79
  this._nbMultiSelectState = NOTEBOOK_MULTI_CURSOR_CONTEXT.NotebookMultiSelectCursorState.bindTo(this.contextKeyService);
70
80
  this.anchorCell = this.notebookEditor.activeCellAndCodeEditor;
71
- this._register(this.onDidChangeAnchorCell(() => {
72
- this.updateCursorsControllers();
73
- this.updateAnchorListeners();
81
+ this._register(this.onDidChangeAnchorCell(async () => {
82
+ await this.syncCursorsControllers();
83
+ this.syncAnchorListeners();
84
+ }));
85
+ }
86
+ syncAnchorListeners() {
87
+ this.anchorDisposables.clear();
88
+ if (!this.anchorCell) {
89
+ throw ( new Error('Anchor cell is undefined'));
90
+ }
91
+ this.anchorDisposables.add(this.anchorCell[1].onWillType((input) => {
92
+ const collector = ( new ViewModelEventsCollector());
93
+ this.trackedCells.forEach(cell => {
94
+ const controller = this.cursorsControllers.get(cell.cellViewModel.uri);
95
+ if (!controller) {
96
+ return;
97
+ }
98
+ if (cell.cellViewModel.handle !== this.anchorCell?.[0].handle) {
99
+ controller.type(collector, input, 'keyboard');
100
+ }
101
+ });
102
+ }));
103
+ this.anchorDisposables.add(this.anchorCell[1].onDidType(() => {
104
+ this.state = NotebookMultiCursorState.Editing;
105
+ this._nbMultiSelectState.set(NotebookMultiCursorState.Editing);
106
+ const anchorController = this.cursorsControllers.get(this.anchorCell[0].uri);
107
+ if (!anchorController) {
108
+ return;
109
+ }
110
+ const activeSelections = this.notebookEditor.activeCodeEditor?.getSelections();
111
+ if (!activeSelections) {
112
+ return;
113
+ }
114
+ anchorController.setSelections(( new ViewModelEventsCollector()), 'keyboard', activeSelections, CursorChangeReason.Explicit);
115
+ this.trackedCells.forEach(cell => {
116
+ const controller = this.cursorsControllers.get(cell.cellViewModel.uri);
117
+ if (!controller) {
118
+ return;
119
+ }
120
+ cell.initialSelection = controller.getSelection();
121
+ cell.matchSelections = [];
122
+ });
123
+ this.updateLazyDecorations();
124
+ }));
125
+ this.anchorDisposables.add(this.anchorCell[1].onDidChangeCursorSelection((e) => {
126
+ if (e.source === 'mouse') {
127
+ this.resetToIdleState();
128
+ return;
129
+ }
130
+ if (!e.oldSelections || e.reason === CursorChangeReason.NotSet || e.reason === CursorChangeReason.RecoverFromMarkers) {
131
+ return;
132
+ }
133
+ const translation = {
134
+ deltaStartCol: e.selection.startColumn - e.oldSelections[0].startColumn,
135
+ deltaStartLine: e.selection.startLineNumber - e.oldSelections[0].startLineNumber,
136
+ deltaEndCol: e.selection.endColumn - e.oldSelections[0].endColumn,
137
+ deltaEndLine: e.selection.endLineNumber - e.oldSelections[0].endLineNumber,
138
+ };
139
+ const translationDir = e.selection.getDirection();
140
+ this.trackedCells.forEach(cell => {
141
+ const controller = this.cursorsControllers.get(cell.cellViewModel.uri);
142
+ if (!controller) {
143
+ return;
144
+ }
145
+ const newSelections = ( controller.getSelections().map(selection => {
146
+ const newStartCol = selection.startColumn + translation.deltaStartCol;
147
+ const newStartLine = selection.startLineNumber + translation.deltaStartLine;
148
+ const newEndCol = selection.endColumn + translation.deltaEndCol;
149
+ const newEndLine = selection.endLineNumber + translation.deltaEndLine;
150
+ return Selection.createWithDirection(newStartLine, newStartCol, newEndLine, newEndCol, translationDir);
151
+ }));
152
+ controller.setSelections(( new ViewModelEventsCollector()), e.source, newSelections, CursorChangeReason.Explicit);
153
+ });
154
+ this.updateLazyDecorations();
155
+ }));
156
+ this.anchorDisposables.add(this.anchorCell[1].onWillTriggerEditorOperationEvent((e) => {
157
+ this.handleEditorOperationEvent(e);
158
+ }));
159
+ this.anchorDisposables.add(this.anchorCell[1].onDidBlurEditorWidget(() => {
160
+ if (this.state === NotebookMultiCursorState.Selecting || this.state === NotebookMultiCursorState.Editing) {
161
+ this.resetToIdleState();
162
+ }
74
163
  }));
75
164
  }
76
- updateCursorsControllers() {
165
+ async syncCursorsControllers() {
77
166
  this.cursorsDisposables.clear();
78
- this.trackedMatches.forEach(async (match) => {
79
- const textModelRef = await this.textModelService.createModelReference(match.cellViewModel.uri);
80
- const textModel = textModelRef.object.textEditorModel;
81
- if (!textModel) {
167
+ await Promise.all(( this.trackedCells.map(async (cell) => {
168
+ const controller = await this.createCursorController(cell);
169
+ if (!controller) {
82
170
  return;
83
171
  }
84
- const cursorSimpleModel = this.constructCursorSimpleModel(match.cellViewModel);
85
- const converter = this.constructCoordinatesConverter();
86
- const editorConfig = match.editorConfig;
87
- const controller = this.cursorsDisposables.add(( (new CursorsController(
88
- textModel,
89
- cursorSimpleModel,
90
- converter,
91
- (new CursorConfiguration(
92
- textModel.getLanguageId(),
93
- textModel.getOptions(),
94
- editorConfig,
95
- this.languageConfigurationService
96
- ))
97
- ))));
98
- controller.setSelections(( (new ViewModelEventsCollector())), undefined, match.wordSelections, 3 );
99
- this.cursorsControllers.set(match.cellViewModel.uri, controller);
100
- });
172
+ this.cursorsControllers.set(cell.cellViewModel.uri, controller);
173
+ const selections = cell.matchSelections;
174
+ controller.setSelections(( new ViewModelEventsCollector()), undefined, selections, CursorChangeReason.Explicit);
175
+ })));
176
+ this.updateLazyDecorations();
177
+ }
178
+ async createCursorController(cell) {
179
+ const textModelRef = await this.textModelService.createModelReference(cell.cellViewModel.uri);
180
+ const textModel = textModelRef.object.textEditorModel;
181
+ if (!textModel) {
182
+ return undefined;
183
+ }
184
+ const cursorSimpleModel = this.constructCursorSimpleModel(cell.cellViewModel);
185
+ const converter = this.constructCoordinatesConverter();
186
+ const editorConfig = cell.editorConfig;
187
+ const controller = this.cursorsDisposables.add(( new CursorsController(textModel, cursorSimpleModel, converter, ( new CursorConfiguration(
188
+ textModel.getLanguageId(),
189
+ textModel.getOptions(),
190
+ editorConfig,
191
+ this.languageConfigurationService
192
+ )))));
193
+ controller.setSelections(( new ViewModelEventsCollector()), undefined, cell.matchSelections, CursorChangeReason.Explicit);
194
+ return controller;
101
195
  }
102
196
  constructCoordinatesConverter() {
103
197
  return {
@@ -158,128 +252,64 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
158
252
  }
159
253
  };
160
254
  }
161
- updateAnchorListeners() {
162
- this.anchorDisposables.clear();
163
- if (!this.anchorCell) {
164
- throw ( (new Error('Anchor cell is undefined')));
165
- }
166
- this.anchorDisposables.add(this.anchorCell[1].onWillType((input) => {
167
- const collector = ( (new ViewModelEventsCollector()));
168
- this.trackedMatches.forEach(match => {
169
- const controller = this.cursorsControllers.get(match.cellViewModel.uri);
170
- if (!controller) {
171
- return;
172
- }
173
- if (match.cellViewModel.handle !== this.anchorCell?.[0].handle) {
174
- controller.type(collector, input, 'keyboard');
175
- }
176
- });
177
- }));
178
- this.anchorDisposables.add(this.anchorCell[1].onDidType(() => {
179
- this.state = NotebookMultiCursorState.Editing;
180
- this._nbMultiSelectState.set(NotebookMultiCursorState.Editing);
181
- const anchorController = this.cursorsControllers.get(this.anchorCell[0].uri);
182
- if (!anchorController) {
255
+ async handleEditorOperationEvent(e) {
256
+ this.trackedCells.forEach(cell => {
257
+ if (cell.cellViewModel.handle === this.anchorCell?.[0].handle) {
183
258
  return;
184
259
  }
185
- const activeSelections = this.notebookEditor.activeCodeEditor?.getSelections();
186
- if (!activeSelections) {
187
- return;
188
- }
189
- anchorController.setSelections(( (new ViewModelEventsCollector())), 'keyboard', activeSelections, 3 );
190
- this.trackedMatches.forEach(match => {
191
- const controller = this.cursorsControllers.get(match.cellViewModel.uri);
192
- if (!controller) {
193
- return;
194
- }
195
- match.initialSelection = controller.getSelection();
196
- match.wordSelections = [];
197
- });
198
- this.updateLazyDecorations();
199
- }));
200
- this.anchorDisposables.add(this.anchorCell[1].onDidChangeCursorSelection((e) => {
201
- if (e.source === 'mouse') {
202
- this.resetToIdleState();
260
+ const eventsCollector = ( new ViewModelEventsCollector());
261
+ const controller = this.cursorsControllers.get(cell.cellViewModel.uri);
262
+ if (!controller) {
203
263
  return;
204
264
  }
205
- if (!e.oldSelections || e.reason === 0 || e.reason === 2 ) {
265
+ this.executeEditorOperation(controller, eventsCollector, e);
266
+ });
267
+ }
268
+ executeEditorOperation(controller, eventsCollector, e) {
269
+ switch (e.handlerId) {
270
+ case Handler.CompositionStart:
271
+ controller.startComposition(eventsCollector);
272
+ break;
273
+ case Handler.CompositionEnd:
274
+ controller.endComposition(eventsCollector, e.source);
275
+ break;
276
+ case Handler.ReplacePreviousChar: {
277
+ const args = e.payload;
278
+ controller.compositionType(eventsCollector, args.text || '', args.replaceCharCnt || 0, 0, 0, e.source);
279
+ break;
280
+ }
281
+ case Handler.CompositionType: {
282
+ const args = e.payload;
283
+ controller.compositionType(eventsCollector, args.text || '', args.replacePrevCharCnt || 0, args.replaceNextCharCnt || 0, args.positionDelta || 0, e.source);
284
+ break;
285
+ }
286
+ case Handler.Paste: {
287
+ const args = e.payload;
288
+ controller.paste(eventsCollector, args.text || '', args.pasteOnNewLine || false, args.multicursorText || null, e.source);
289
+ break;
290
+ }
291
+ case Handler.Cut:
292
+ controller.cut(eventsCollector, e.source);
293
+ break;
294
+ }
295
+ }
296
+ updateViewModelSelections() {
297
+ for (const cell of this.trackedCells) {
298
+ const controller = this.cursorsControllers.get(cell.cellViewModel.uri);
299
+ if (!controller) {
206
300
  return;
207
301
  }
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
- });
268
- }));
269
- this.anchorDisposables.add(this.anchorCell[1].onDidBlurEditorWidget(() => {
270
- if (this.state === NotebookMultiCursorState.Selecting || this.state === NotebookMultiCursorState.Editing) {
271
- this.resetToIdleState();
272
- }
273
- }));
302
+ cell.cellViewModel.setSelections(controller.getSelections());
303
+ }
274
304
  }
275
305
  updateFinalUndoRedo() {
276
306
  const anchorCellModel = this.anchorCell?.[1].getModel();
277
307
  if (!anchorCellModel) {
278
308
  return;
279
309
  }
280
- const newElementsMap = ( (new ResourceMap()));
310
+ const newElementsMap = ( new ResourceMap());
281
311
  const resources = [];
282
- this.trackedMatches.forEach(trackedMatch => {
312
+ this.trackedCells.forEach(trackedMatch => {
283
313
  const undoRedoState = trackedMatch.undoRedoHistory;
284
314
  if (!undoRedoState) {
285
315
  return;
@@ -298,7 +328,7 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
298
328
  });
299
329
  });
300
330
  this.undoRedoService.pushElement({
301
- type: 1 ,
331
+ type: UndoRedoElementType.Workspace,
302
332
  resources: resources,
303
333
  label: 'Multi Cursor Edit',
304
334
  code: 'multiCursorEdit',
@@ -324,61 +354,53 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
324
354
  this._nbMultiSelectState.set(NotebookMultiCursorState.Idle);
325
355
  this._nbIsMultiSelectSession.set(false);
326
356
  this.updateFinalUndoRedo();
327
- this.trackedMatches.forEach(match => {
328
- this.clearDecorations(match);
329
- match.cellViewModel.setSelections([match.initialSelection]);
357
+ this.trackedCells.forEach(cell => {
358
+ this.clearDecorations(cell);
359
+ cell.cellViewModel.setSelections([cell.initialSelection]);
330
360
  });
331
361
  this.anchorDisposables.clear();
332
362
  this.anchorCell = undefined;
333
363
  this.cursorsDisposables.clear();
334
364
  this.cursorsControllers.clear();
335
- this.trackedMatches = [];
365
+ this.trackedCells = [];
366
+ this.startPosition = undefined;
367
+ this.word = '';
336
368
  }
337
- async findAndTrackNextSelection(cell) {
369
+ async findAndTrackNextSelection(focusedCell) {
338
370
  if (this.state === NotebookMultiCursorState.Idle) {
339
- const textModel = cell.textModel;
371
+ const textModel = focusedCell.textModel;
340
372
  if (!textModel) {
341
373
  return;
342
374
  }
343
- const inputSelection = cell.getSelections()[0];
375
+ const inputSelection = focusedCell.getSelections()[0];
344
376
  const word = this.getWord(inputSelection, textModel);
345
377
  if (!word) {
346
378
  return;
347
379
  }
348
380
  this.word = word.word;
349
- const newSelection = ( (new Selection(
381
+ const index = this.notebookEditor.getCellIndex(focusedCell);
382
+ if (index === undefined) {
383
+ return;
384
+ }
385
+ this.startPosition = {
386
+ cellIndex: index,
387
+ position: ( new Position(inputSelection.startLineNumber, word.startColumn)),
388
+ };
389
+ const newSelection = ( new Selection(
350
390
  inputSelection.startLineNumber,
351
391
  word.startColumn,
352
392
  inputSelection.startLineNumber,
353
393
  word.endColumn
354
- )));
355
- cell.setSelections([newSelection]);
394
+ ));
395
+ focusedCell.setSelections([newSelection]);
356
396
  this.anchorCell = this.notebookEditor.activeCellAndCodeEditor;
357
- if (!this.anchorCell || this.anchorCell[0].handle !== cell.handle) {
358
- throw ( (new Error('Active cell is not the same as the cell passed as context')));
397
+ if (!this.anchorCell || this.anchorCell[0].handle !== focusedCell.handle) {
398
+ throw ( new Error('Active cell is not the same as the cell passed as context'));
359
399
  }
360
400
  if (!(this.anchorCell[1] instanceof CodeEditorWidget)) {
361
- throw ( (new Error('Active cell is not an instance of CodeEditorWidget')));
401
+ throw ( new Error('Active cell is not an instance of CodeEditorWidget'));
362
402
  }
363
- textModel.pushStackElement();
364
- this.trackedMatches = [];
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
- };
372
- const newMatch = {
373
- cellViewModel: cell,
374
- initialSelection: inputSelection,
375
- wordSelections: [newSelection],
376
- editorConfig: editorConfig,
377
- cursorConfig: cursorConfig,
378
- decorationIds: [],
379
- undoRedoHistory: this.undoRedoService.getElements(cell.uri)
380
- };
381
- this.trackedMatches.push(newMatch);
403
+ await this.updateTrackedCell(focusedCell, [newSelection]);
382
404
  this._nbIsMultiSelectSession.set(true);
383
405
  this.state = NotebookMultiCursorState.Selecting;
384
406
  this._nbMultiSelectState.set(NotebookMultiCursorState.Selecting);
@@ -389,73 +411,161 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
389
411
  if (!notebookTextModel) {
390
412
  return;
391
413
  }
392
- const index = this.notebookEditor.getCellIndex(cell);
414
+ const index = this.notebookEditor.getCellIndex(focusedCell);
393
415
  if (index === undefined) {
394
416
  return;
395
417
  }
396
- const findResult = notebookTextModel.findNextMatch(this.word, { cellIndex: index, position: cell.getSelections()[cell.getSelections().length - 1].getEndPosition() }, false, true, USUAL_WORD_SEPARATORS
397
- );
418
+ if (!this.startPosition) {
419
+ return;
420
+ }
421
+ const findResult = notebookTextModel.findNextMatch(this.word, { cellIndex: index, position: focusedCell.getSelections()[focusedCell.getSelections().length - 1].getEndPosition() }, false, true, USUAL_WORD_SEPARATORS, this.startPosition);
398
422
  if (!findResult) {
399
423
  return;
400
424
  }
401
- const resultCellViewModel = this.notebookEditor.getCellByHandle(findResult.cell.handle);
402
- if (!resultCellViewModel) {
425
+ const findResultCellViewModel = this.notebookEditor.getCellByHandle(findResult.cell.handle);
426
+ if (!findResultCellViewModel) {
403
427
  return;
404
428
  }
405
- let newMatch;
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) {
417
- await this.notebookEditor.revealRangeInViewAsync(resultCellViewModel, findResult.match.range);
418
- this.notebookEditor.focusNotebookCell(resultCellViewModel, 'editor');
419
- const initialSelection = resultCellViewModel.getSelections()[0];
420
- const newSelection = Selection.fromRange(findResult.match.range, 0 );
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
- }
429
+ if (findResult.cell.handle === focusedCell.handle) {
430
+ const selections = [...focusedCell.getSelections(), Selection.fromRange(findResult.match.range, SelectionDirection.LTR)];
431
+ const trackedCell = await this.updateTrackedCell(focusedCell, selections);
432
+ findResultCellViewModel.setSelections(trackedCell.matchSelections);
433
+ }
434
+ else if (findResult.cell.handle !== focusedCell.handle) {
435
+ await this.notebookEditor.revealRangeInViewAsync(findResultCellViewModel, findResult.match.range);
436
+ await this.notebookEditor.focusNotebookCell(findResultCellViewModel, 'editor');
437
+ const trackedCell = await this.updateTrackedCell(findResultCellViewModel, [Selection.fromRange(findResult.match.range, SelectionDirection.LTR)]);
438
+ findResultCellViewModel.setSelections(trackedCell.matchSelections);
425
439
  this.anchorCell = this.notebookEditor.activeCellAndCodeEditor;
426
440
  if (!this.anchorCell || !(this.anchorCell[1] instanceof CodeEditorWidget)) {
427
- throw ( (new Error('Active cell is not an instance of CodeEditorWidget')));
441
+ throw ( new Error('Active cell is not an instance of CodeEditorWidget'));
428
442
  }
429
- const textModel = await resultCellViewModel.resolveTextModel();
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
- };
438
- newMatch = {
439
- cellViewModel: resultCellViewModel,
440
- initialSelection: initialSelection,
441
- wordSelections: [newSelection],
442
- editorConfig: editorConfig,
443
- cursorConfig: cursorConfig,
444
- decorationIds: [],
445
- undoRedoHistory: this.undoRedoService.getElements(resultCellViewModel.uri)
446
- };
447
- this.trackedMatches.push(newMatch);
448
443
  this._onDidChangeAnchorCell.fire();
449
- this.initializeMultiSelectDecorations(this.trackedMatches.find(match => match.cellViewModel.handle === cell.handle));
444
+ this.initializeMultiSelectDecorations(this.trackedCells.find(trackedCell => trackedCell.cellViewModel.handle === focusedCell.handle));
450
445
  }
451
- else {
446
+ }
447
+ }
448
+ async selectAllMatches(focusedCell, matches) {
449
+ const notebookTextModel = this.notebookEditor.textModel;
450
+ if (!notebookTextModel) {
451
+ return;
452
+ }
453
+ if (matches) {
454
+ await this.handleFindWidgetSelectAllMatches(matches);
455
+ }
456
+ else {
457
+ await this.handleCellEditorSelectAllMatches(notebookTextModel, focusedCell);
458
+ }
459
+ await this.syncCursorsControllers();
460
+ this.syncAnchorListeners();
461
+ this.updateLazyDecorations();
462
+ }
463
+ async handleFindWidgetSelectAllMatches(matches) {
464
+ if (this.state !== NotebookMultiCursorState.Idle) {
465
+ return;
466
+ }
467
+ if (!matches.length) {
468
+ return;
469
+ }
470
+ await this.notebookEditor.focusNotebookCell(matches[0].cell, 'editor');
471
+ this.anchorCell = this.notebookEditor.activeCellAndCodeEditor;
472
+ this.trackedCells = [];
473
+ for (const match of matches) {
474
+ this.updateTrackedCell(match.cell, ( match.contentMatches.map(match => Selection.fromRange(match.range, SelectionDirection.LTR))));
475
+ if (this.anchorCell && match.cell.handle === this.anchorCell[0].handle) {
476
+ match.cell.setSelections(( match.contentMatches.map(match => Selection.fromRange(match.range, SelectionDirection.LTR))));
477
+ }
478
+ }
479
+ this._nbIsMultiSelectSession.set(true);
480
+ this.state = NotebookMultiCursorState.Selecting;
481
+ this._nbMultiSelectState.set(NotebookMultiCursorState.Selecting);
482
+ }
483
+ async handleCellEditorSelectAllMatches(notebookTextModel, focusedCell) {
484
+ if (this.state === NotebookMultiCursorState.Idle) {
485
+ const textModel = focusedCell.textModel;
486
+ if (!textModel) {
452
487
  return;
453
488
  }
489
+ const inputSelection = focusedCell.getSelections()[0];
490
+ const word = this.getWord(inputSelection, textModel);
491
+ if (!word) {
492
+ return;
493
+ }
494
+ this.word = word.word;
495
+ const index = this.notebookEditor.getCellIndex(focusedCell);
496
+ if (index === undefined) {
497
+ return;
498
+ }
499
+ this.startPosition = {
500
+ cellIndex: index,
501
+ position: ( new Position(inputSelection.startLineNumber, word.startColumn)),
502
+ };
503
+ this.anchorCell = this.notebookEditor.activeCellAndCodeEditor;
504
+ if (!this.anchorCell || this.anchorCell[0].handle !== focusedCell.handle) {
505
+ throw ( new Error('Active cell is not the same as the cell passed as context'));
506
+ }
507
+ if (!(this.anchorCell[1] instanceof CodeEditorWidget)) {
508
+ throw ( new Error('Active cell is not an instance of CodeEditorWidget'));
509
+ }
510
+ const findResults = notebookTextModel.findMatches(this.word, false, true, USUAL_WORD_SEPARATORS);
511
+ this.trackedCells = [];
512
+ for (const res of findResults) {
513
+ await this.updateTrackedCell(res.cell, ( res.matches.map(match => Selection.fromRange(match.range, SelectionDirection.LTR))));
514
+ if (res.cell.handle === focusedCell.handle) {
515
+ const cellViewModel = this.notebookEditor.getCellByHandle(res.cell.handle);
516
+ if (cellViewModel) {
517
+ cellViewModel.setSelections(( res.matches.map(match => Selection.fromRange(match.range, SelectionDirection.LTR))));
518
+ }
519
+ }
520
+ }
521
+ this._nbIsMultiSelectSession.set(true);
522
+ this.state = NotebookMultiCursorState.Selecting;
523
+ this._nbMultiSelectState.set(NotebookMultiCursorState.Selecting);
524
+ }
525
+ else if (this.state === NotebookMultiCursorState.Selecting) {
526
+ const findResults = notebookTextModel.findMatches(this.word, false, true, USUAL_WORD_SEPARATORS);
527
+ for (const res of findResults) {
528
+ await this.updateTrackedCell(res.cell, ( res.matches.map(match => Selection.fromRange(match.range, SelectionDirection.LTR))));
529
+ }
454
530
  }
455
531
  }
532
+ async updateTrackedCell(cell, selections) {
533
+ const cellViewModel = cell instanceof NotebookCellTextModel ? this.notebookEditor.getCellByHandle(cell.handle) : cell;
534
+ if (!cellViewModel) {
535
+ throw ( new Error('Cell not found'));
536
+ }
537
+ let trackedMatch = this.trackedCells.find(trackedCell => trackedCell.cellViewModel.handle === cellViewModel.handle);
538
+ if (trackedMatch) {
539
+ this.clearDecorations(trackedMatch);
540
+ trackedMatch.matchSelections = selections;
541
+ }
542
+ else {
543
+ const initialSelection = cellViewModel.getSelections()[0];
544
+ const textModel = await cellViewModel.resolveTextModel();
545
+ textModel.pushStackElement();
546
+ const editorConfig = this.constructCellEditorOptions(cellViewModel);
547
+ const rawEditorOptions = editorConfig.getRawOptions();
548
+ const cursorConfig = {
549
+ cursorStyle: cursorStyleFromString(rawEditorOptions.cursorStyle),
550
+ cursorBlinking: cursorBlinkingStyleFromString(rawEditorOptions.cursorBlinking),
551
+ cursorSmoothCaretAnimation: rawEditorOptions.cursorSmoothCaretAnimation
552
+ };
553
+ trackedMatch = {
554
+ cellViewModel: cellViewModel,
555
+ initialSelection: initialSelection,
556
+ matchSelections: selections,
557
+ editorConfig: editorConfig,
558
+ cursorConfig: cursorConfig,
559
+ decorationIds: [],
560
+ undoRedoHistory: this.undoRedoService.getElements(cellViewModel.uri)
561
+ };
562
+ this.trackedCells.push(trackedMatch);
563
+ }
564
+ return trackedMatch;
565
+ }
456
566
  async deleteLeft() {
457
- this.trackedMatches.forEach(match => {
458
- const controller = this.cursorsControllers.get(match.cellViewModel.uri);
567
+ this.trackedCells.forEach(cell => {
568
+ const controller = this.cursorsControllers.get(cell.cellViewModel.uri);
459
569
  if (!controller) {
460
570
  return;
461
571
  }
@@ -464,102 +574,92 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
464
574
  if (!delSelections) {
465
575
  return;
466
576
  }
467
- controller.setSelections(( (new ViewModelEventsCollector())), undefined, delSelections, 3 );
577
+ controller.setSelections(( new ViewModelEventsCollector()), undefined, delSelections, CursorChangeReason.Explicit);
468
578
  });
469
579
  this.updateLazyDecorations();
470
580
  }
471
581
  async deleteRight() {
472
- this.trackedMatches.forEach(match => {
473
- const controller = this.cursorsControllers.get(match.cellViewModel.uri);
582
+ this.trackedCells.forEach(cell => {
583
+ const controller = this.cursorsControllers.get(cell.cellViewModel.uri);
474
584
  if (!controller) {
475
585
  return;
476
586
  }
477
587
  const [, commands] = DeleteOperations.deleteRight(controller.getPrevEditOperationType(), controller.context.cursorConfig, controller.context.model, controller.getSelections());
478
- if (match.cellViewModel.handle !== this.anchorCell?.[0].handle) {
588
+ if (cell.cellViewModel.handle !== this.anchorCell?.[0].handle) {
479
589
  const delSelections = CommandExecutor.executeCommands(controller.context.model, controller.getSelections(), commands);
480
590
  if (!delSelections) {
481
591
  return;
482
592
  }
483
- controller.setSelections(( (new ViewModelEventsCollector())), undefined, delSelections, 3 );
593
+ controller.setSelections(( new ViewModelEventsCollector()), undefined, delSelections, CursorChangeReason.Explicit);
484
594
  }
485
595
  else {
486
- controller.setSelections(( (new ViewModelEventsCollector())), undefined, match.cellViewModel.getSelections(), 3 );
596
+ controller.setSelections(( new ViewModelEventsCollector()), undefined, cell.cellViewModel.getSelections(), CursorChangeReason.Explicit);
487
597
  }
488
598
  });
489
599
  this.updateLazyDecorations();
490
600
  }
491
601
  async undo() {
492
602
  const models = [];
493
- for (const match of this.trackedMatches) {
494
- const model = await match.cellViewModel.resolveTextModel();
603
+ for (const cell of this.trackedCells) {
604
+ const model = await cell.cellViewModel.resolveTextModel();
495
605
  if (model) {
496
606
  models.push(model);
497
607
  }
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 );
503
608
  }
504
- await Promise.all(( (models.map(model => model.undo()))));
609
+ await Promise.all(( models.map(model => model.undo())));
610
+ this.updateViewModelSelections();
505
611
  this.updateLazyDecorations();
506
612
  }
507
613
  async redo() {
508
614
  const models = [];
509
- for (const match of this.trackedMatches) {
510
- const model = await match.cellViewModel.resolveTextModel();
615
+ for (const cell of this.trackedCells) {
616
+ const model = await cell.cellViewModel.resolveTextModel();
511
617
  if (model) {
512
618
  models.push(model);
513
619
  }
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 );
519
620
  }
520
- await Promise.all(( (models.map(model => model.redo()))));
621
+ await Promise.all(( models.map(model => model.redo())));
622
+ this.updateViewModelSelections();
521
623
  this.updateLazyDecorations();
522
624
  }
523
625
  constructCellEditorOptions(cell) {
524
- const cellEditorOptions = ( (new CellEditorOptions(
626
+ const cellEditorOptions = ( new CellEditorOptions(
525
627
  this.notebookEditor.getBaseCellEditorOptions(cell.language),
526
628
  this.notebookEditor.notebookOptions,
527
629
  this.configurationService
528
- )));
630
+ ));
529
631
  const options = cellEditorOptions.getUpdatedValue(cell.internalMetadata, cell.uri);
530
- return (
531
- (new EditorConfiguration(
532
- false,
533
- MenuId.EditorContent,
534
- false,
535
- options,
536
- null,
537
- this.accessibilityService
538
- ))
539
- );
540
- }
541
- initializeMultiSelectDecorations(match, isCurrentWord) {
542
- if (!match) {
632
+ return ( new EditorConfiguration(
633
+ false,
634
+ MenuId.EditorContent,
635
+ false,
636
+ options,
637
+ null,
638
+ this.accessibilityService
639
+ ));
640
+ }
641
+ initializeMultiSelectDecorations(cell) {
642
+ if (!cell) {
543
643
  return;
544
644
  }
545
645
  const decorations = [];
546
- match.wordSelections.forEach(selection => {
646
+ cell.matchSelections.forEach(selection => {
547
647
  decorations.push({
548
648
  range: Selection.fromPositions(selection.getEndPosition()),
549
649
  options: {
550
650
  description: '',
551
- className: this.getClassName(match.cursorConfig, true),
651
+ className: this.getClassName(cell.cursorConfig, true),
552
652
  }
553
653
  });
554
654
  });
555
- match.decorationIds = match.cellViewModel.deltaModelDecorations(match.decorationIds, decorations);
655
+ cell.decorationIds = cell.cellViewModel.deltaModelDecorations(cell.decorationIds, decorations);
556
656
  }
557
657
  updateLazyDecorations() {
558
- this.trackedMatches.forEach(match => {
559
- if (match.cellViewModel.handle === this.anchorCell?.[0].handle) {
658
+ this.trackedCells.forEach(cell => {
659
+ if (cell.cellViewModel.handle === this.anchorCell?.[0].handle) {
560
660
  return;
561
661
  }
562
- const controller = this.cursorsControllers.get(match.cellViewModel.uri);
662
+ const controller = this.cursorsControllers.get(cell.cellViewModel.uri);
563
663
  if (!controller) {
564
664
  return;
565
665
  }
@@ -572,7 +672,7 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
572
672
  range: selection,
573
673
  options: {
574
674
  description: '',
575
- className: this.getClassName(match.cursorConfig, false),
675
+ className: this.getClassName(cell.cursorConfig, false),
576
676
  }
577
677
  });
578
678
  }
@@ -581,19 +681,19 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
581
681
  options: {
582
682
  description: '',
583
683
  zIndex: 10000,
584
- className: this.getClassName(match.cursorConfig, true),
684
+ className: this.getClassName(cell.cursorConfig, true),
585
685
  }
586
686
  });
587
687
  });
588
- match.decorationIds = match.cellViewModel.deltaModelDecorations(match.decorationIds, newDecorations);
589
- const matchingEditor = this.notebookEditor.codeEditors.find(cellEditor => cellEditor[0] === match.cellViewModel);
688
+ cell.decorationIds = cell.cellViewModel.deltaModelDecorations(cell.decorationIds, newDecorations);
689
+ const matchingEditor = this.notebookEditor.codeEditors.find(cellEditor => cellEditor[0] === cell.cellViewModel);
590
690
  if (matchingEditor) {
591
691
  WordHighlighterContribution.get(matchingEditor[1])?.wordHighlighter?.trigger();
592
692
  }
593
693
  });
594
694
  }
595
- clearDecorations(match) {
596
- match.decorationIds = match.cellViewModel.deltaModelDecorations(match.decorationIds, []);
695
+ clearDecorations(cell) {
696
+ cell.decorationIds = cell.cellViewModel.deltaModelDecorations(cell.decorationIds, []);
597
697
  }
598
698
  getWord(selection, model) {
599
699
  const lineNumber = selection.startLineNumber;
@@ -629,19 +729,19 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
629
729
  break;
630
730
  }
631
731
  switch (cursorConfig.cursorBlinking) {
632
- case 1 :
732
+ case TextEditorCursorBlinkingStyle.Blink:
633
733
  result += '.nb-blink';
634
734
  break;
635
- case 2 :
735
+ case TextEditorCursorBlinkingStyle.Smooth:
636
736
  result += '.nb-smooth';
637
737
  break;
638
- case 3 :
738
+ case TextEditorCursorBlinkingStyle.Phase:
639
739
  result += '.nb-phase';
640
740
  break;
641
- case 4 :
741
+ case TextEditorCursorBlinkingStyle.Expand:
642
742
  result += '.nb-expand';
643
743
  break;
644
- case 5 :
744
+ case TextEditorCursorBlinkingStyle.Solid:
645
745
  result += '.nb-solid';
646
746
  break;
647
747
  default:
@@ -658,38 +758,63 @@ let NotebookMultiCursorController = class NotebookMultiCursorController extends
658
758
  super.dispose();
659
759
  this.anchorDisposables.dispose();
660
760
  this.cursorsDisposables.dispose();
661
- this.trackedMatches.forEach(match => {
662
- this.clearDecorations(match);
761
+ this.trackedCells.forEach(cell => {
762
+ this.clearDecorations(cell);
663
763
  });
664
- this.trackedMatches = [];
764
+ this.trackedCells = [];
665
765
  }
666
766
  };
667
- NotebookMultiCursorController = ( (__decorate([
668
- ( (__param(1, IContextKeyService))),
669
- ( (__param(2, ITextModelService))),
670
- ( (__param(3, ILanguageConfigurationService))),
671
- ( (__param(4, IAccessibilityService))),
672
- ( (__param(5, IConfigurationService))),
673
- ( (__param(6, IUndoRedoService)))
674
- ], NotebookMultiCursorController)));
767
+ NotebookMultiCursorController = ( __decorate([
768
+ ( __param(1, IContextKeyService)),
769
+ ( __param(2, ITextModelService)),
770
+ ( __param(3, ILanguageConfigurationService)),
771
+ ( __param(4, IAccessibilityService)),
772
+ ( __param(5, IConfigurationService)),
773
+ ( __param(6, IUndoRedoService))
774
+ ], NotebookMultiCursorController));
775
+ class NotebookSelectAllFindMatches extends NotebookAction {
776
+ constructor() {
777
+ super({
778
+ id: NOTEBOOK_SELECT_ALL_FIND_MATCHES_ID,
779
+ title: ( localize(7358, "Select All Occurrences of Find Match")),
780
+ precondition: ( ContextKeyExpr.and(( ContextKeyExpr.equals('config.notebook.multiCursor.enabled', true)))),
781
+ keybinding: {
782
+ 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)))),
783
+ primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KeyL,
784
+ weight: KeybindingWeight.WorkbenchContrib
785
+ }
786
+ });
787
+ }
788
+ async runWithContext(accessor, context) {
789
+ const editorService = accessor.get(IEditorService);
790
+ const editor = getNotebookEditorFromEditorPane(editorService.activeEditorPane);
791
+ if (!editor) {
792
+ return;
793
+ }
794
+ if (!context.cell) {
795
+ return;
796
+ }
797
+ const cursorController = editor.getContribution(NotebookMultiCursorController.id);
798
+ const findController = editor.getContribution(NotebookFindContrib.id);
799
+ if (findController.widget.isFocused) {
800
+ const findModel = findController.widget.findModel;
801
+ cursorController.selectAllMatches(context.cell, findModel.findMatches);
802
+ }
803
+ else {
804
+ cursorController.selectAllMatches(context.cell);
805
+ }
806
+ }
807
+ }
675
808
  class NotebookAddMatchToMultiSelectionAction extends NotebookAction {
676
809
  constructor() {
677
810
  super({
678
811
  id: NOTEBOOK_ADD_FIND_MATCH_TO_SELECTION_ID,
679
- title: ( localize(8199, "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
- ))),
812
+ title: ( localize(7359, "Add Selection To Next Find Match")),
813
+ precondition: ( ContextKeyExpr.and(( ContextKeyExpr.equals('config.notebook.multiCursor.enabled', true)), NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_CELL_EDITOR_FOCUSED)),
685
814
  keybinding: {
686
- when: ( (ContextKeyExpr.and(
687
- (ContextKeyExpr.equals('config.notebook.multiCursor.enabled', true)),
688
- NOTEBOOK_IS_ACTIVE_EDITOR,
689
- NOTEBOOK_CELL_EDITOR_FOCUSED
690
- ))),
691
- primary: 2048 | 34 ,
692
- weight: 200
815
+ when: ( ContextKeyExpr.and(( ContextKeyExpr.equals('config.notebook.multiCursor.enabled', true)), NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_CELL_EDITOR_FOCUSED)),
816
+ primary: KeyMod.CtrlCmd | KeyCode.KeyD,
817
+ weight: KeybindingWeight.WorkbenchContrib
693
818
  }
694
819
  });
695
820
  }
@@ -710,20 +835,12 @@ class NotebookExitMultiSelectionAction extends NotebookAction {
710
835
  constructor() {
711
836
  super({
712
837
  id: 'noteMultiCursor.exit',
713
- title: ( localize(8200, "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
- ))),
838
+ title: ( localize(7360, "Exit Multi Cursor Mode")),
839
+ precondition: ( ContextKeyExpr.and(( ContextKeyExpr.equals('config.notebook.multiCursor.enabled', true)), NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_MULTI_CURSOR_CONTEXT.IsNotebookMultiCursor)),
719
840
  keybinding: {
720
- when: ( (ContextKeyExpr.and(
721
- (ContextKeyExpr.equals('config.notebook.multiCursor.enabled', true)),
722
- NOTEBOOK_IS_ACTIVE_EDITOR,
723
- NOTEBOOK_MULTI_CURSOR_CONTEXT.IsNotebookMultiCursor
724
- ))),
725
- primary: 9 ,
726
- weight: 200
841
+ when: ( ContextKeyExpr.and(( ContextKeyExpr.equals('config.notebook.multiCursor.enabled', true)), NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_MULTI_CURSOR_CONTEXT.IsNotebookMultiCursor)),
842
+ primary: KeyCode.Escape,
843
+ weight: KeybindingWeight.WorkbenchContrib
727
844
  }
728
845
  });
729
846
  }
@@ -741,28 +858,12 @@ class NotebookDeleteLeftMultiSelectionAction extends NotebookAction {
741
858
  constructor() {
742
859
  super({
743
860
  id: 'noteMultiCursor.deleteLeft',
744
- title: ( localize(8201, "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
- ))),
861
+ title: ( localize(7361, "Delete Left")),
862
+ 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)))))),
754
863
  keybinding: {
755
- when: ( (ContextKeyExpr.and(
756
- (ContextKeyExpr.equals('config.notebook.multiCursor.enabled', true)),
757
- NOTEBOOK_IS_ACTIVE_EDITOR,
758
- NOTEBOOK_MULTI_CURSOR_CONTEXT.IsNotebookMultiCursor,
759
- (ContextKeyExpr.or(
760
- (NOTEBOOK_MULTI_CURSOR_CONTEXT.NotebookMultiSelectCursorState.isEqualTo(NotebookMultiCursorState.Selecting)),
761
- (NOTEBOOK_MULTI_CURSOR_CONTEXT.NotebookMultiSelectCursorState.isEqualTo(NotebookMultiCursorState.Editing))
762
- ))
763
- ))),
764
- primary: 1 ,
765
- weight: 200
864
+ 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)))))),
865
+ primary: KeyCode.Backspace,
866
+ weight: KeybindingWeight.WorkbenchContrib
766
867
  }
767
868
  });
768
869
  }
@@ -780,28 +881,12 @@ class NotebookDeleteRightMultiSelectionAction extends NotebookAction {
780
881
  constructor() {
781
882
  super({
782
883
  id: 'noteMultiCursor.deleteRight',
783
- title: ( localize(8202, "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
- ))),
884
+ title: ( localize(7362, "Delete Right")),
885
+ 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)))))),
793
886
  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
887
+ 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)))))),
888
+ primary: KeyCode.Delete,
889
+ weight: KeybindingWeight.WorkbenchContrib
805
890
  }
806
891
  });
807
892
  }
@@ -840,11 +925,7 @@ let NotebookMultiCursorUndoRedoContribution = class NotebookMultiCursorUndoRedoC
840
925
  }
841
926
  const controller = editor.getContribution(NotebookMultiCursorController.id);
842
927
  return controller.undo();
843
- }, ( (ContextKeyExpr.and(
844
- (ContextKeyExpr.equals('config.notebook.multiCursor.enabled', true)),
845
- NOTEBOOK_IS_ACTIVE_EDITOR,
846
- NOTEBOOK_MULTI_CURSOR_CONTEXT.IsNotebookMultiCursor
847
- )))));
928
+ }, ( ContextKeyExpr.and(( ContextKeyExpr.equals('config.notebook.multiCursor.enabled', true)), NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_MULTI_CURSOR_CONTEXT.IsNotebookMultiCursor))));
848
929
  this._register(RedoCommand.addImplementation(PRIORITY, 'notebook-multicursor-undo-redo', () => {
849
930
  const editor = getNotebookEditorFromEditorPane(this._editorService.activeEditorPane);
850
931
  if (!editor) {
@@ -855,19 +936,16 @@ let NotebookMultiCursorUndoRedoContribution = class NotebookMultiCursorUndoRedoC
855
936
  }
856
937
  const controller = editor.getContribution(NotebookMultiCursorController.id);
857
938
  return controller.redo();
858
- }, ( (ContextKeyExpr.and(
859
- (ContextKeyExpr.equals('config.notebook.multiCursor.enabled', true)),
860
- NOTEBOOK_IS_ACTIVE_EDITOR,
861
- NOTEBOOK_MULTI_CURSOR_CONTEXT.IsNotebookMultiCursor
862
- )))));
939
+ }, ( ContextKeyExpr.and(( ContextKeyExpr.equals('config.notebook.multiCursor.enabled', true)), NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_MULTI_CURSOR_CONTEXT.IsNotebookMultiCursor))));
863
940
  }
864
941
  };
865
- NotebookMultiCursorUndoRedoContribution = ( (__decorate([
866
- ( (__param(0, IEditorService))),
867
- ( (__param(1, IConfigurationService)))
868
- ], NotebookMultiCursorUndoRedoContribution)));
942
+ NotebookMultiCursorUndoRedoContribution = ( __decorate([
943
+ ( __param(0, IEditorService)),
944
+ ( __param(1, IConfigurationService))
945
+ ], NotebookMultiCursorUndoRedoContribution));
869
946
  registerNotebookContribution(NotebookMultiCursorController.id, NotebookMultiCursorController);
870
- registerWorkbenchContribution2(NotebookMultiCursorUndoRedoContribution.ID, NotebookMultiCursorUndoRedoContribution, 2 );
947
+ registerWorkbenchContribution2(NotebookMultiCursorUndoRedoContribution.ID, NotebookMultiCursorUndoRedoContribution, WorkbenchPhase.BlockRestore);
948
+ registerAction2(NotebookSelectAllFindMatches);
871
949
  registerAction2(NotebookAddMatchToMultiSelectionAction);
872
950
  registerAction2(NotebookExitMultiSelectionAction);
873
951
  registerAction2(NotebookDeleteLeftMultiSelectionAction);