@codingame/monaco-vscode-notebook-service-override 1.85.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/external/rollup-plugin-styles/dist/runtime/inject-css.js +3 -0
  2. package/external/tslib/tslib.es6.js +11 -0
  3. package/index.d.ts +1 -0
  4. package/index.js +1 -0
  5. package/notebook.d.ts +5 -0
  6. package/notebook.js +44 -0
  7. package/override/vs/platform/dialogs/common/dialogs.js +8 -0
  8. package/package.json +32 -0
  9. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.css.js +6 -0
  10. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +387 -0
  11. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +668 -0
  12. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +109 -0
  13. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.js +319 -0
  14. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/notebookVisibleCellObserver.js +58 -0
  15. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +173 -0
  16. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +485 -0
  17. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +106 -0
  18. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +67 -0
  19. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +165 -0
  20. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +67 -0
  21. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +238 -0
  22. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +72 -0
  23. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/media/notebookFind.css.js +6 -0
  24. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +168 -0
  25. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +317 -0
  26. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +209 -0
  27. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +87 -0
  28. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +82 -0
  29. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +67 -0
  30. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +93 -0
  31. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +383 -0
  32. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +51 -0
  33. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +46 -0
  34. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +135 -0
  35. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +383 -0
  36. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +117 -0
  37. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +511 -0
  38. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +168 -0
  39. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +57 -0
  40. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +94 -0
  41. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +51 -0
  42. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +702 -0
  43. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +268 -0
  44. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +45 -0
  45. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +1297 -0
  46. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +284 -0
  47. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +563 -0
  48. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +108 -0
  49. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +39 -0
  50. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css.js +6 -0
  51. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +313 -0
  52. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +872 -0
  53. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +13 -0
  54. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +393 -0
  55. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +175 -0
  56. package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +1121 -0
  57. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibility.js +159 -0
  58. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +339 -0
  59. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookCellStatusBarServiceImpl.js +41 -0
  60. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +182 -0
  61. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +106 -0
  62. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +509 -0
  63. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +133 -0
  64. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +342 -0
  65. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +111 -0
  66. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +28 -0
  67. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +65 -0
  68. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +666 -0
  69. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +200 -0
  70. package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +80 -0
  71. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +1001 -0
  72. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +103 -0
  73. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +202 -0
  74. package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +80 -0
  75. package/vscode/src/vs/workbench/contrib/notebook/common/notebookProvider.js +98 -0
  76. package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookSimpleWorker.js +217 -0
  77. package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +89 -0
  78. package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +372 -0
  79. package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopy.js +706 -0
  80. package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +407 -0
  81. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +144 -0
  82. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.js +129 -0
  83. package/worker.js +1 -0
  84. package/workers/notebook.worker.js +9 -0
