@codingame/monaco-vscode-notebook-service-override 3.2.2 → 4.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 (35) hide show
  1. package/notebook.js +1 -1
  2. package/override/vs/platform/dialogs/common/dialogs.js +2 -0
  3. package/package.json +2 -2
  4. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +9 -7
  5. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +61 -5
  6. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +11 -1
  7. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +3 -3
  8. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +9 -7
  9. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +1 -0
  10. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +3 -1
  11. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +293 -20
  12. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +16 -10
  13. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +107 -20
  14. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +15 -1
  15. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +1 -1
  16. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +48 -0
  17. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +199 -0
  18. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +2 -0
  19. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +7 -7
  20. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +7 -0
  21. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +47 -26
  22. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +6 -4
  23. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +11 -1
  24. package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +20 -7
  25. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibility.js +1 -1
  26. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +1 -0
  27. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +1 -1
  28. package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +15 -5
  29. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +54 -55
  30. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +3 -2
  31. package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +11 -1
  32. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +0 -608
  33. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.js +0 -31
  34. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatController.js +0 -744
  35. package/vscode/src/vs/workbench/contrib/search/browser/notebookSearch/notebookSearchService.js +0 -237
@@ -1,4 +1,5 @@
1
1
  import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
2
+ import { KeyChord } from 'vscode/vscode/vs/base/common/keyCodes';
2
3
  import { EditorContextKeys } from 'vscode/vscode/vs/editor/common/editorContextKeys';
3
4
  import { localize2WithPath, localizeWithPath } from 'vscode/vscode/vs/nls';
4
5
  import { CONTEXT_ACCESSIBILITY_MODE_ENABLED } from 'vscode/vscode/vs/platform/accessibility/common/accessibility';
@@ -6,12 +7,12 @@ import { registerAction2, MenuId, MenuRegistry } from 'vscode/vscode/vs/platform
6
7
  import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
7
8
  import { InputFocusedContextKey } from 'vscode/vscode/vs/platform/contextkey/common/contextkeys';
8
9
  import { CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_INNER_CURSOR_FIRST, CTX_INLINE_CHAT_INNER_CURSOR_LAST, CTX_INLINE_CHAT_RESPONSE_TYPES, CTX_INLINE_CHAT_LAST_RESPONSE_TYPE, CTX_INLINE_CHAT_HAS_PROVIDER } from 'vscode/vscode/vs/workbench/contrib/inlineChat/common/inlineChat';
9
- import { CTX_NOTEBOOK_CELL_CHAT_FOCUSED, MENU_CELL_CHAT_INPUT, CTX_NOTEBOOK_CHAT_HAS_ACTIVE_REQUEST, MENU_CELL_CHAT_WIDGET, CTX_NOTEBOOK_CHAT_USER_DID_EDIT, CTX_NOTEBOOK_CHAT_OUTER_FOCUS_POSITION, MENU_CELL_CHAT_WIDGET_STATUS, MENU_CELL_CHAT_WIDGET_FEEDBACK } from './notebookChatContext.js';
10
- import { NotebookChatController } from './notebookChatController.js';
11
- import { NotebookAction, NotebookCellAction, getEditorFromArgsOrActivePane } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/coreActions';
10
+ import { CTX_NOTEBOOK_CELL_CHAT_FOCUSED, MENU_CELL_CHAT_INPUT, CTX_NOTEBOOK_CHAT_HAS_ACTIVE_REQUEST, MENU_CELL_CHAT_WIDGET, CTX_NOTEBOOK_CHAT_USER_DID_EDIT, CTX_NOTEBOOK_CHAT_OUTER_FOCUS_POSITION, MENU_CELL_CHAT_WIDGET_STATUS, MENU_CELL_CHAT_WIDGET_FEEDBACK } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext';
11
+ import { NotebookChatController } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatController';
12
+ import { NotebookAction, NotebookCellAction, getEditorFromArgsOrActivePane, CELL_TITLE_CELL_GROUP_ID } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/coreActions';
12
13
  import { CellEditState } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
13
14
  import { CellKind, NOTEBOOK_EDITOR_CURSOR_BOUNDARY, NotebookSetting } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
14
- import { NOTEBOOK_EDITOR_FOCUSED, NOTEBOOK_EDITOR_EDITABLE } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
15
+ import { NOTEBOOK_CELL_EDITOR_FOCUSED, NOTEBOOK_EDITOR_FOCUSED, NOTEBOOK_EDITOR_EDITABLE, NOTEBOOK_CELL_GENERATED_BY_CHAT } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
15
16
 
