@codingame/monaco-vscode-interactive-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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-interactive-service-override",
3
- "version": "3.2.2",
3
+ "version": "4.0.0",
4
4
  "keywords": [],
5
5
  "author": {
6
6
  "name": "CodinGame",
@@ -18,6 +18,6 @@
18
18
  "module": "index.js",
19
19
  "types": "index.d.ts",
20
20
  "dependencies": {
21
- "vscode": "npm:@codingame/monaco-vscode-api@3.2.2"
21
+ "vscode": "npm:@codingame/monaco-vscode-api@4.0.0"
22
22
  }
23
23
  }
@@ -23,20 +23,31 @@ import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/d
23
23
  import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
24
24
  import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
25
25
  import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
26
- import { registerColor, ifDefinedThenElse, contrastBorder, listInactiveSelectionBackground } from 'vscode/vscode/vs/platform/theme/common/colorRegistry';
26
+ import { registerColor, ifDefinedThenElse } from 'vscode/vscode/vs/platform/theme/common/colorUtils';
27
+ import { contrastBorder } from 'vscode/vscode/vs/platform/theme/common/colors/baseColors';
28
+ import 'vscode/vscode/vs/platform/theme/common/colors/chartsColors';
29
+ import 'vscode/vscode/vs/platform/theme/common/colors/editorColors';
30
+ import 'vscode/vscode/vs/platform/theme/common/colors/inputColors';
31
+ import { listInactiveSelectionBackground } from 'vscode/vscode/vs/platform/theme/common/colors/listColors';
32
+ import 'vscode/vscode/vs/platform/theme/common/colors/menuColors';
33
+ import 'vscode/vscode/vs/platform/theme/common/colors/minimapColors';
34
+ import 'vscode/vscode/vs/platform/theme/common/colors/miscColors';
35
+ import 'vscode/vscode/vs/platform/theme/common/colors/quickpickColors';
36
+ import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
27
37
  import { EditorPaneDescriptor } from 'vscode/vscode/vs/workbench/browser/editor';
28
38
  import { registerWorkbenchContribution2 } from 'vscode/vscode/vs/workbench/common/contributions';
29
39
  import { EditorExtensions } from 'vscode/vscode/vs/workbench/common/editor';
30
40
  import { PANEL_BORDER } from 'vscode/vscode/vs/workbench/common/theme';
31
41
  import { ResourceNotebookCellEdit } from 'vscode/vscode/vs/workbench/contrib/bulkEdit/browser/bulkCellEdits';
32
42
  import { INTERACTIVE_INPUT_CURSOR_BOUNDARY, InteractiveWindowSetting } from './interactiveCommon.js';
43
+ import 'vscode/vscode/vs/base/common/event';
33
44
  import { InteractiveEditor } from './interactiveEditor.js';
34
45
  import { InteractiveEditorInput } from 'vscode/vscode/vs/workbench/contrib/interactive/browser/interactiveEditorInput';
35
46
  import { IInteractiveHistoryService } from 'vscode/vscode/vs/workbench/contrib/interactive/browser/interactiveHistoryService';