@@ -0,0 +1,383 @@
1
+ import { timeout } from 'monaco-editor/esm/vs/base/common/async.js';
2
+ import { EditorExtensionsRegistry } from 'monaco-editor/esm/vs/editor/browser/editorExtensions.js';
3
+ import { EditorContextKeys } from 'monaco-editor/esm/vs/editor/common/editorContextKeys.js';
4
+ import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
5
+ import { CONTEXT_ACCESSIBILITY_MODE_ENABLED } from 'monaco-editor/esm/vs/platform/accessibility/common/accessibility.js';
6
+ import { registerAction2 } from 'monaco-editor/esm/vs/platform/actions/common/actions.js';
7
+ import { Extensions } from 'monaco-editor/esm/vs/platform/configuration/common/configurationRegistry.js';
8
+ import { ContextKeyExpr } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
9
+ import { InputFocusedContextKey } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkeys.js';
10
+ import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
11
+ import { InlineChatController } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatController';
12
+ import { CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_INNER_CURSOR_LAST } from 'vscode/vscode/vs/workbench/contrib/inlineChat/common/inlineChat';
13
+ import { NotebookCellAction, NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT, findTargetCellEditor, NotebookAction } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/coreActions';
14
+ import { CellEditState } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
15
+ import { NOTEBOOK_EDITOR_CURSOR_BOUNDARY, CellKind } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
16
+ import { NOTEBOOK_EDITOR_FOCUSED, NOTEBOOK_CELL_TYPE, NOTEBOOK_CELL_MARKDOWN_EDIT_MODE, NOTEBOOK_CURSOR_NAVIGATION_MODE, NOTEBOOK_OUTPUT_FOCUSED, NOTEBOOK_CELL_HAS_OUTPUTS } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
17
+
18
+ const NOTEBOOK_FOCUS_TOP = 'notebook.focusTop';
19
+ const NOTEBOOK_FOCUS_BOTTOM = 'notebook.focusBottom';
20
+ const NOTEBOOK_FOCUS_PREVIOUS_EDITOR = 'notebook.focusPreviousEditor';
21
+ const NOTEBOOK_FOCUS_NEXT_EDITOR = 'notebook.focusNextEditor';
22
+ const FOCUS_IN_OUTPUT_COMMAND_ID = 'notebook.cell.focusInOutput';
23
+ const FOCUS_OUT_OUTPUT_COMMAND_ID = 'notebook.cell.focusOutOutput';
24
+ const CENTER_ACTIVE_CELL = 'notebook.centerActiveCell';
25
+ const NOTEBOOK_CURSOR_PAGEUP_COMMAND_ID = 'notebook.cell.cursorPageUp';
26
+ const NOTEBOOK_CURSOR_PAGEUP_SELECT_COMMAND_ID = 'notebook.cell.cursorPageUpSelect';
27
+ const NOTEBOOK_CURSOR_PAGEDOWN_COMMAND_ID = 'notebook.cell.cursorPageDown';
28
+ const NOTEBOOK_CURSOR_PAGEDOWN_SELECT_COMMAND_ID = 'notebook.cell.cursorPageDownSelect';
29
+ registerAction2(class FocusNextCellAction extends NotebookCellAction {
30
+ constructor() {
31
+ super({
32
+ id: NOTEBOOK_FOCUS_NEXT_EDITOR,
33
+ title: ( localizeWithPath(
34
+ 'vs/workbench/contrib/notebook/browser/contrib/navigation/arrow',
35
+ 'cursorMoveDown',
36
+ 'Focus Next Cell Editor'
37
+ )),
38
+ keybinding: [
39
+ {
40
+ when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ( CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate()), ( ContextKeyExpr.equals('config.notebook.navigation.allowNavigateToSurroundingCells', true)), ( ContextKeyExpr.and(( ContextKeyExpr.has(InputFocusedContextKey)), EditorContextKeys.editorTextFocus, ( NOTEBOOK_EDITOR_CURSOR_BOUNDARY.notEqualsTo('top')), ( NOTEBOOK_EDITOR_CURSOR_BOUNDARY.notEqualsTo('none')))), ( EditorContextKeys.isEmbeddedDiffEditor.negate()))),
41
+ primary: 18 ,
42
+ weight: NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT,
43
+ },
44
+ {
45
+ when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ( CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate()), ( ContextKeyExpr.equals('config.notebook.navigation.allowNavigateToSurroundingCells', true)), ( ContextKeyExpr.and(( NOTEBOOK_CELL_TYPE.isEqualTo('markup')), ( NOTEBOOK_CELL_MARKDOWN_EDIT_MODE.isEqualTo(false)), NOTEBOOK_CURSOR_NAVIGATION_MODE)), ( EditorContextKeys.isEmbeddedDiffEditor.negate()))),
46
+ primary: 18 ,
47
+ weight: 200 ,
48
+ },
49
+ {
50
+ when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, NOTEBOOK_OUTPUT_FOCUSED)),
51
+ primary: 2048 | 18 ,
52
+ mac: { primary: 256 | 2048 | 18 , },
53
+ weight: 200
54
+ },
55
+ {
56
+ when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ( CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate()), ( ContextKeyExpr.equals('config.notebook.navigation.allowNavigateToSurroundingCells', true)), ( ContextKeyExpr.and(( ContextKeyExpr.has(InputFocusedContextKey)), ( NOTEBOOK_EDITOR_CURSOR_BOUNDARY.notEqualsTo('top')), ( NOTEBOOK_EDITOR_CURSOR_BOUNDARY.notEqualsTo('none')))), CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_INNER_CURSOR_LAST, ( EditorContextKeys.isEmbeddedDiffEditor.negate()))),
57
+ primary: 18 ,
58
+ weight: 0
59
+ },
60
+ {
61
+ when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ( CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate()), ( ContextKeyExpr.equals('config.notebook.navigation.allowNavigateToSurroundingCells', true)), ( ContextKeyExpr.and(( NOTEBOOK_CELL_TYPE.isEqualTo('markup')), ( NOTEBOOK_CELL_MARKDOWN_EDIT_MODE.isEqualTo(false)), NOTEBOOK_CURSOR_NAVIGATION_MODE)), CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_INNER_CURSOR_LAST, ( EditorContextKeys.isEmbeddedDiffEditor.negate()))),
62
+ primary: 18 ,
63
+ weight: 0
64
+ },
65
+ {
66
+ when: NOTEBOOK_EDITOR_FOCUSED,
67
+ primary: 2048 | 512 | 12 ,
68
+ mac: { primary: 2048 | 512 | 12 , },
69
+ weight: 200
70
+ },
71
+ ]
72
+ });
73
+ }
74
+ async runWithContext(accessor, context) {
75
+ const editor = context.notebookEditor;
76
+ const activeCell = context.cell;
77
+ const idx = editor.getCellIndex(activeCell);
78
+ if (typeof idx !== 'number') {
79
+ return;
80
+ }
81
+ if (idx >= editor.getLength() - 1) {
82
+ return;
83
+ }
84
+ const focusEditorLine = activeCell.textBuffer.getLineCount();
85
+ const targetCell = (context.cell ?? context.selectedCells?.[0]);
86
+ const foundEditor = targetCell ? findTargetCellEditor(context, targetCell) : undefined;
87
+ if (foundEditor && foundEditor.hasTextFocus() && InlineChatController.get(foundEditor)?.getWidgetPosition()?.lineNumber === focusEditorLine) {
88
+ InlineChatController.get(foundEditor)?.focus();
89
+ }
90
+ else {
91
+ const newCell = editor.cellAt(idx + 1);
92
+ const newFocusMode = newCell.cellKind === CellKind.Markup && newCell.getEditState() === CellEditState.Preview ? 'container' : 'editor';
93
+ await editor.focusNotebookCell(newCell, newFocusMode, { focusEditorLine: 1 });
94
+ }
95
+ }
96
+ });
97
+ registerAction2(class FocusPreviousCellAction extends NotebookCellAction {
98
+ constructor() {
99
+ super({
100
+ id: NOTEBOOK_FOCUS_PREVIOUS_EDITOR,
101
+ title: ( localizeWithPath(
102
+ 'vs/workbench/contrib/notebook/browser/contrib/navigation/arrow',
103
+ 'cursorMoveUp',
104
+ 'Focus Previous Cell Editor'
105
+ )),
106
+ precondition: ( CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate()),
107
+ keybinding: [
108
+ {
109
+ when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ( CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate()), ( ContextKeyExpr.equals('config.notebook.navigation.allowNavigateToSurroundingCells', true)), ( ContextKeyExpr.and(( ContextKeyExpr.has(InputFocusedContextKey)), EditorContextKeys.editorTextFocus, ( NOTEBOOK_EDITOR_CURSOR_BOUNDARY.notEqualsTo('bottom')), ( NOTEBOOK_EDITOR_CURSOR_BOUNDARY.notEqualsTo('none')))), ( EditorContextKeys.isEmbeddedDiffEditor.negate()))),
110
+ primary: 16 ,
111
+ weight: NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT,
112
+ },
113
+ {
114
+ when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ( CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate()), ( ContextKeyExpr.equals('config.notebook.navigation.allowNavigateToSurroundingCells', true)), ( ContextKeyExpr.and(( NOTEBOOK_CELL_TYPE.isEqualTo('markup')), ( NOTEBOOK_CELL_MARKDOWN_EDIT_MODE.isEqualTo(false)), NOTEBOOK_CURSOR_NAVIGATION_MODE)), ( EditorContextKeys.isEmbeddedDiffEditor.negate()))),
115
+ primary: 16 ,
116
+ weight: 200 ,
117
+ },
118
+ {
119
+ when: NOTEBOOK_EDITOR_FOCUSED,
120
+ primary: 2048 | 512 | 11 ,
121
+ mac: { primary: 2048 | 512 | 11 },
122
+ weight: 200
123
+ },
124
+ ],
125
+ });
126
+ }
127
+ async runWithContext(accessor, context) {
128
+ const editor = context.notebookEditor;
129
+ const activeCell = context.cell;
130
+ const idx = editor.getCellIndex(activeCell);
131
+ if (typeof idx !== 'number') {
132
+ return;
133
+ }
134
+ if (idx < 1 || editor.getLength() === 0) {
135
+ return;
136
+ }
137
+ const newCell = editor.cellAt(idx - 1);
138
+ const newFocusMode = newCell.cellKind === CellKind.Markup && newCell.getEditState() === CellEditState.Preview ? 'container' : 'editor';
139
+ const focusEditorLine = newCell.textBuffer.getLineCount();
140
+ await editor.focusNotebookCell(newCell, newFocusMode, { focusEditorLine: focusEditorLine });
141
+ const foundEditor = findTargetCellEditor(context, newCell);
142
+ if (foundEditor && InlineChatController.get(foundEditor)?.getWidgetPosition()?.lineNumber === focusEditorLine) {
143
+ InlineChatController.get(foundEditor)?.focus();
144
+ }
145
+ }
146
+ });
147
+ registerAction2(class extends NotebookAction {
148
+ constructor() {
149
+ super({
150
+ id: NOTEBOOK_FOCUS_TOP,
151
+ title: ( localizeWithPath(
152
+ 'vs/workbench/contrib/notebook/browser/contrib/navigation/arrow',
153
+ 'focusFirstCell',
154
+ 'Focus First Cell'
155
+ )),
156
+ keybinding: {
157
+ when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ContextKeyExpr.not(InputFocusedContextKey))),
158
+ primary: 2048 | 14 ,
159
+ mac: { primary: 2048 | 16 },
160
+ weight: 200
161
+ },
162
+ });
163
+ }
164
+ async runWithContext(accessor, context) {
165
+ const editor = context.notebookEditor;
166
+ if (editor.getLength() === 0) {
167
+ return;
168
+ }
169
+ const firstCell = editor.cellAt(0);
170
+ await editor.focusNotebookCell(firstCell, 'container');
171
+ }
172
+ });
173
+ registerAction2(class extends NotebookAction {
174
+ constructor() {
175
+ super({
176
+ id: NOTEBOOK_FOCUS_BOTTOM,
177
+ title: ( localizeWithPath(
178
+ 'vs/workbench/contrib/notebook/browser/contrib/navigation/arrow',
179
+ 'focusLastCell',
180
+ 'Focus Last Cell'
181
+ )),
182
+ keybinding: {
183
+ when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ContextKeyExpr.not(InputFocusedContextKey))),
184
+ primary: 2048 | 13 ,
185
+ mac: { primary: 2048 | 18 },
186
+ weight: 200
187
+ },
188
+ });
189
+ }
190
+ async runWithContext(accessor, context) {
191
+ const editor = context.notebookEditor;
192
+ if (!editor.hasModel() || editor.getLength() === 0) {
193
+ return;
194
+ }
195
+ const lastIdx = editor.getLength() - 1;
196
+ const lastVisibleIdx = editor.getPreviousVisibleCellIndex(lastIdx);
197
+ if (lastVisibleIdx) {
198
+ const cell = editor.cellAt(lastVisibleIdx);
199
+ await editor.focusNotebookCell(cell, 'container');
200
+ }
201
+ }
202
+ });
203
+ registerAction2(class extends NotebookCellAction {
204
+ constructor() {
205
+ super({
206
+ id: FOCUS_IN_OUTPUT_COMMAND_ID,
207
+ title: ( localizeWithPath(
208
+ 'vs/workbench/contrib/notebook/browser/contrib/navigation/arrow',
209
+ 'focusOutput',
210
+ 'Focus In Active Cell Output'
211
+ )),
212
+ keybinding: {
213
+ when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, NOTEBOOK_CELL_HAS_OUTPUTS)),
214
+ primary: 2048 | 18 ,
215
+ mac: { primary: 256 | 2048 | 18 , },
216
+ weight: 200
217
+ },
218
+ });
219
+ }
220
+ async runWithContext(accessor, context) {
221
+ const editor = context.notebookEditor;
222
+ const activeCell = context.cell;
223
+ return timeout(0).then(() => editor.focusNotebookCell(activeCell, 'output'));
224
+ }
225
+ });
226
+ registerAction2(class extends NotebookCellAction {
227
+ constructor() {
228
+ super({
229
+ id: FOCUS_OUT_OUTPUT_COMMAND_ID,
230
+ title: ( localizeWithPath(
231
+ 'vs/workbench/contrib/notebook/browser/contrib/navigation/arrow',
232
+ 'focusOutputOut',
233
+ 'Focus Out Active Cell Output'
234
+ )),
235
+ keybinding: {
236
+ when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, NOTEBOOK_OUTPUT_FOCUSED)),
237
+ primary: 2048 | 16 ,
238
+ mac: { primary: 256 | 2048 | 16 , },
239
+ weight: 200
240
+ },
241
+ });
242
+ }
243
+ async runWithContext(accessor, context) {
244
+ const editor = context.notebookEditor;
245
+ const activeCell = context.cell;
246
+ await editor.focusNotebookCell(activeCell, 'editor');
247
+ }
248
+ });
249
+ registerAction2(class CenterActiveCellAction extends NotebookCellAction {
250
+ constructor() {
251
+ super({
252
+ id: CENTER_ACTIVE_CELL,
253
+ title: ( localizeWithPath(
254
+ 'vs/workbench/contrib/notebook/browser/contrib/navigation/arrow',
255
+ 'notebookActions.centerActiveCell',
256
+ "Center Active Cell"
257
+ )),
258
+ keybinding: {
259
+ when: NOTEBOOK_EDITOR_FOCUSED,
260
+ primary: 2048 | 42 ,
261
+ mac: {
262
+ primary: 256 | 42 ,
263
+ },
264
+ weight: 200
265
+ },
266
+ });
267
+ }
268
+ async runWithContext(accessor, context) {
269
+ return context.notebookEditor.revealInCenter(context.cell);
270
+ }
271
+ });
272
+ registerAction2(class extends NotebookCellAction {
273
+ constructor() {
274
+ super({
275
+ id: NOTEBOOK_CURSOR_PAGEUP_COMMAND_ID,
276
+ title: ( localizeWithPath(
277
+ 'vs/workbench/contrib/notebook/browser/contrib/navigation/arrow',
278
+ 'cursorPageUp',
279
+ "Cell Cursor Page Up"
280
+ )),
281
+ keybinding: [
282
+ {
283
+ when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ( ContextKeyExpr.has(InputFocusedContextKey)), EditorContextKeys.editorTextFocus)),
284
+ primary: 11 ,
285
+ weight: NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT
286
+ }
287
+ ]
288
+ });
289
+ }
290
+ async runWithContext(accessor, context) {
291
+ EditorExtensionsRegistry.getEditorCommand('cursorPageUp').runCommand(accessor, { pageSize: getPageSize(context) });
292
+ }
293
+ });
294
+ registerAction2(class extends NotebookCellAction {
295
+ constructor() {
296
+ super({
297
+ id: NOTEBOOK_CURSOR_PAGEUP_SELECT_COMMAND_ID,
298
+ title: ( localizeWithPath(
299
+ 'vs/workbench/contrib/notebook/browser/contrib/navigation/arrow',
300
+ 'cursorPageUpSelect',
301
+ "Cell Cursor Page Up Select"
302
+ )),
303
+ keybinding: [
304
+ {
305
+ when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ( ContextKeyExpr.has(InputFocusedContextKey)), EditorContextKeys.editorTextFocus)),
306
+ primary: 1024 | 11 ,
307
+ weight: NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT
308
+ }
309
+ ]
310
+ });
311
+ }
312
+ async runWithContext(accessor, context) {
313
+ EditorExtensionsRegistry.getEditorCommand('cursorPageUpSelect').runCommand(accessor, { pageSize: getPageSize(context) });
314
+ }
315
+ });
316
+ registerAction2(class extends NotebookCellAction {
317
+ constructor() {
318
+ super({
319
+ id: NOTEBOOK_CURSOR_PAGEDOWN_COMMAND_ID,
320
+ title: ( localizeWithPath(
321
+ 'vs/workbench/contrib/notebook/browser/contrib/navigation/arrow',
322
+ 'cursorPageDown',
323
+ "Cell Cursor Page Down"
324
+ )),
325
+ keybinding: [
326
+ {
327
+ when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ( ContextKeyExpr.has(InputFocusedContextKey)), EditorContextKeys.editorTextFocus)),
328
+ primary: 12 ,
329
+ weight: NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT
330
+ }
331
+ ]
332
+ });
333
+ }
334
+ async runWithContext(accessor, context) {
335
+ EditorExtensionsRegistry.getEditorCommand('cursorPageDown').runCommand(accessor, { pageSize: getPageSize(context) });
336
+ }
337
+ });
338
+ registerAction2(class extends NotebookCellAction {
339
+ constructor() {
340
+ super({
341
+ id: NOTEBOOK_CURSOR_PAGEDOWN_SELECT_COMMAND_ID,
342
+ title: ( localizeWithPath(
343
+ 'vs/workbench/contrib/notebook/browser/contrib/navigation/arrow',
344
+ 'cursorPageDownSelect',
345
+ "Cell Cursor Page Down Select"
346
+ )),
347
+ keybinding: [
348
+ {
349
+ when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ( ContextKeyExpr.has(InputFocusedContextKey)), EditorContextKeys.editorTextFocus)),
350
+ primary: 1024 | 12 ,
351
+ weight: NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT
352
+ }
353
+ ]
354
+ });
355
+ }
356
+ async runWithContext(accessor, context) {
357
+ EditorExtensionsRegistry.getEditorCommand('cursorPageDownSelect').runCommand(accessor, { pageSize: getPageSize(context) });
358
+ }
359
+ });
360
+ function getPageSize(context) {
361
+ const editor = context.notebookEditor;
362
+ const layoutInfo = editor.getViewModel().layoutInfo;
363
+ const lineHeight = layoutInfo?.fontInfo.lineHeight || 17;
364
+ return Math.max(1, Math.floor((layoutInfo?.height || 0) / lineHeight) - 2);
365
+ }
366
+ ( Registry.as(Extensions.Configuration)).registerConfiguration({
367
+ id: 'notebook',
368
+ order: 100,
369
+ type: 'object',
370
+ 'properties': {
371
+ 'notebook.navigation.allowNavigateToSurroundingCells': {
372
+ type: 'boolean',
373
+ default: true,
374
+ markdownDescription: ( localizeWithPath(
375
+ 'vs/workbench/contrib/notebook/browser/contrib/navigation/arrow',
376
+ 'notebook.navigation.allowNavigateToSurroundingCells',
377
+ "When enabled cursor can navigate to the next/previous cell when the current cursor in the cell editor is at the first/last line."
378
+ ))
379
+ }
380
+ }
381
+ });
382
+
383
+ export { CENTER_ACTIVE_CELL };
@@ -0,0 +1,51 @@
1
+ import { __decorate, __param } from '../../../../../../../../../external/tslib/tslib.es6.js';
2
+ import * as nls from 'monaco-editor/esm/vs/nls.js';
3
+ import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
4
+ import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
5
+ import { Extensions } from 'vscode/vscode/vs/workbench/common/views';
6
+ import { VIEWLET_ID } from 'vscode/vscode/vs/workbench/contrib/debug/common/debug';
7
+ import { ContextKeyExpr } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
8
+ import { SyncDescriptor } from 'monaco-editor/esm/vs/platform/instantiation/common/descriptors.js';
9
+ import { NotebookVariablesView } from './notebookVariablesView.js';
10
+ import { NOTEBOOK_KERNEL } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
11
+ import { variablesViewIcon } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookIcons';
12
+ import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
13
+ import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
14
+
15
+ let NotebookVariables = class NotebookVariables extends Disposable {
16
+ constructor(editorService, configurationService) {
17
+ super();
18
+ this.editorService = editorService;
19
+ this.listener = this.editorService.onDidEditorsChange(() => {
20
+ if (configurationService.getValue('notebook.experimental.notebookVariablesView')
21
+ && this.editorService.activeEditorPane?.getId() === 'workbench.editor.notebook') {
22
+ if (this.initializeView()) {
23
+ this.listener?.dispose();
24
+ }
25
+ }
26
+ });
27
+ }
28
+ initializeView() {
29
+ const debugViewContainer = ( Registry.as('workbench.registry.view.containers')).get(VIEWLET_ID);
30
+ if (debugViewContainer) {
31
+ const viewsRegistry = ( Registry.as(Extensions.ViewsRegistry));
32
+ const viewDescriptor = {
33
+ id: 'NOTEBOOK_VARIABLES', name: ( nls.localize2WithPath(
34
+ 'vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables',
35
+ 'notebookVariables',
36
+ "Notebook Variables"
37
+ )), containerIcon: variablesViewIcon, ctorDescriptor: ( new SyncDescriptor(NotebookVariablesView)),
38
+ order: 50, weight: 5, canToggleVisibility: true, canMoveView: true, collapsed: true, when: ( ContextKeyExpr.notEquals(NOTEBOOK_KERNEL.key, '')),
39
+ };
40
+ viewsRegistry.registerViews([viewDescriptor], debugViewContainer);
41
+ return true;
42
+ }
43
+ return false;
44
+ }
45
+ };
46
+ NotebookVariables = ( __decorate([
47
+ ( __param(0, IEditorService)),
48
+ ( __param(1, IConfigurationService))
49
+ ], NotebookVariables));
50
+
51
+ export { NotebookVariables };
@@ -0,0 +1,46 @@
1
+ import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
2
+ import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
3
+
4
+ class NotebookVariablesDelegate {
5
+ getHeight(element) {
6
+ return 22;
7
+ }
8
+ getTemplateId(element) {
9
+ return NotebookVariableRenderer.ID;
10
+ }
11
+ }
12
+ class NotebookVariableRenderer {
13
+ static { this.ID = 'variableElement'; }
14
+ get templateId() {
15
+ return NotebookVariableRenderer.ID;
16
+ }
17
+ renderTemplate(container) {
18
+ const wrapper = dom.append(container, dom.$('.variable'));
19
+ return { wrapper };
20
+ }
21
+ renderElement(element, index, templateData, height) {
22
+ templateData.wrapper.innerText = `${element.element.label} - ${element.element.value}`;
23
+ }
24
+ disposeTemplate() {
25
+ }
26
+ }
27
+ class NotebookVariableAccessibilityProvider {
28
+ getWidgetAriaLabel() {
29
+ return ( localizeWithPath(
30
+ 'vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree',
31
+ 'debugConsole',
32
+ "Notebook Variables"
33
+ ));
34
+ }
35
+ getAriaLabel(element) {
36
+ return ( localizeWithPath(
37
+ 'vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree',
38
+ 'notebookVariableAriaLabel',
39
+ "Variable {0}, value {1}",
40
+ element.label,
41
+ element.value
42
+ ));
43
+ }
44
+ }
45
+
46
+ export { NotebookVariableAccessibilityProvider, NotebookVariableRenderer, NotebookVariablesDelegate };
@@ -0,0 +1,135 @@
1
+ import { __decorate, __param } from '../../../../../../../../../external/tslib/tslib.es6.js';
2
+ import { CancellationToken } from 'monaco-editor/esm/vs/base/common/cancellation.js';
3
+ import * as nls from 'monaco-editor/esm/vs/nls.js';
4
+ import { ICommandService } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
5
+ import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
6
+ import { IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
7
+ import { IContextMenuService } from 'monaco-editor/esm/vs/platform/contextview/browser/contextView.js';
8
+ import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
9
+ import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
10
+ import { WorkbenchObjectTree } from 'monaco-editor/esm/vs/platform/list/browser/listService.js';
11
+ import { IOpenerService } from 'monaco-editor/esm/vs/platform/opener/common/opener.js';
12
+ import { IQuickInputService } from 'monaco-editor/esm/vs/platform/quickinput/common/quickInput.js';
13
+ import { ITelemetryService } from 'monaco-editor/esm/vs/platform/telemetry/common/telemetry.js';
14
+ import { IThemeService } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
15
+ import { ViewPane } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPane';
16
+ import { IViewDescriptorService } from 'vscode/vscode/vs/workbench/common/views';
17
+ import { NotebookVariablesDelegate, NotebookVariableRenderer, NotebookVariableAccessibilityProvider } from './notebookVariablesTree.js';
18
+ import { getNotebookEditorFromEditorPane } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
19
+ import { INotebookExecutionStateService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookExecutionStateService';
20
+ import { INotebookKernelService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookKernelService';
21
+ import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
22
+
23
+ let NotebookVariablesView = class NotebookVariablesView extends ViewPane {
24
+ static { this.ID = 'notebookVariablesView'; }
25
+ static { this.TITLE = ( nls.localize2WithPath(
26
+ 'vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView',
27
+ 'notebook.notebookVariables',
28
+ "Notebook Variables"
29
+ )); }
30
+ constructor(options, editorService, notebookKernelService, notebookExecutionStateService, keybindingService, contextMenuService, contextKeyService, configurationService, instantiationService, viewDescriptorService, openerService, quickInputService, commandService, themeService, telemetryService) {
31
+ super(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService);
32
+ this.editorService = editorService;
33
+ this.notebookKernelService = notebookKernelService;
34
+ this.notebookExecutionStateService = notebookExecutionStateService;
35
+ this.quickInputService = quickInputService;
36
+ this.commandService = commandService;
37
+ this.index = 0;
38
+ this._register(this.editorService.onDidActiveEditorChange(this.handleActiveEditorChange.bind(this)));
39
+ this._register(this.notebookExecutionStateService.onDidChangeExecution(this.handleExecutionStateChange.bind(this)));
40
+ this._register(this.notebookKernelService.onDidNotebookVariablesUpdate(this.handleVariablesChanged.bind(this)));
41
+ }
42
+ renderBody(container) {
43
+ super.renderBody(container);
44
+ this.tree = this.instantiationService.createInstance(WorkbenchObjectTree, 'notebookVariablesTree', container, ( new NotebookVariablesDelegate()), [( new NotebookVariableRenderer())], {
45
+ identityProvider: { getId: (e) => e.id },
46
+ horizontalScrolling: false,
47
+ supportDynamicHeights: true,
48
+ hideTwistiesOfChildlessElements: true,
49
+ accessibilityProvider: ( new NotebookVariableAccessibilityProvider()),
50
+ setRowLineHeight: false,
51
+ });
52
+ this.tree.layout();
53
+ this.tree?.setChildren(null, []);
54
+ }
55
+ layoutBody(height, width) {
56
+ super.layoutBody(height, width);
57
+ this.tree?.layout(height, width);
58
+ }
59
+ handleActiveEditorChange() {
60
+ const activeEditorPane = this.editorService.activeEditorPane;
61
+ if (activeEditorPane && activeEditorPane.getId() === 'workbench.editor.notebook') {
62
+ const notebookDocument = getNotebookEditorFromEditorPane(activeEditorPane)?.getViewModel()?.notebookDocument;
63
+ if (notebookDocument && notebookDocument !== this.activeNotebook) {
64
+ this.activeNotebook = notebookDocument;
65
+ this.updateVariables(this.activeNotebook);
66
+ }
67
+ }
68
+ }
69
+ handleExecutionStateChange(event) {
70
+ if (this.activeNotebook) {
71
+ if (event.changed === undefined && event.affectsNotebook(this.activeNotebook?.uri)) {
72
+ this.updateVariables(this.activeNotebook);
73
+ }
74
+ }
75
+ }
76
+ handleVariablesChanged(notebookUri) {
77
+ if (this.activeNotebook && ( notebookUri.toString()) === ( this.activeNotebook.uri.toString())) {
78
+ this.updateVariables(this.activeNotebook);
79
+ }
80
+ }
81
+ async updateVariables(notebook) {
82
+ const selectedKernel = this.notebookKernelService.getMatchingKernel(notebook).selected;
83
+ if (selectedKernel && selectedKernel.hasVariableProvider) {
84
+ const variables = selectedKernel.provideVariables(notebook.uri, undefined, 'named', 0, CancellationToken.None);
85
+ const treeData = await ( variables
86
+ .map(variable => { return this.createTreeItem(variable); }))
87
+ .toPromise();
88
+ this.tree?.setChildren(null, treeData);
89
+ }
90
+ }
91
+ createTreeItem(variable) {
92
+ let collapsed = undefined;
93
+ let children = undefined;
94
+ if (variable.namedChildrenCount > 0 || variable.indexedChildrenCount > 0) {
95
+ collapsed = true;
96
+ children = [
97
+ {
98
+ element: {
99
+ id: `${this.index + 1}-placeholder`,
100
+ label: ' ',
101
+ value: 'loading...',
102
+ }
103
+ }
104
+ ];
105
+ }
106
+ const element = {
107
+ element: {
108
+ id: `${this.index++}`,
109
+ label: variable.variable.name,
110
+ value: variable.variable.value,
111
+ },
112
+ children,
113
+ collapsed
114
+ };
115
+ return element;
116
+ }
117
+ };
118
+ NotebookVariablesView = ( __decorate([
119
+ ( __param(1, IEditorService)),
120
+ ( __param(2, INotebookKernelService)),
121
+ ( __param(3, INotebookExecutionStateService)),
122
+ ( __param(4, IKeybindingService)),
123
+ ( __param(5, IContextMenuService)),
124
+ ( __param(6, IContextKeyService)),
125
+ ( __param(7, IConfigurationService)),
126
+ ( __param(8, IInstantiationService)),
127
+ ( __param(9, IViewDescriptorService)),
128
+ ( __param(10, IOpenerService)),
129
+ ( __param(11, IQuickInputService)),
130
+ ( __param(12, ICommandService)),
131
+ ( __param(13, IThemeService)),
132
+ ( __param(14, ITelemetryService))
133
+ ], NotebookVariablesView));
134
+
135
+ export { NotebookVariablesView };