@codingame/monaco-vscode-interactive-service-override 5.3.0 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-interactive-service-override",
3
- "version": "5.3.0",
3
+ "version": "6.0.0",
4
4
  "keywords": [],
5
5
  "author": {
6
6
  "name": "CodinGame",
@@ -26,6 +26,6 @@
26
26
  }
27
27
  },
28
28
  "dependencies": {
29
- "vscode": "npm:@codingame/monaco-vscode-api@5.3.0"
29
+ "vscode": "npm:@codingame/monaco-vscode-api@6.0.0"
30
30
  }
31
31
  }
@@ -1,5 +1,6 @@
1
1
  import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
2
2
  import { Iterable } from 'vscode/vscode/vs/base/common/iterator';
3
+ import { KeyMod, KeyCode } from 'vscode/vscode/vs/base/common/keyCodes';
3
4
  import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
4
5
  import { parse } from 'vscode/vscode/vs/base/common/marshalling';
5
6
  import { Schemas } from 'vscode/vscode/vs/base/common/network';
@@ -20,7 +21,9 @@ import { Extensions } from 'vscode/vscode/vs/platform/configuration/common/confi
20
21
  import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
21
22
  import { EditorActivation } from 'vscode/vscode/vs/platform/editor/common/editor';
22
23
  import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
24
+ import 'vscode/vscode/vs/platform/instantiation/common/extensions';
23
25
  import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
26
+ import { KeybindingWeight } from 'vscode/vscode/vs/platform/keybinding/common/keybindingsRegistry';
24
27
  import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
25
28
  import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
26
29
  import { registerColor, ifDefinedThenElse } from 'vscode/vscode/vs/platform/theme/common/colorUtils';
@@ -35,8 +38,8 @@ import 'vscode/vscode/vs/platform/theme/common/colors/miscColors';
35
38
  import 'vscode/vscode/vs/platform/theme/common/colors/quickpickColors';
36
39
  import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
37
40
  import { EditorPaneDescriptor } from 'vscode/vscode/vs/workbench/browser/editor';
38
- import { registerWorkbenchContribution2 } from 'vscode/vscode/vs/workbench/common/contributions';
39
- import { EditorExtensions } from 'vscode/vscode/vs/workbench/common/editor';
41
+ import { registerWorkbenchContribution2, WorkbenchPhase } from 'vscode/vscode/vs/workbench/common/contributions';
42
+ import { EditorExtensions, EditorsOrder } from 'vscode/vscode/vs/workbench/common/editor';
40
43
  import { PANEL_BORDER } from 'vscode/vscode/vs/workbench/common/theme';
41
44
  import { ResourceNotebookCellEdit } from 'vscode/vscode/vs/workbench/contrib/bulkEdit/browser/bulkCellEdits';
42
45
  import { INTERACTIVE_INPUT_CURSOR_BOUNDARY, InteractiveWindowSetting } from './interactiveCommon.js';