16
17
  registerAction2(class extends NotebookAction {
17
18
  constructor() {
@@ -24,13 +25,13 @@ registerAction2(class extends NotebookAction {
24
25
  )),
25
26
  icon: Codicon.send,
26
27
  keybinding: {
27
- when: ( ContextKeyExpr.and(CTX_NOTEBOOK_CELL_CHAT_FOCUSED, CTX_INLINE_CHAT_FOCUSED)),
28
- weight: 0 + 7,
28
+ when: ( ContextKeyExpr.and(CTX_NOTEBOOK_CELL_CHAT_FOCUSED, CTX_INLINE_CHAT_FOCUSED, ( NOTEBOOK_CELL_EDITOR_FOCUSED.negate()))),
29
+ weight: 200 ,
29
30
  primary: 3
30
31
  },
31
32
  menu: {
32
33
  id: MENU_CELL_CHAT_INPUT,
33
- group: 'main',
34
+ group: 'navigation',
34
35
  order: 1,
35
36
  when: ( CTX_NOTEBOOK_CHAT_HAS_ACTIVE_REQUEST.negate())
36
37
  }
@@ -54,6 +55,7 @@ registerAction2(class extends NotebookCellAction {
54
55
  CTX_NOTEBOOK_CELL_CHAT_FOCUSED,
55
56
  CTX_INLINE_CHAT_FOCUSED,
56
57
  CTX_INLINE_CHAT_INNER_CURSOR_FIRST,
58
+ ( NOTEBOOK_CELL_EDITOR_FOCUSED.negate()),
57
59
  ( CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate())
58
60
  )),
59
61
  weight: 0 + 7,
@@ -91,6 +93,7 @@ registerAction2(class extends NotebookAction {
91
93
  CTX_NOTEBOOK_CELL_CHAT_FOCUSED,
92
94
  CTX_INLINE_CHAT_FOCUSED,
93
95
  CTX_INLINE_CHAT_INNER_CURSOR_LAST,
96
+ ( NOTEBOOK_CELL_EDITOR_FOCUSED.negate()),
94
97
  ( CONTEXT_ACCESSIBILITY_MODE_ENABLED.negate())
95
98
  )),
96
99
  weight: 0 + 7,
@@ -156,7 +159,7 @@ registerAction2(class extends NotebookAction {
156
159
  icon: Codicon.debugStop,
157
160
  menu: {
158
161
  id: MENU_CELL_CHAT_INPUT,
159
- group: 'main',
162
+ group: 'navigation',
160
163
  order: 1,
161
164
  when: CTX_NOTEBOOK_CHAT_HAS_ACTIVE_REQUEST
162
165
  }
@@ -178,13 +181,13 @@ registerAction2(class extends NotebookAction {
178
181
  icon: Codicon.close,
179
182
  menu: {
180
183
  id: MENU_CELL_CHAT_WIDGET,
181
- group: 'main',
184
+ group: 'navigation',
182
185
  order: 2
183
186
  }
184
187
  });
185
188
  }
186
189
  async runWithContext(accessor, context) {
187
- NotebookChatController.get(context.notebookEditor)?.dismiss();
190
+ NotebookChatController.get(context.notebookEditor)?.dismiss(false);
188
191
  }
189
192
  });
190
193
  registerAction2(class extends NotebookAction {
@@ -209,7 +212,7 @@ registerAction2(class extends NotebookAction {
209
212
  )),
210
213
  keybinding: [
211
214
  {
212
- when: ( ContextKeyExpr.and(CTX_NOTEBOOK_CELL_CHAT_FOCUSED, CTX_INLINE_CHAT_FOCUSED)),
215
+ when: ( ContextKeyExpr.and(CTX_NOTEBOOK_CELL_CHAT_FOCUSED, CTX_INLINE_CHAT_FOCUSED, ( NOTEBOOK_CELL_EDITOR_FOCUSED.negate()))),
213
216
  weight: 100 + 10,
214
217
  primary: 2048 | 3 ,
215
218
  },
@@ -217,7 +220,8 @@ registerAction2(class extends NotebookAction {
217
220
  when: ( ContextKeyExpr.and(
218
221
  CTX_NOTEBOOK_CELL_CHAT_FOCUSED,
219
222
  CTX_INLINE_CHAT_FOCUSED,
220
- CTX_NOTEBOOK_CHAT_USER_DID_EDIT
223
+ CTX_NOTEBOOK_CHAT_USER_DID_EDIT,
224
+ ( NOTEBOOK_CELL_EDITOR_FOCUSED.negate())
221
225
  )),
222
226
  weight: 0 + 10,
223
227
  primary: 9
@@ -226,6 +230,7 @@ registerAction2(class extends NotebookAction {
226
230
  when: ( ContextKeyExpr.and(
227
231
  NOTEBOOK_EDITOR_FOCUSED,
228
232
  ContextKeyExpr.not(InputFocusedContextKey),
233
+ ( NOTEBOOK_CELL_EDITOR_FOCUSED.negate()),
229
234
  ( CTX_NOTEBOOK_CHAT_OUTER_FOCUS_POSITION.isEqualTo('below'))
230
235
  )),
231
236
  primary: 2048 | 3 ,
@@ -257,7 +262,7 @@ registerAction2(class extends NotebookAction {
257
262
  )),
258
263
  icon: Codicon.discard,
259
264
  keybinding: {
260
- when: ( ContextKeyExpr.and(CTX_NOTEBOOK_CELL_CHAT_FOCUSED, CTX_INLINE_CHAT_FOCUSED, ( CTX_NOTEBOOK_CHAT_USER_DID_EDIT.negate()))),
265
+ when: ( ContextKeyExpr.and(CTX_NOTEBOOK_CELL_CHAT_FOCUSED, CTX_INLINE_CHAT_FOCUSED, ( CTX_NOTEBOOK_CHAT_USER_DID_EDIT.negate()), ( NOTEBOOK_CELL_EDITOR_FOCUSED.negate()))),
261
266
  weight: 100 ,
262
267
  primary: 9
263
268
  },
@@ -341,7 +346,7 @@ registerAction2(class extends NotebookAction {
341
346
  registerAction2(class extends NotebookAction {
342
347
  constructor() {
343
348
  super({
344
- id: 'notebook.cell.insertCodeCellWithChat',
349
+ id: 'notebook.cell.chat.start',
345
350
  title: {
346
351
  value: '$(sparkle) ' + ( localizeWithPath(
347
352
  'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
@@ -353,13 +358,13 @@ registerAction2(class extends NotebookAction {
353
358
  tooltip: ( localizeWithPath(
354
359
  'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
355
360
  'notebookActions.menu.insertCodeCellWithChat.tooltip',
356
- "Generate Code Cell with Chat"
361
+ "Start Chat to Generate Code"
357
362
  )),
358
363
  metadata: {
359
364
  description: ( localizeWithPath(
360
365
  'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
361
366
  'notebookActions.menu.insertCodeCellWithChat.tooltip',
362
- "Generate Code Cell with Chat"
367
+ "Start Chat to Generate Code"
363
368
  )),
364
369
  args: [
365
370
  {
@@ -383,6 +388,12 @@ registerAction2(class extends NotebookAction {
383
388
  ]
384
389
  },
385
390
  f1: false,
391
+ keybinding: {
392
+ when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ( NOTEBOOK_EDITOR_EDITABLE.isEqualTo(true)), ContextKeyExpr.not(InputFocusedContextKey), CTX_INLINE_CHAT_HAS_PROVIDER, ( ContextKeyExpr.equals(`config.${NotebookSetting.cellChat}`, true)))),
393
+ weight: 200 ,
394
+ primary: 2048 | 39 ,
395
+ secondary: [KeyChord(2048 | 41 , 39 )],
396
+ },
386
397
  menu: [
387
398
  {
388
399
  id: MenuId.NotebookCellBetween,
@@ -435,7 +446,7 @@ registerAction2(class extends NotebookAction {
435
446
  registerAction2(class extends NotebookAction {
436
447
  constructor() {
437
448
  super({
438
- id: 'notebook.cell.insertCodeCellWithChatAtTop',
449
+ id: 'notebook.cell.chat.startAtTop',
439
450
  title: {
440
451
  value: '$(sparkle) ' + ( localizeWithPath(
441
452
  'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
@@ -447,7 +458,7 @@ registerAction2(class extends NotebookAction {
447
458
  tooltip: ( localizeWithPath(
448
459
  'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
449
460
  'notebookActions.menu.insertCodeCellWithChat.tooltip',
450
- "Generate Code Cell with Chat"
461
+ "Start Chat to Generate Code"
451
462
  )),
452
463
  f1: false,
453
464
  menu: [
@@ -467,7 +478,7 @@ registerAction2(class extends NotebookAction {
467
478
  });
468
479
  MenuRegistry.appendMenuItem(MenuId.NotebookToolbar, {
469
480
  command: {
470
- id: 'notebook.cell.insertCodeCellWithChat',
481
+ id: 'notebook.cell.chat.start',
471
482
  icon: Codicon.sparkle,
472
483
  title: ( localizeWithPath(
473
484
  'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
@@ -477,7 +488,7 @@ MenuRegistry.appendMenuItem(MenuId.NotebookToolbar, {
477
488
  tooltip: ( localizeWithPath(
478
489
  'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
479
490
  'notebookActions.menu.insertCode.tooltip',
480
- "Generate Code Cell with Chat"
491
+ "Start Chat to Generate Code"
481
492
  ))
482
493
  },
483
494
  order: -10,
@@ -563,3 +574,79 @@ registerAction2(class extends NotebookAction {
563
574
  NotebookChatController.get(context.notebookEditor)?.focusAbove();
564
575
  }
565
576
  });
577
+ registerAction2(class extends NotebookAction {
578
+ constructor() {
579
+ super({
580
+ id: 'notebook.cell.chat.previousFromHistory',
581
+ title: ( localize2WithPath(
582
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
583
+ 'notebook.cell.chat.previousFromHistory',
584
+ "Previous From History"
585
+ )),
586
+ precondition: ( ContextKeyExpr.and(CTX_NOTEBOOK_CELL_CHAT_FOCUSED, CTX_INLINE_CHAT_FOCUSED)),
587
+ keybinding: {
588
+ when: ( ContextKeyExpr.and(CTX_NOTEBOOK_CELL_CHAT_FOCUSED, CTX_INLINE_CHAT_FOCUSED)),
589
+ weight: 0 + 10,
590
+ primary: 16 ,
591
+ }
592
+ });
593
+ }
594
+ async runWithContext(accessor, context) {
595
+ NotebookChatController.get(context.notebookEditor)?.populateHistory(true);
596
+ }
597
+ });
598
+ registerAction2(class extends NotebookAction {
599
+ constructor() {
600
+ super({
601
+ id: 'notebook.cell.chat.nextFromHistory',
602
+ title: ( localize2WithPath(
603
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
604
+ 'notebook.cell.chat.nextFromHistory',
605
+ "Next From History"
606
+ )),
607
+ precondition: ( ContextKeyExpr.and(CTX_NOTEBOOK_CELL_CHAT_FOCUSED, CTX_INLINE_CHAT_FOCUSED)),
608
+ keybinding: {
609
+ when: ( ContextKeyExpr.and(CTX_NOTEBOOK_CELL_CHAT_FOCUSED, CTX_INLINE_CHAT_FOCUSED)),
610
+ weight: 0 + 10,
611
+ primary: 18
612
+ }
613
+ });
614
+ }
615
+ async runWithContext(accessor, context) {
616
+ NotebookChatController.get(context.notebookEditor)?.populateHistory(false);
617
+ }
618
+ });
619
+ registerAction2(class extends NotebookCellAction {
620
+ constructor() {
621
+ super({
622
+ id: 'notebook.cell.chat.restore',
623
+ title: ( localize2WithPath(
624
+ 'vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions',
625
+ 'notebookActions.restoreCellprompt',
626
+ "Generate"
627
+ )),
628
+ icon: Codicon.sparkle,
629
+ menu: {
630
+ id: MenuId.NotebookCellTitle,
631
+ group: CELL_TITLE_CELL_GROUP_ID,
632
+ order: 0,
633
+ when: ( ContextKeyExpr.and(( NOTEBOOK_EDITOR_EDITABLE.isEqualTo(true)), CTX_INLINE_CHAT_HAS_PROVIDER, NOTEBOOK_CELL_GENERATED_BY_CHAT, ( ContextKeyExpr.equals(`config.${NotebookSetting.cellChat}`, true))))
634
+ }
635
+ });
636
+ }
637
+ async runWithContext(accessor, context) {
638
+ const cell = context.cell;
639
+ if (!cell) {
640
+ return;
641
+ }
642
+ const notebookEditor = context.notebookEditor;
643
+ const controller = NotebookChatController.get(notebookEditor);
644
+ if (!controller) {
645
+ return;
646
+ }
647
+ const prompt = controller.getPromptFromCache(cell);
648
+ if (prompt) {
649
+ controller.restore(cell, prompt);
650
+ }
651
+ }
652
+ });
@@ -10,6 +10,8 @@ import { IDebugService } from 'vscode/vscode/vs/workbench/contrib/debug/common/d
10
10
  import { InlineChatController } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatController';
11
11
  import { CTX_INLINE_CHAT_FOCUSED } from 'vscode/vscode/vs/workbench/contrib/inlineChat/common/inlineChat';
12
12
  import { insertCell } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/cellOperations';
13
+ import { CTX_NOTEBOOK_CELL_CHAT_FOCUSED } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext';
14
+ import { NotebookChatController } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatController';
13
15
  import { NotebookAction, executeNotebookCondition, getContextFromUri, getContextFromActiveEditor, NotebookMultiCellAction, NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT, cellExecutionArgs, parseMultiCellExecutionArgs, CELL_TITLE_CELL_GROUP_ID, NotebookCellAction } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/coreActions';
14
16
  import { EXECUTE_CELL_COMMAND_ID, ScrollToRevealBehavior, CellEditState, CellFocusMode } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
15
17
  import { executeAllIcon, executeIcon, executeAboveIcon, executeBelowIcon, stopIcon, executingStateIcon, errorStateIcon } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookIcons';
@@ -165,7 +167,7 @@ registerAction2(class ExecuteCell extends NotebookMultiCellAction {
165
167
  "Execute Cell"
166
168
  )),
167
169
  keybinding: {
168
- when: NOTEBOOK_CELL_LIST_FOCUSED,
170
+ when: ( ContextKeyExpr.or(NOTEBOOK_CELL_LIST_FOCUSED, ( ContextKeyExpr.and(CTX_NOTEBOOK_CELL_CHAT_FOCUSED, CTX_INLINE_CHAT_FOCUSED)))),
169
171
  primary: 256 | 3 ,
170
172
  win: {
171
173
  primary: 2048 | 512 | 3
@@ -196,6 +198,18 @@ registerAction2(class ExecuteCell extends NotebookMultiCellAction {
196
198
  if (context.ui) {
197
199
  await context.notebookEditor.focusNotebookCell(context.cell, 'container', { skipReveal: true });
198
200
  }
201
+ const chatController = NotebookChatController.get(context.notebookEditor);
202
+ const editingCell = chatController?.getEditingCell();
203
+ if (chatController?.hasFocus() && editingCell) {
204
+ const group = editorGroupsService.activeGroup;
205
+ if (group) {
206
+ if (group.activeEditor) {
207
+ group.pinEditor(group.activeEditor);
208
+ }
209
+ }
210
+ await context.notebookEditor.executeNotebookCells([editingCell]);
211
+ return;
212
+ }
199
213
  await runCell(editorGroupsService, context);
200
214
  }
201
215
  });
@@ -8,7 +8,7 @@ import { insertCell } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/
8
8
  import { NotebookAction } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/coreActions';
9
9
  import { NOTEBOOK_CELL_LIST_FOCUSED, NOTEBOOK_EDITOR_EDITABLE } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
10
10
  import { CellKind, NotebookSetting } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
11
- import { CTX_NOTEBOOK_CHAT_OUTER_FOCUS_POSITION } from './chat/notebookChatContext.js';
11
+ import { CTX_NOTEBOOK_CHAT_OUTER_FOCUS_POSITION } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext';
12
12
 
13
13
  const INSERT_CODE_CELL_ABOVE_COMMAND_ID = 'notebook.cell.insertCodeCellAbove';
14
14
  const INSERT_CODE_CELL_BELOW_COMMAND_ID = 'notebook.cell.insertCodeCellBelow';
@@ -1,8 +1,10 @@
1
1
  import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
2
2
  import { URI } from 'vscode/vscode/vs/base/common/uri';
3
3
  import { localize2WithPath, localizeWithPath } from 'vscode/vscode/vs/nls';
4
+ import { Categories } from 'vscode/vscode/vs/platform/action/common/actionCommonCategories';
4
5
  import { registerAction2, Action2, MenuId, MenuRegistry } from 'vscode/vscode/vs/platform/actions/common/actions';
5
6
  import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands';
7
+ import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
6
8
  import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
7
9
  import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput';
8
10
  import { NOTEBOOK_ACTIONS_CATEGORY } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/coreActions';
@@ -265,3 +267,49 @@ registerAction2(class NotebookWebviewResetAction extends Action2 {
265
267
  }
266
268
  }
267
269
  });
270
+ registerAction2(class ToggleNotebookStickyScroll extends Action2 {
271
+ constructor() {
272
+ super({
273
+ id: 'notebook.action.toggleNotebookStickyScroll',
274
+ title: {
275
+ ...( localize2WithPath(
276
+ 'vs/workbench/contrib/notebook/browser/controller/layoutActions',
277
+ 'toggleStickyScroll',
278
+ "Toggle Notebook Sticky Scroll"
279
+ )),
280
+ mnemonicTitle: ( localizeWithPath(
281
+ 'vs/workbench/contrib/notebook/browser/controller/layoutActions',
282
+ { key: 'mitoggleNotebookStickyScroll', comment: ['&& denotes a mnemonic'] },
283
+ "&&Toggle Notebook Sticky Scroll"
284
+ )),
285
+ },
286
+ category: Categories.View,
287
+ toggled: {
288
+ condition: ( ContextKeyExpr.equals('config.notebook.stickyScroll.enabled', true)),
289
+ title: ( localizeWithPath(
290
+ 'vs/workbench/contrib/notebook/browser/controller/layoutActions',
291
+ 'notebookStickyScroll',
292
+ "Toggle Notebook Sticky Scroll"
293
+ )),
294
+ mnemonicTitle: ( localizeWithPath(
295
+ 'vs/workbench/contrib/notebook/browser/controller/layoutActions',
296
+ { key: 'mitoggleNotebookStickyScroll', comment: ['&& denotes a mnemonic'] },
297
+ "&&Toggle Notebook Sticky Scroll"
298
+ )),
299
+ },
300
+ menu: [
301
+ { id: MenuId.CommandPalette },
302
+ {
303
+ id: MenuId.NotebookStickyScrollContext,
304
+ group: 'notebookView',
305
+ order: 2
306
+ }
307
+ ]
308
+ });
309
+ }
310
+ async run(accessor) {
311
+ const configurationService = accessor.get(IConfigurationService);
312
+ const newValue = !configurationService.getValue('notebook.stickyScroll.enabled');
313
+ return configurationService.updateValue('notebook.stickyScroll.enabled', newValue);
314
+ }
315
+ });
@@ -0,0 +1,199 @@
1
+ import { localize2WithPath, localizeWithPath } from 'vscode/vscode/vs/nls';
2
+ import { registerAction2, Action2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
3
+ import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
4
+ import { NotebookOutlineContext } from '../contrib/outline/notebookOutline.js';
5
+ import { FoldingController } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/foldingController';
6
+ import { executeIcon } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookIcons';
7
+ import { CellKind } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
8
+
9
+ class NotebookRunSingleCellInSection extends Action2 {
10
+ constructor() {
11
+ super({
12
+ id: 'notebook.section.runSingleCell',
13
+ title: {
14
+ ...( localize2WithPath(
15
+ 'vs/workbench/contrib/notebook/browser/controller/sectionActions',
16
+ 'runCell',
17
+ "Run Cell"
18
+ )),
19
+ mnemonicTitle: ( localizeWithPath(
20
+ 'vs/workbench/contrib/notebook/browser/controller/sectionActions',
21
+ { key: 'mirunCell', comment: ['&& denotes a mnemonic'] },
22
+ "&&Run Cell"
23
+ )),
24
+ },
25
+ shortTitle: ( localizeWithPath(
26
+ 'vs/workbench/contrib/notebook/browser/controller/sectionActions',
27
+ 'runCell',
28
+ "Run Cell"
29
+ )),
30
+ icon: executeIcon,
31
+ menu: [
32
+ {
33
+ id: MenuId.NotebookOutlineActionMenu,
34
+ group: 'inline',
35
+ order: 1,
36
+ when: ( ContextKeyExpr.and(( NotebookOutlineContext.CellKind.isEqualTo(CellKind.Code)), ( NotebookOutlineContext.OutlineElementTarget.isEqualTo(1 )), ( NotebookOutlineContext.CellHasChildren.toNegated()), ( NotebookOutlineContext.CellHasHeader.toNegated())))
37
+ }
38
+ ]
39
+ });
40
+ }
41
+ async run(_accessor, context) {
42
+ if (!checkSectionContext(context)) {
43
+ return;
44
+ }
45
+ context.notebookEditor.executeNotebookCells([context.outlineEntry.cell]);
46
+ }
47
+ }
48
+ class NotebookRunCellsInSection extends Action2 {
49
+ constructor() {
50
+ super({
51
+ id: 'notebook.section.runCells',
52
+ title: {
53
+ ...( localize2WithPath(
54
+ 'vs/workbench/contrib/notebook/browser/controller/sectionActions',
55
+ 'runCellsInSection',
56
+ "Run Cells In Section"
57
+ )),
58
+ mnemonicTitle: ( localizeWithPath(
59
+ 'vs/workbench/contrib/notebook/browser/controller/sectionActions',
60
+ { key: 'mirunCellsInSection', comment: ['&& denotes a mnemonic'] },
61
+ "&&Run Cells In Section"
62
+ )),
63
+ },
64
+ shortTitle: ( localizeWithPath(
65
+ 'vs/workbench/contrib/notebook/browser/controller/sectionActions',
66
+ 'runCellsInSection',
67
+ "Run Cells In Section"
68
+ )),
69
+ menu: [
70
+ {
71
+ id: MenuId.NotebookStickyScrollContext,
72
+ group: 'notebookExecution',
73
+ order: 1
74
+ },
75
+ {
76
+ id: MenuId.NotebookOutlineActionMenu,
77
+ group: 'inline',
78
+ order: 1,
79
+ when: ( ContextKeyExpr.and(( NotebookOutlineContext.CellKind.isEqualTo(CellKind.Markup)), ( NotebookOutlineContext.OutlineElementTarget.isEqualTo(1 )), NotebookOutlineContext.CellHasChildren, NotebookOutlineContext.CellHasHeader))
80
+ }
81
+ ]
82
+ });
83
+ }
84
+ async run(_accessor, context) {
85
+ if (!checkSectionContext(context)) {
86
+ return;
87
+ }
88
+ const cell = context.outlineEntry.cell;
89
+ const idx = context.notebookEditor.getViewModel()?.getCellIndex(cell);
90
+ if (idx === undefined) {
91
+ return;
92
+ }
93
+ const length = context.notebookEditor.getViewModel()?.getFoldedLength(idx);
94
+ if (length === undefined) {
95
+ return;
96
+ }
97
+ const cells = context.notebookEditor.getCellsInRange({ start: idx, end: idx + length + 1 });
98
+ context.notebookEditor.executeNotebookCells(cells);
99
+ }
100
+ }
101
+ class NotebookFoldSection extends Action2 {
102
+ constructor() {
103
+ super({
104
+ id: 'notebook.section.foldSection',
105
+ title: {
106
+ ...( localize2WithPath(
107
+ 'vs/workbench/contrib/notebook/browser/controller/sectionActions',
108
+ 'foldSection',
109
+ "Fold Section"
110
+ )),
111
+ mnemonicTitle: ( localizeWithPath(
112
+ 'vs/workbench/contrib/notebook/browser/controller/sectionActions',
113
+ { key: 'mifoldSection', comment: ['&& denotes a mnemonic'] },
114
+ "&&Fold Section"
115
+ )),
116
+ },
117
+ shortTitle: ( localizeWithPath(
118
+ 'vs/workbench/contrib/notebook/browser/controller/sectionActions',
119
+ 'foldSection',
120
+ "Fold Section"
121
+ )),
122
+ menu: [
123
+ {
124
+ id: MenuId.NotebookOutlineActionMenu,
125
+ group: 'notebookFolding',
126
+ order: 2,
127
+ when: ( ContextKeyExpr.and(( NotebookOutlineContext.CellKind.isEqualTo(CellKind.Markup)), ( NotebookOutlineContext.OutlineElementTarget.isEqualTo(1 )), NotebookOutlineContext.CellHasChildren, NotebookOutlineContext.CellHasHeader, ( NotebookOutlineContext.CellFoldingState.isEqualTo(1 ))))
128
+ }
129
+ ]
130
+ });
131
+ }
132
+ async run(_accessor, context) {
133
+ if (!checkSectionContext(context)) {
134
+ return;
135
+ }
136
+ this.toggleFoldRange(context.outlineEntry, context.notebookEditor);
137
+ }
138
+ toggleFoldRange(entry, notebookEditor) {
139
+ const foldingController = notebookEditor.getContribution(FoldingController.id);
140
+ const index = entry.index;
141
+ const headerLevel = entry.level;
142
+ const newFoldingState = 2 ;
143
+ foldingController.setFoldingStateDown(index, newFoldingState, headerLevel);
144
+ }
145
+ }
146
+ class NotebookExpandSection extends Action2 {
147
+ constructor() {
148
+ super({
149
+ id: 'notebook.section.expandSection',
150
+ title: {
151
+ ...( localize2WithPath(
152
+ 'vs/workbench/contrib/notebook/browser/controller/sectionActions',
153
+ 'expandSection',
154
+ "Expand Section"
155
+ )),
156
+ mnemonicTitle: ( localizeWithPath(
157
+ 'vs/workbench/contrib/notebook/browser/controller/sectionActions',
158
+ { key: 'miexpandSection', comment: ['&& denotes a mnemonic'] },
159
+ "&&Expand Section"
160
+ )),
161
+ },
162
+ shortTitle: ( localizeWithPath(
163
+ 'vs/workbench/contrib/notebook/browser/controller/sectionActions',
164
+ 'expandSection',
165
+ "Expand Section"
166
+ )),
167
+ menu: [
168
+ {
169
+ id: MenuId.NotebookOutlineActionMenu,
170
+ group: 'notebookFolding',
171
+ order: 2,
172
+ when: ( ContextKeyExpr.and(( NotebookOutlineContext.CellKind.isEqualTo(CellKind.Markup)), ( NotebookOutlineContext.OutlineElementTarget.isEqualTo(1 )), NotebookOutlineContext.CellHasChildren, NotebookOutlineContext.CellHasHeader, ( NotebookOutlineContext.CellFoldingState.isEqualTo(2 ))))
173
+ }
174
+ ]
175
+ });
176
+ }
177
+ async run(_accessor, context) {
178
+ if (!checkSectionContext(context)) {
179
+ return;
180
+ }
181
+ this.toggleFoldRange(context.outlineEntry, context.notebookEditor);
182
+ }
183
+ toggleFoldRange(entry, notebookEditor) {
184
+ const foldingController = notebookEditor.getContribution(FoldingController.id);
185
+ const index = entry.index;
186
+ const headerLevel = entry.level;
187
+ const newFoldingState = 1 ;
188
+ foldingController.setFoldingStateDown(index, newFoldingState, headerLevel);
189
+ }
190
+ }
191
+ function checkSectionContext(context) {
192
+ return !!(context && context.notebookEditor && context.outlineEntry);
193
+ }
194
+ registerAction2(NotebookRunSingleCellInSection);
195
+ registerAction2(NotebookRunCellsInSection);
196
+ registerAction2(NotebookFoldSection);
197
+ registerAction2(NotebookExpandSection);
198
+
199
+ export { NotebookExpandSection, NotebookFoldSection, NotebookRunCellsInSection, NotebookRunSingleCellInSection };
@@ -40,6 +40,8 @@ const fixedDiffEditorOptions = {
40
40
  wordWrap: 'off',
41
41
  diffWordWrap: 'off',
42
42
  diffAlgorithm: 'advanced',
43
+ renderSideBySide: true,
44
+ useInlineViewWhenSpaceIsLimited: false
43
45
  };
44
46
 
45
47
  export { fixedDiffEditorOptions, fixedEditorOptions, fixedEditorPadding };
@@ -1,16 +1,16 @@
1
1
  import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
2
- import { scheduleAtNextAnimationFrame, getWindow, append, $, reset } from 'vscode/vscode/vs/base/browser/dom';
2
+ import { append, $, reset, scheduleAtNextAnimationFrame, getWindow } from 'vscode/vscode/vs/base/browser/dom';
3
3
  import { Disposable, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
4
4
  import { Schemas } from 'vscode/vscode/vs/base/common/network';
5
5
  import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
6
- import { outputEqual, OUTPUT_EDITOR_HEIGHT_MAGIC, PropertyFoldingState, SideBySideDiffElementViewModel, getFormattedMetadataJSON, getFormattedOutputJSON } from './diffElementViewModel.js';
7
- import { DIFF_CELL_MARGIN, DiffSide, NOTEBOOK_DIFF_CELL_INPUT, NOTEBOOK_DIFF_CELL_PROPERTY, NOTEBOOK_DIFF_CELL_PROPERTY_EXPANDED } from './notebookDiffEditorBrowser.js';
8
- import { CodeEditorWidget } from 'vscode/vscode/vs/editor/browser/widget/codeEditorWidget';
6
+ import { PropertyFoldingState, outputEqual, OUTPUT_EDITOR_HEIGHT_MAGIC, SideBySideDiffElementViewModel, getFormattedMetadataJSON, getFormattedOutputJSON } from './diffElementViewModel.js';
7
+ import { NOTEBOOK_DIFF_CELL_PROPERTY, NOTEBOOK_DIFF_CELL_PROPERTY_EXPANDED, DIFF_CELL_MARGIN, DiffSide, NOTEBOOK_DIFF_CELL_INPUT } from './notebookDiffEditorBrowser.js';
8
+ import { CodeEditorWidget } from 'vscode/vscode/vs/editor/browser/widget/codeEditor/codeEditorWidget';
9
9
  import { IModelService } from 'vscode/vscode/vs/editor/common/services/model';
10
10
  import { ILanguageService } from 'vscode/vscode/vs/editor/common/languages/language';
11
11
  import { CellUri } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
12
12
  import { IContextMenuService } from 'vscode/vscode/vs/platform/contextview/browser/contextView';
13
- import { MenuId, MenuItemAction, IMenuService } from 'vscode/vscode/vs/platform/actions/common/actions';
13
+ import { MenuItemAction, IMenuService, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
14
14
  import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
15
15
  import { INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification';
16
16
  import { createAndFillInActionBarActions } from 'vscode/vscode/vs/platform/actions/browser/menuEntryActionViewItem';
@@ -87,11 +87,11 @@ let PropertyHeader = class PropertyHeader extends Disposable {
87
87
  }
88
88
  const cellToolbarContainer = append(this.propertyHeaderContainer, $('div.property-toolbar'));
89
89
  this._toolbar = ( new WorkbenchToolBar(cellToolbarContainer, {
90
- actionViewItemProvider: action => {
90
+ actionViewItemProvider: (action, options) => {
91
91
  if (action instanceof MenuItemAction) {
92
92
  const item = ( new CodiconActionViewItem(
93
93
  action,
94
- undefined,
94
+ { hoverDelegate: options.hoverDelegate },
95
95
  this.keybindingService,
96
96
  this.notificationService,
97
97
  this.contextKeyService,
@@ -39,6 +39,12 @@ let DiffNestedCellViewModel = class DiffNestedCellViewModel extends Disposable {
39
39
  this._focusOnOutput = v;
40
40
  this._onDidChangeState.fire({ outputIsFocusedChanged: true });
41
41
  }
42
+ get inputInOutputIsFocused() {
43
+ return this._focusInputInOutput;
44
+ }
45
+ set inputInOutputIsFocused(v) {
46
+ this._focusInputInOutput = v;
47
+ }
42
48
  get outputsViewModels() {
43
49
  return this._outputViewModels;
44
50
  }
@@ -49,6 +55,7 @@ let DiffNestedCellViewModel = class DiffNestedCellViewModel extends Disposable {
49
55
  this._onDidChangeState = this._register(( new Emitter()));
50
56
  this._hoveringOutput = false;
51
57
  this._focusOnOutput = false;
58
+ this._focusInputInOutput = false;
52
59
  this._outputCollection = [];
53
60
  this._outputsTop = null;
54
61
  this._onDidChangeOutputLayout = this._register(( new Emitter()));