36
47
  import { NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/coreActions';
37
48
  import { executeIcon } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookIcons';
38
49
  import { INotebookEditorService } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/services/notebookEditorService';
39
- import { INTERACTIVE_WINDOW_EDITOR_ID, CellUri, NotebookWorkingCopyTypeIdentifier, CellKind } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
50
+ import { INTERACTIVE_WINDOW_EDITOR_ID, CellUri, NotebookWorkingCopyTypeIdentifier, CellKind, NotebookSetting } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
40
51
  import { InteractiveWindowOpen } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
41
52
  import { INotebookKernelService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookKernelService';
42
53
  import { INotebookService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookService';
@@ -196,8 +207,12 @@ InteractiveWindowWorkingCopyEditorHandler = ( __decorate([
196
207
  ( __param(2, IExtensionService))
197
208
  ], InteractiveWindowWorkingCopyEditorHandler));
198
209
  registerWorkbenchContribution2(InteractiveDocumentContribution.ID, InteractiveDocumentContribution, 2 );
199
- registerWorkbenchContribution2(InteractiveInputContentProvider.ID, InteractiveInputContentProvider, 2 );
200
- registerWorkbenchContribution2(InteractiveWindowWorkingCopyEditorHandler.ID, InteractiveWindowWorkingCopyEditorHandler, 2 );
210
+ registerWorkbenchContribution2(InteractiveInputContentProvider.ID, InteractiveInputContentProvider, {
211
+ editorTypeId: INTERACTIVE_WINDOW_EDITOR_ID
212
+ });
213
+ registerWorkbenchContribution2(InteractiveWindowWorkingCopyEditorHandler.ID, InteractiveWindowWorkingCopyEditorHandler, {
214
+ editorTypeId: INTERACTIVE_WINDOW_EDITOR_ID
215
+ });
201
216
  class InteractiveEditorSerializer {
202
217
  static { this.ID = InteractiveEditorInput.ID; }
203
218
  canSerialize(editor) {
@@ -704,5 +719,21 @@ registerColor('interactive.inactiveCodeBorder', {
704
719
  }
705
720
  }
706
721
  });
722
+ ( Registry.as(Extensions.Configuration)).registerConfiguration({
723
+ id: 'interactiveWindow',
724
+ order: 100,
725
+ type: 'object',
726
+ 'properties': {
727
+ [NotebookSetting.InteractiveWindowPromptToSave]: {
728
+ type: 'boolean',
729
+ default: false,
730
+ markdownDescription: ( localizeWithPath(
731
+ 'vs/workbench/contrib/interactive/browser/interactive.contribution',
732
+ 'interactiveWindow.promptToSaveOnClose',
733
+ "Prompt to save the interactive window when it is closed. Only new interactive windows will be affected by this setting change."
734
+ ))
735
+ }
736
+ }
737
+ });
707
738
 
708
739
  export { InteractiveDocumentContribution, InteractiveEditorSerializer };
@@ -1,16 +1,26 @@
1
1
  import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
2
  import './media/interactive.css.js';
3
3
  import { localizeWithPath } from 'vscode/vscode/vs/nls';
4
- import { getWindowById, append, $, createStyleSheet, getWindow, Dimension } from 'vscode/vscode/vs/base/browser/dom';
4
+ import { append, $, createStyleSheet, Dimension } from 'vscode/vscode/vs/base/browser/dom';
5
5
  import { Emitter } from 'vscode/vscode/vs/base/common/event';
6
- import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
6
+ import { DisposableStore, MutableDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
7
7
  import { ICodeEditorService } from 'vscode/vscode/vs/editor/browser/services/codeEditorService';
8
- import { CodeEditorWidget } from 'vscode/vscode/vs/editor/browser/widget/codeEditorWidget';
8
+ import { CodeEditorWidget } from 'vscode/vscode/vs/editor/browser/widget/codeEditor/codeEditorWidget';
9
9
  import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
10
10
  import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
11
11
  import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
12
12
  import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
13
- import { resolveColorValue, editorForeground } from 'vscode/vscode/vs/platform/theme/common/colorRegistry';
13
+ import { resolveColorValue } from 'vscode/vscode/vs/platform/theme/common/colorUtils';
14
+ import 'vscode/vscode/vs/platform/theme/common/colors/baseColors';
15
+ import 'vscode/vscode/vs/platform/theme/common/colors/chartsColors';
16
+ import { editorForeground } from 'vscode/vscode/vs/platform/theme/common/colors/editorColors';
17
+ import 'vscode/vscode/vs/platform/theme/common/colors/inputColors';
18
+ import 'vscode/vscode/vs/platform/theme/common/colors/listColors';
19
+ import 'vscode/vscode/vs/platform/theme/common/colors/menuColors';
20
+ import 'vscode/vscode/vs/platform/theme/common/colors/minimapColors';
21
+ import 'vscode/vscode/vs/platform/theme/common/colors/miscColors';
22
+ import 'vscode/vscode/vs/platform/theme/common/colors/quickpickColors';
23
+ import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
14
24
  import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
15
25
  import { EditorPane } from 'vscode/vscode/vs/workbench/browser/parts/editor/editorPane';
16
26
  import { getSimpleEditorOptions } from 'vscode/vscode/vs/workbench/contrib/codeEditor/browser/simpleEditorOptions';
@@ -49,7 +59,6 @@ import { NotebookFindContrib } from 'vscode/vscode/vs/workbench/contrib/notebook
49
59
  import { INTERACTIVE_WINDOW_EDITOR_ID } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
50
60
  import './interactiveEditor.css.js';
51
61
  import { deepClone } from 'vscode/vscode/vs/base/common/objects';
52
- import { mainWindow } from 'vscode/vscode/vs/base/browser/window';
53
62
 
54
63
  const DECORATION_KEY = 'interactiveInputDecoration';
55
64
  const INTERACTIVE_EDITOR_VIEW_STATE_PREFERENCE_KEY = 'InteractiveEditorViewState';
@@ -58,14 +67,16 @@ const INPUT_CELL_HORIZONTAL_PADDING_RIGHT = 10;
58
67
  const INPUT_EDITOR_PADDING = 8;
59
68
  let InteractiveEditor = class InteractiveEditor extends EditorPane {
60
69
  get onDidFocus() { return this._onDidFocusWidget.event; }
61
- constructor(telemetryService, themeService, storageService, instantiationService, notebookWidgetService, contextKeyService, codeEditorService, notebookKernelService, languageService, keybindingService, configurationService, menuService, contextMenuService, editorGroupService, textResourceConfigurationService, notebookExecutionStateService, extensionService) {
62
- super(INTERACTIVE_WINDOW_EDITOR_ID, telemetryService, themeService, storageService);
70
+ constructor(group, telemetryService, themeService, storageService, instantiationService, notebookWidgetService, contextKeyService, codeEditorService, notebookKernelService, languageService, keybindingService, configurationService, menuService, contextMenuService, editorGroupService, textResourceConfigurationService, notebookExecutionStateService, extensionService) {
71
+ super(INTERACTIVE_WINDOW_EDITOR_ID, group, telemetryService, themeService, storageService);
63
72
  this._notebookWidget = { value: undefined };
64
73
  this._widgetDisposableStore = this._register(( new DisposableStore()));
65
- this._groupListener = this._register(( new DisposableStore()));
74
+ this._groupListener = this._register(( new MutableDisposable()));
66
75
  this._onDidFocusWidget = this._register(( new Emitter()));
67
76
  this._onDidChangeSelection = this._register(( new Emitter()));
68
77
  this.onDidChangeSelection = this._onDidChangeSelection.event;
78
+ this._onDidChangeScroll = this._register(( new Emitter()));
79
+ this.onDidChangeScroll = this._onDidChangeScroll.event;
69
80
  this._instantiationService = instantiationService;
70
81
  this._notebookWidgetService = notebookWidgetService;
71
82
  this._contextKeyService = contextKeyService;
@@ -85,7 +96,7 @@ let InteractiveEditor = class InteractiveEditor extends EditorPane {
85
96
  }
86
97
  }));
87
98
  this._notebookOptions = ( new NotebookOptions(
88
- getWindowById(this.group?.windowId, true).window ?? mainWindow,
99
+ this.window,
89
100
  configurationService,
90
101
  notebookExecutionStateService,
91
102
  codeEditorService,
@@ -221,7 +232,7 @@ let InteractiveEditor = class InteractiveEditor extends EditorPane {
221
232
  return this._loadNotebookEditorViewState(input);
222
233
  }
223
234
  _saveEditorViewState(input) {
224
- if (this.group && this._notebookWidget.value && input instanceof InteractiveEditorInput) {
235
+ if (this._notebookWidget.value && input instanceof InteractiveEditorInput) {
225
236
  if (this._notebookWidget.value.isDisposed) {
226
237
  return;
227
238
  }
@@ -234,10 +245,7 @@ let InteractiveEditor = class InteractiveEditor extends EditorPane {
234
245
  }
235
246
  }
236
247
  _loadNotebookEditorViewState(input) {
237
- let result;
238
- if (this.group) {
239
- result = this._editorMemento.loadEditorState(this.group, input.notebookEditorInput.resource);
240
- }
248
+ const result = this._editorMemento.loadEditorState(this.group, input.notebookEditorInput.resource);
241
249
  if (result) {
242
250
  return result;
243
251
  }
@@ -254,12 +262,11 @@ let InteractiveEditor = class InteractiveEditor extends EditorPane {
254
262
  return;
255
263
  }
256
264
  async setInput(input, options, context, token) {
257
- const group = this.group;
258
265
  const notebookInput = input.notebookEditorInput;
259
266
  this._notebookWidget.value?.onWillHide();
260
267
  this._codeEditorWidget?.dispose();
261
268
  this._widgetDisposableStore.clear();
262
- this._notebookWidget = this._instantiationService.invokeFunction(this._notebookWidgetService.retrieveWidget, group, notebookInput, {
269
+ this._notebookWidget = this._instantiationService.invokeFunction(this._notebookWidgetService.retrieveWidget, this.group, notebookInput, {
263
270
  isEmbedded: true,
264
271
  isReadOnly: true,
265
272
  contributions: NotebookEditorExtensionsRegistry.getSomeEditorContributions([
@@ -282,8 +289,9 @@ let InteractiveEditor = class InteractiveEditor extends EditorPane {
282
289
  HoverController.ID,
283
290
  MarkerController.ID
284
291
  ]),
285
- options: this._notebookOptions
286
- }, undefined, this._rootElement ? getWindow(this._rootElement) : mainWindow);
292
+ options: this._notebookOptions,
293
+ codeWindow: this.window
294
+ }, undefined, this.window);
287
295
  this._codeEditorWidget = this._instantiationService.createInstance(CodeEditorWidget, this._inputEditorContainer, this._editorOptions, {
288
296
  ...{
289
297
  isSimpleWidget: false,
@@ -411,6 +419,7 @@ let InteractiveEditor = class InteractiveEditor extends EditorPane {
411
419
  this.input.historyService.replaceLast(this.input.resource, value);
412
420
  }
413
421
  }));
422
+ this._widgetDisposableStore.add(this._notebookWidget.value.onDidScroll(() => this._onDidChangeScroll.fire()));
414
423
  this._syncWithKernel();
415
424
  }
416
425
  setOptions(options) {
@@ -526,6 +535,15 @@ let InteractiveEditor = class InteractiveEditor extends EditorPane {
526
535
  }
527
536
  this._codeEditorWidget.setDecorationsByType('interactive-decoration', DECORATION_KEY, decorations);
528
537
  }
538
+ getScrollPosition() {
539
+ return {
540
+ scrollTop: this._notebookWidget.value?.scrollTop ?? 0,
541
+ scrollLeft: 0
542
+ };
543
+ }
544
+ setScrollPosition(position) {
545
+ this._notebookWidget.value?.setScrollTop(position.scrollTop);
546
+ }
529
547
  focus() {
530
548
  super.focus();
531
549
  this._notebookWidget.value?.onShow();
@@ -534,12 +552,9 @@ let InteractiveEditor = class InteractiveEditor extends EditorPane {
534
552
  focusHistory() {
535
553
  this._notebookWidget.value.focus();
536
554
  }
537
- setEditorVisible(visible, group) {
538
- super.setEditorVisible(visible, group);
539
- if (group) {
540
- this._groupListener.clear();
541
- this._groupListener.add(group.onWillCloseEditor(e => this._saveEditorViewState(e.editor)));
542
- }
555
+ setEditorVisible(visible) {
556
+ super.setEditorVisible(visible);
557
+ this._groupListener.value = this.group.onWillCloseEditor(e => this._saveEditorViewState(e.editor));
543
558
  if (!visible) {
544
559
  this._saveEditorViewState(this.input);
545
560
  if (this.input && this._notebookWidget.value) {
@@ -565,23 +580,23 @@ let InteractiveEditor = class InteractiveEditor extends EditorPane {
565
580
  }
566
581
  };
567
582
  InteractiveEditor = ( __decorate([
568
- ( __param(0, ITelemetryService)),
569
- ( __param(1, IThemeService)),
570
- ( __param(2, IStorageService)),
571
- ( __param(3, IInstantiationService)),
572
- ( __param(4, INotebookEditorService)),
573
- ( __param(5, IContextKeyService)),
574
- ( __param(6, ICodeEditorService)),
575
- ( __param(7, INotebookKernelService)),
576
- ( __param(8, ILanguageService)),
577
- ( __param(9, IKeybindingService)),
578
- ( __param(10, IConfigurationService)),
579
- ( __param(11, IMenuService)),
580
- ( __param(12, IContextMenuService)),
581
- ( __param(13, IEditorGroupsService)),
582
- ( __param(14, ITextResourceConfigurationService)),
583
- ( __param(15, INotebookExecutionStateService)),
584
- ( __param(16, IExtensionService))
583
+ ( __param(1, ITelemetryService)),
584
+ ( __param(2, IThemeService)),
585
+ ( __param(3, IStorageService)),
586
+ ( __param(4, IInstantiationService)),
587
+ ( __param(5, INotebookEditorService)),
588
+ ( __param(6, IContextKeyService)),
589
+ ( __param(7, ICodeEditorService)),
590
+ ( __param(8, INotebookKernelService)),
591
+ ( __param(9, ILanguageService)),
592
+ ( __param(10, IKeybindingService)),
593
+ ( __param(11, IConfigurationService)),
594
+ ( __param(12, IMenuService)),
595
+ ( __param(13, IContextMenuService)),
596
+ ( __param(14, IEditorGroupsService)),
597
+ ( __param(15, ITextResourceConfigurationService)),
598
+ ( __param(16, INotebookExecutionStateService)),
599
+ ( __param(17, IExtensionService))
585
600
  ], InteractiveEditor));
586
601
 
587
602
  export { InteractiveEditor };