@@ -48,7 +51,7 @@ import { IInteractiveHistoryService } from 'vscode/vscode/vs/workbench/contrib/i
48
51
  import { NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/coreActions';
49
52
  import { executeIcon } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookIcons';
50
53
  import { INotebookEditorService } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/services/notebookEditorService.service';
51
- import { INTERACTIVE_WINDOW_EDITOR_ID, CellUri, NotebookWorkingCopyTypeIdentifier, CellKind, NotebookSetting } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
54
+ import { INTERACTIVE_WINDOW_EDITOR_ID, CellUri, NotebookWorkingCopyTypeIdentifier, CellEditType, CellKind, NotebookSetting } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
52
55
  import { InteractiveWindowOpen } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
53
56
  import { INotebookKernelService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookKernelService.service';
54
57
  import { INotebookService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookService.service';
@@ -88,7 +91,7 @@ let InteractiveDocumentContribution = class InteractiveDocumentContribution exte
88
91
  singlePerResource: true
89
92
  }, {
90
93
  createEditorInput: ({ resource }) => {
91
- const editorInput = editorService.getEditors(1 ).find(editor => editor.editor instanceof InteractiveEditorInput && ( (editor.editor.inputResource.toString())) === ( (resource.toString())));
94
+ const editorInput = editorService.getEditors(EditorsOrder.SEQUENTIAL).find(editor => editor.editor instanceof InteractiveEditorInput && ( (editor.editor.inputResource.toString())) === ( (resource.toString())));
92
95
  return editorInput;
93
96
  }
94
97
  });
@@ -205,7 +208,7 @@ InteractiveWindowWorkingCopyEditorHandler = ( (__decorate([
205
208
  ( (__param(1, IWorkingCopyEditorService))),
206
209
  ( (__param(2, IExtensionService)))
207
210
  ], InteractiveWindowWorkingCopyEditorHandler)));
208
- registerWorkbenchContribution2(InteractiveDocumentContribution.ID, InteractiveDocumentContribution, 2 );
211
+ registerWorkbenchContribution2(InteractiveDocumentContribution.ID, InteractiveDocumentContribution, WorkbenchPhase.BlockRestore);
209
212
  registerWorkbenchContribution2(InteractiveInputContentProvider.ID, InteractiveInputContentProvider, {
210
213
  editorTypeId: INTERACTIVE_WINDOW_EDITOR_ID
211
214
  });
@@ -322,7 +325,7 @@ registerAction2(class extends Action2 {
322
325
  }
323
326
  }
324
327
  const existingNotebookDocument = ( (new Set()));
325
- editorService.getEditors(1 ).forEach(editor => {
328
+ editorService.getEditors(EditorsOrder.SEQUENTIAL).forEach(editor => {
326
329
  if (editor.editor.resource) {
327
330
  existingNotebookDocument.add(( (editor.editor.resource.toString())));
328
331
  }
@@ -360,14 +363,28 @@ registerAction2(class extends Action2 {
360
363
  id: 'interactive.execute',
361
364
  title: ( localize2WithPath(_moduleId, 2, 'Execute Code')),
362
365
  category: interactiveWindowCategory,
363
- keybinding: {
364
- when: ( (ContextKeyExpr.equals('activeEditor', 'workbench.editor.interactive'))),
365
- primary: 256 | 3 ,
366
- win: {
367
- primary: 2048 | 3
368
- },
369
- weight: NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT
370
- },
366
+ keybinding: [{
367
+ when: ( (ContextKeyExpr.and(
368
+ (ContextKeyExpr.equals('activeEditor', 'workbench.editor.interactive')),
369
+ (ContextKeyExpr.equals('config.interactiveWindow.executeWithShiftEnter', true))
370
+ ))),
371
+ primary: KeyMod.Shift | KeyCode.Enter,
372
+ weight: NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT
373
+ }, {
374
+ when: ( (ContextKeyExpr.and(
375
+ (ContextKeyExpr.equals('activeEditor', 'workbench.editor.interactive')),
376
+ (ContextKeyExpr.equals('config.interactiveWindow.executeWithShiftEnter', false))
377
+ ))),
378
+ primary: KeyCode.Enter,
379
+ weight: NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT
380
+ }, {
381
+ when: ( (ContextKeyExpr.equals('activeEditor', 'workbench.editor.interactive'))),
382
+ primary: KeyMod.WinCtrl | KeyCode.Enter,
383
+ win: {
384
+ primary: KeyMod.CtrlCmd | KeyCode.Enter
385
+ },
386
+ weight: NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT
387
+ }],
371
388
  menu: [
372
389
  {
373
390
  id: MenuId.InteractiveInputExecute
@@ -428,7 +445,7 @@ registerAction2(class extends Action2 {
428
445
  undefined;
429
446
  await bulkEditService.apply([
430
447
  ( (new ResourceNotebookCellEdit(notebookDocument.uri, {
431
- editType: 1 ,
448
+ editType: CellEditType.Replace,
432
449
  index: index,
433
450
  count: 0,
434
451
  cells: [{
@@ -490,8 +507,8 @@ registerAction2(class extends Action2 {
490
507
  (INTERACTIVE_INPUT_CURSOR_BOUNDARY.notEqualsTo('none')),
491
508
  (Context.Visible.toNegated())
492
509
  ))),
493
- primary: 16 ,
494
- weight: 200
510
+ primary: KeyCode.UpArrow,
511
+ weight: KeybindingWeight.WorkbenchContrib
495
512
  },
496
513
  });
497
514
  }
@@ -525,8 +542,8 @@ registerAction2(class extends Action2 {
525
542
  (INTERACTIVE_INPUT_CURSOR_BOUNDARY.notEqualsTo('none')),
526
543
  (Context.Visible.toNegated())
527
544
  ))),
528
- primary: 18 ,
529
- weight: 200
545
+ primary: KeyCode.DownArrow,
546
+ weight: KeybindingWeight.WorkbenchContrib
530
547
  },
531
548
  });
532
549
  }
@@ -553,9 +570,9 @@ registerAction2(class extends Action2 {
553
570
  title: ( localizeWithPath(_moduleId, 6, 'Scroll to Top')),
554
571
  keybinding: {
555
572
  when: ( (ContextKeyExpr.equals('activeEditor', 'workbench.editor.interactive'))),
556
- primary: 2048 | 14 ,
557
- mac: { primary: 2048 | 16 },
558
- weight: 200
573
+ primary: KeyMod.CtrlCmd | KeyCode.Home,
574
+ mac: { primary: KeyMod.CtrlCmd | KeyCode.UpArrow },
575
+ weight: KeybindingWeight.WorkbenchContrib
559
576
  },
560
577
  category: interactiveWindowCategory,
561
578
  });
@@ -578,9 +595,9 @@ registerAction2(class extends Action2 {
578
595
  title: ( localizeWithPath(_moduleId, 7, 'Scroll to Bottom')),
579
596
  keybinding: {
580
597
  when: ( (ContextKeyExpr.equals('activeEditor', 'workbench.editor.interactive'))),
581
- primary: 2048 | 13 ,
582
- mac: { primary: 2048 | 18 },
583
- weight: 200
598
+ primary: KeyMod.CtrlCmd | KeyCode.End,
599
+ mac: { primary: KeyMod.CtrlCmd | KeyCode.DownArrow },
600
+ weight: KeybindingWeight.WorkbenchContrib
584
601
  },
585
602
  category: interactiveWindowCategory,
586
603
  });
@@ -617,7 +634,7 @@ registerAction2(class extends Action2 {
617
634
  editorService.activeEditorPane?.focus();
618
635
  }
619
636
  else {
620
- const openEditors = editorService.getEditors(0 );
637
+ const openEditors = editorService.getEditors(EditorsOrder.MOST_RECENTLY_ACTIVE);
621
638
  const interactiveWindow = Iterable.find(openEditors, identifier => { return identifier.editor.typeId === InteractiveEditorInput.ID; });
622
639
  if (interactiveWindow) {
623
640
  const editorInput = interactiveWindow.editor;
@@ -685,14 +702,7 @@ registerColor('interactive.inactiveCodeBorder', {
685
702
  12,
686
703
  "Automatically scroll the interactive window to show the output of the last statement executed. If this value is false, the window will only scroll if the last cell was already the one scrolled to."
687
704
  ))
688
- }
689
- }
690
- });
691
- ( (Registry.as(Extensions.Configuration))).registerConfiguration({
692
- id: 'interactiveWindow',
693
- order: 100,
694
- type: 'object',
695
- 'properties': {
705
+ },
696
706
  [NotebookSetting.InteractiveWindowPromptToSave]: {
697
707
  type: 'boolean',
698
708
  default: false,
@@ -701,6 +711,15 @@ registerColor('interactive.inactiveCodeBorder', {
701
711
  13,
702
712
  "Prompt to save the interactive window when it is closed. Only new interactive windows will be affected by this setting change."
703
713
  ))
714
+ },
715
+ ['interactiveWindow.executeWithShiftEnter']: {
716
+ type: 'boolean',
717
+ default: true,
718
+ markdownDescription: ( localizeWithPath(
719
+ _moduleId,
720
+ 14,
721
+ "Execute the interactive window (REPL) input box with shift+enter, so that enter can be used to create a newline."
722
+ ))
704
723
  }
705
724
  }
706
725
  });
@@ -23,10 +23,12 @@ import 'vscode/vscode/vs/platform/theme/common/colors/quickpickColors';
23
23
  import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
24
24
  import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService.service';
25
25
  import { EditorPane } from 'vscode/vscode/vs/workbench/browser/parts/editor/editorPane';
26
+ import { EditorPaneSelectionChangeReason } from 'vscode/vscode/vs/workbench/common/editor';
26
27
  import { getSimpleEditorOptions } from 'vscode/vscode/vs/workbench/contrib/codeEditor/browser/simpleEditorOptions';
27
28
  import { InteractiveEditorInput } from 'vscode/vscode/vs/workbench/contrib/interactive/browser/interactiveEditorInput';
28
29
  import { NotebookEditorExtensionsRegistry } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookEditorExtensions';
29
30
  import { INotebookEditorService } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/services/notebookEditorService.service';
31
+ import { GroupsOrder } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
30
32
  import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
31
33
  import { ExecutionStateCellStatusBarContrib, TimerCellStatusBarContrib } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController';
32
34
  import { INotebookKernelService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookKernelService.service';
@@ -51,6 +53,7 @@ import { SnippetController2 } from 'vscode/vscode/vs/editor/contrib/snippet/brow
51
53
  import { TabCompletionController } from 'vscode/vscode/vs/workbench/contrib/snippets/browser/tabCompletion';
52
54
  import { MarkerController } from 'vscode/vscode/vs/editor/contrib/gotoError/browser/gotoError';
53
55
  import { ITextResourceConfigurationService } from 'vscode/vscode/vs/editor/common/services/textResourceConfiguration';
56
+ import { TextEditorSelectionSource } from 'vscode/vscode/vs/platform/editor/common/editor';
54
57
  import { NotebookExecutionType } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookExecutionStateService';
55
58
  import { INotebookExecutionStateService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookExecutionStateService.service';
56
59
  import { NOTEBOOK_KERNEL } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
@@ -252,7 +255,7 @@ let InteractiveEditor = class InteractiveEditor extends EditorPane {
252
255
  if (result) {
253
256
  return result;
254
257
  }
255
- for (const group of this._editorGroupService.getGroups(1 )) {
258
+ for (const group of this._editorGroupService.getGroups(GroupsOrder.MOST_RECENTLY_ACTIVE)) {
256
259
  if (group.activeEditorPane !== this && group.activeEditorPane === this && group.activeEditor?.matches(input)) {
257
260
  const notebook = this._notebookWidget.value?.getEditorViewState();
258
261
  const input = this._codeEditorWidget.saveViewState();
@@ -372,7 +375,7 @@ let InteractiveEditor = class InteractiveEditor extends EditorPane {
372
375
  }
373
376
  }));
374
377
  this._widgetDisposableStore.add(this._codeEditorWidget.onDidChangeCursorPosition(e => this._onDidChangeSelection.fire({ reason: this._toEditorPaneSelectionChangeReason(e) })));
375
- this._widgetDisposableStore.add(this._codeEditorWidget.onDidChangeModelContent(() => this._onDidChangeSelection.fire({ reason: 3 })));
378
+ this._widgetDisposableStore.add(this._codeEditorWidget.onDidChangeModelContent(() => this._onDidChangeSelection.fire({ reason: EditorPaneSelectionChangeReason.EDIT })));
376
379
  this._widgetDisposableStore.add(this._notebookKernelService.onDidChangeNotebookAffinity(this._syncWithKernel, this));
377
380
  this._widgetDisposableStore.add(this._notebookKernelService.onDidChangeSelectedNotebooks(this._syncWithKernel, this));
378
381
  this._widgetDisposableStore.add(this.themeService.onDidColorThemeChange(() => {
@@ -431,10 +434,10 @@ let InteractiveEditor = class InteractiveEditor extends EditorPane {
431
434
  }
432
435
  _toEditorPaneSelectionChangeReason(e) {
433
436
  switch (e.source) {
434
- case "api" : return 1 ;
435
- case "code.navigation" : return 4 ;
436
- case "code.jump" : return 5 ;
437
- default: return 2 ;
437
+ case TextEditorSelectionSource.PROGRAMMATIC: return EditorPaneSelectionChangeReason.PROGRAMMATIC;
438
+ case TextEditorSelectionSource.NAVIGATION: return EditorPaneSelectionChangeReason.NAVIGATION;
439
+ case TextEditorSelectionSource.JUMP: return EditorPaneSelectionChangeReason.JUMP;
440
+ default: return EditorPaneSelectionChangeReason.USER;
438
441
  }
439
442
  }
440
443
  _cellAtBottom(cell) {