@codingame/monaco-vscode-notebook-service-override 37.1.0 → 37.3.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 (81) hide show
  1. package/index.js +7 -2
  2. package/package.json +3 -3
  3. package/vscode/src/vs/workbench/api/browser/mainThreadNotebook.d.ts +22 -0
  4. package/vscode/src/vs/workbench/api/browser/mainThreadNotebook.js +210 -0
  5. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocuments.d.ts +24 -0
  6. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocuments.js +140 -0
  7. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocumentsAndEditors.d.ts +29 -0
  8. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocumentsAndEditors.js +194 -0
  9. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookEditors.d.ts +27 -0
  10. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookEditors.js +149 -0
  11. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookKernels.d.ts +49 -0
  12. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookKernels.js +372 -0
  13. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookRenderers.d.ts +10 -0
  14. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookRenderers.js +26 -0
  15. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.d.ts +9 -0
  16. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.js +43 -0
  17. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +9 -9
  18. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +24 -24
  19. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticsActions.js +4 -4
  20. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib.js +2 -2
  21. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +5 -5
  22. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +3 -3
  23. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +19 -19
  24. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +7 -7
  25. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +9 -9
  26. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +6 -6
  27. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +9 -9
  28. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +1 -1
  29. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +1 -1
  30. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookMulticursor.js +32 -19
  31. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookSelectionHighlight.js +2 -2
  32. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +13 -13
  33. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookInlineVariables.js +4 -4
  34. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.js +1 -1
  35. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +1 -1
  36. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +1 -1
  37. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +3 -3
  38. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +14 -14
  39. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +1 -1
  40. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +30 -30
  41. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +5 -5
  42. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +11 -14
  43. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.js +38 -38
  44. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +30 -26
  45. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +21 -21
  46. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/notebookIndentationActions.js +11 -11
  47. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +12 -12
  48. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/variablesActions.js +1 -1
  49. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +24 -24
  50. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.d.ts +1 -1
  51. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditor.js +7 -7
  52. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookMultiDiffEditorInput.d.ts +1 -1
  53. package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +68 -68
  54. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityHelp.js +10 -10
  55. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +35 -35
  56. package/vscode/src/vs/workbench/contrib/notebook/browser/outputEditor/notebookOutputEditor.js +4 -4
  57. package/vscode/src/vs/workbench/contrib/notebook/browser/outputEditor/notebookOutputEditorInput.js +1 -1
  58. package/vscode/src/vs/workbench/contrib/notebook/browser/replEditorAccessibleView.js +1 -1
  59. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookCellStatusBarServiceImpl.js +2 -2
  60. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +1 -1
  61. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +8 -5
  62. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +4 -4
  63. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +2 -2
  64. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +7 -7
  65. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +15 -12
  66. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +1 -1
  67. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +1 -1
  68. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +9 -9
  69. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +8 -8
  70. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.js +1 -1
  71. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +26 -26
  72. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModel.d.ts +87 -0
  73. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModel.js +352 -0
  74. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +1 -1
  75. package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +3 -3
  76. package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookWebWorker.js +44 -18
  77. package/vscode/src/vs/workbench/contrib/replNotebook/browser/repl.contribution.js +5 -5
  78. package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorAccessibilityHelp.js +14 -14
  79. package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +2 -2
  80. package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +12 -12
  81. package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +5 -5
@@ -0,0 +1,194 @@
1
+
2
+ import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
+ import { diffSets, diffMaps } from '@codingame/monaco-vscode-api/vscode/vs/base/common/collections';
4
+ import { DisposableStore, DisposableMap, combinedDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
5
+ import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
6
+ import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
7
+ import { MainThreadNotebookDocuments } from './mainThreadNotebookDocuments.js';
8
+ import { NotebookDto } from '@codingame/monaco-vscode-api/vscode/vs/workbench/api/browser/mainThreadNotebookDto';
9
+ import { MainThreadNotebookEditors } from './mainThreadNotebookEditors.js';
10
+ import { extHostCustomer } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extHostCustomers';
11
+ import { editorGroupToColumn } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupColumn';
12
+ import { getNotebookEditorFromEditorPane } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
13
+ import { INotebookEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/services/notebookEditorService.service';
14
+ import { INotebookService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookService.service';
15
+ import { IEditorGroupsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
16
+ import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
17
+ import { ExtHostContext, MainContext } from '@codingame/monaco-vscode-api/vscode/vs/workbench/api/common/extHost.protocol';
18
+ import { SerializableObjectWithBuffers } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/proxyIdentifier';
19
+
20
+ var MainThreadNotebooksAndEditors_1;
21
+ class NotebookAndEditorState {
22
+ static delta(before, after) {
23
+ if (!before) {
24
+ return {
25
+ addedDocuments: [...after.documents],
26
+ removedDocuments: [],
27
+ addedEditors: [...( after.textEditors.values())],
28
+ removedEditors: [],
29
+ visibleEditors: [...after.visibleEditors].map(editor => editor[0])
30
+ };
31
+ }
32
+ const documentDelta = diffSets(before.documents, after.documents);
33
+ const editorDelta = diffMaps(before.textEditors, after.textEditors);
34
+ const newActiveEditor = before.activeEditor !== after.activeEditor ? after.activeEditor : undefined;
35
+ const visibleEditorDelta = diffMaps(before.visibleEditors, after.visibleEditors);
36
+ return {
37
+ addedDocuments: documentDelta.added,
38
+ removedDocuments: documentDelta.removed.map(e => e.uri),
39
+ addedEditors: editorDelta.added,
40
+ removedEditors: editorDelta.removed.map(removed => removed.getId()),
41
+ newActiveEditor: newActiveEditor,
42
+ visibleEditors: visibleEditorDelta.added.length === 0 && visibleEditorDelta.removed.length === 0 ? undefined : [...after.visibleEditors].map(editor => editor[0])
43
+ };
44
+ }
45
+ constructor(documents, textEditors, activeEditor, visibleEditors) {
46
+ this.documents = documents;
47
+ this.textEditors = textEditors;
48
+ this.activeEditor = activeEditor;
49
+ this.visibleEditors = visibleEditors;
50
+ }
51
+ }
52
+ let MainThreadNotebooksAndEditors = MainThreadNotebooksAndEditors_1 = class MainThreadNotebooksAndEditors {
53
+ constructor(
54
+ extHostContext,
55
+ instantiationService,
56
+ _notebookService,
57
+ _notebookEditorService,
58
+ _editorService,
59
+ _editorGroupService,
60
+ _logService
61
+ ) {
62
+ this._notebookService = _notebookService;
63
+ this._notebookEditorService = _notebookEditorService;
64
+ this._editorService = _editorService;
65
+ this._editorGroupService = _editorGroupService;
66
+ this._logService = _logService;
67
+ this._disposables = ( new DisposableStore());
68
+ this._editorListeners = ( new DisposableMap());
69
+ this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostNotebook));
70
+ this._mainThreadNotebooks = instantiationService.createInstance(MainThreadNotebookDocuments, extHostContext);
71
+ this._mainThreadEditors = instantiationService.createInstance(MainThreadNotebookEditors, extHostContext);
72
+ extHostContext.set(MainContext.MainThreadNotebookDocuments, this._mainThreadNotebooks);
73
+ extHostContext.set(MainContext.MainThreadNotebookEditors, this._mainThreadEditors);
74
+ this._notebookService.onWillAddNotebookDocument(() => this._updateState(), this, this._disposables);
75
+ this._notebookService.onDidRemoveNotebookDocument(() => this._updateState(), this, this._disposables);
76
+ this._editorService.onDidActiveEditorChange(() => this._updateState(), this, this._disposables);
77
+ this._editorService.onDidVisibleEditorsChange(() => this._updateState(), this, this._disposables);
78
+ this._notebookEditorService.onDidAddNotebookEditor(this._handleEditorAdd, this, this._disposables);
79
+ this._notebookEditorService.onDidRemoveNotebookEditor(this._handleEditorRemove, this, this._disposables);
80
+ this._updateState();
81
+ }
82
+ dispose() {
83
+ this._mainThreadNotebooks.dispose();
84
+ this._mainThreadEditors.dispose();
85
+ this._disposables.dispose();
86
+ this._editorListeners.dispose();
87
+ }
88
+ _handleEditorAdd(editor) {
89
+ this._editorListeners.set(editor.getId(), combinedDisposable(
90
+ editor.onDidChangeModel(() => this._updateState()),
91
+ editor.onDidFocusWidget(() => this._updateState(editor))
92
+ ));
93
+ this._updateState();
94
+ }
95
+ _handleEditorRemove(editor) {
96
+ this._editorListeners.deleteAndDispose(editor.getId());
97
+ this._updateState();
98
+ }
99
+ _updateState(focusedEditor) {
100
+ const editors = ( new Map());
101
+ const visibleEditorsMap = ( new Map());
102
+ for (const editor of this._notebookEditorService.listNotebookEditors()) {
103
+ if (editor.hasModel()) {
104
+ editors.set(editor.getId(), editor);
105
+ }
106
+ }
107
+ const activeNotebookEditor = getNotebookEditorFromEditorPane(this._editorService.activeEditorPane);
108
+ let activeEditor = null;
109
+ if (activeNotebookEditor) {
110
+ activeEditor = activeNotebookEditor.getId();
111
+ } else if (focusedEditor?.textModel) {
112
+ activeEditor = focusedEditor.getId();
113
+ }
114
+ if (activeEditor && !( editors.has(activeEditor))) {
115
+ this._logService.trace(
116
+ "MainThreadNotebooksAndEditors#_updateState: active editor is not in editors list",
117
+ activeEditor,
118
+ ( editors.keys())
119
+ );
120
+ activeEditor = null;
121
+ }
122
+ for (const editorPane of this._editorService.visibleEditorPanes) {
123
+ const notebookEditor = getNotebookEditorFromEditorPane(editorPane);
124
+ if (notebookEditor?.hasModel() && ( editors.has(notebookEditor.getId()))) {
125
+ visibleEditorsMap.set(notebookEditor.getId(), notebookEditor);
126
+ }
127
+ }
128
+ const newState = ( new NotebookAndEditorState(( new Set(this._notebookService.listNotebookDocuments())), editors, activeEditor, visibleEditorsMap));
129
+ this._onDelta(NotebookAndEditorState.delta(this._currentState, newState));
130
+ this._currentState = newState;
131
+ }
132
+ _onDelta(delta) {
133
+ if (MainThreadNotebooksAndEditors_1._isDeltaEmpty(delta)) {
134
+ return;
135
+ }
136
+ const dto = {
137
+ removedDocuments: delta.removedDocuments,
138
+ removedEditors: delta.removedEditors,
139
+ newActiveEditor: delta.newActiveEditor,
140
+ visibleEditors: delta.visibleEditors,
141
+ addedDocuments: delta.addedDocuments.map(MainThreadNotebooksAndEditors_1._asModelAddData),
142
+ addedEditors: delta.addedEditors.map(this._asEditorAddData, this)
143
+ };
144
+ this._proxy.$acceptDocumentAndEditorsDelta(( new SerializableObjectWithBuffers(dto)));
145
+ this._mainThreadEditors.handleEditorsRemoved(delta.removedEditors);
146
+ this._mainThreadNotebooks.handleNotebooksRemoved(delta.removedDocuments);
147
+ this._mainThreadNotebooks.handleNotebooksAdded(delta.addedDocuments);
148
+ this._mainThreadEditors.handleEditorsAdded(delta.addedEditors);
149
+ }
150
+ static _isDeltaEmpty(delta) {
151
+ if (delta.addedDocuments !== undefined && delta.addedDocuments.length > 0) {
152
+ return false;
153
+ }
154
+ if (delta.removedDocuments !== undefined && delta.removedDocuments.length > 0) {
155
+ return false;
156
+ }
157
+ if (delta.addedEditors !== undefined && delta.addedEditors.length > 0) {
158
+ return false;
159
+ }
160
+ if (delta.removedEditors !== undefined && delta.removedEditors.length > 0) {
161
+ return false;
162
+ }
163
+ if (delta.visibleEditors !== undefined && delta.visibleEditors.length > 0) {
164
+ return false;
165
+ }
166
+ if (delta.newActiveEditor !== undefined) {
167
+ return false;
168
+ }
169
+ return true;
170
+ }
171
+ static _asModelAddData(e) {
172
+ return {
173
+ viewType: e.viewType,
174
+ uri: e.uri,
175
+ metadata: e.metadata,
176
+ versionId: e.versionId,
177
+ cells: e.cells.map(NotebookDto.toNotebookCellDto)
178
+ };
179
+ }
180
+ _asEditorAddData(add) {
181
+ const pane = this._editorService.visibleEditorPanes.find(pane => getNotebookEditorFromEditorPane(pane) === add);
182
+ return {
183
+ id: add.getId(),
184
+ documentUri: add.textModel.uri,
185
+ selections: add.getSelections(),
186
+ visibleRanges: add.visibleRanges,
187
+ viewColumn: pane && editorGroupToColumn(this._editorGroupService, pane.group),
188
+ viewType: add.getViewModel().viewType
189
+ };
190
+ }
191
+ };
192
+ MainThreadNotebooksAndEditors = MainThreadNotebooksAndEditors_1 = __decorate([extHostCustomer, ( __param(1, IInstantiationService)), ( __param(2, INotebookService)), ( __param(3, INotebookEditorService)), ( __param(4, IEditorService)), ( __param(5, IEditorGroupsService)), ( __param(6, ILogService))], MainThreadNotebooksAndEditors);
193
+
194
+ export { MainThreadNotebooksAndEditors };
@@ -0,0 +1,27 @@
1
+ import { UriComponents } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
2
+ import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service";
3
+ import { INotebookEditor } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser";
4
+ import { INotebookEditorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/services/notebookEditorService.service";
5
+ import { ICellRange } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookRange";
6
+ import { IEditorGroupsService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service";
7
+ import { IEditorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service";
8
+ import { IExtHostContext } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extHostCustomers";
9
+ import { INotebookDocumentShowOptions, MainThreadNotebookEditorsShape, NotebookEditorRevealType } from "@codingame/monaco-vscode-api/vscode/vs/workbench/api/common/extHost.protocol";
10
+ export declare class MainThreadNotebookEditors implements MainThreadNotebookEditorsShape {
11
+ private readonly _editorService;
12
+ private readonly _notebookEditorService;
13
+ private readonly _editorGroupService;
14
+ private readonly _configurationService;
15
+ private readonly _disposables;
16
+ private readonly _proxy;
17
+ private readonly _mainThreadEditors;
18
+ private _currentViewColumnInfo?;
19
+ constructor(extHostContext: IExtHostContext, _editorService: IEditorService, _notebookEditorService: INotebookEditorService, _editorGroupService: IEditorGroupsService, _configurationService: IConfigurationService);
20
+ dispose(): void;
21
+ handleEditorsAdded(editors: readonly INotebookEditor[]): void;
22
+ handleEditorsRemoved(editorIds: readonly string[]): void;
23
+ private _updateEditorViewColumns;
24
+ $tryShowNotebookDocument(resource: UriComponents, viewType: string, options: INotebookDocumentShowOptions): Promise<string>;
25
+ $tryRevealRange(id: string, range: ICellRange, revealType: NotebookEditorRevealType): Promise<void>;
26
+ $trySetSelections(id: string, ranges: ICellRange[]): void;
27
+ }
@@ -0,0 +1,149 @@
1
+
2
+ import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
+ import { DisposableStore, dispose } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
4
+ import { equals } from '@codingame/monaco-vscode-api/vscode/vs/base/common/objects';
5
+ import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
6
+ import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
7
+ import { EditorActivation } from '@codingame/monaco-vscode-api/vscode/vs/platform/editor/common/editor';
8
+ import { getNotebookEditorFromEditorPane } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
9
+ import { INotebookEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/services/notebookEditorService.service';
10
+ import { editorGroupToColumn, columnToEditorGroup } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupColumn';
11
+ import { IEditorGroupsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
12
+ import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
13
+ import { ExtHostContext, NotebookEditorRevealType } from '@codingame/monaco-vscode-api/vscode/vs/workbench/api/common/extHost.protocol';
14
+
15
+ class MainThreadNotebook {
16
+ constructor(editor, disposables) {
17
+ this.editor = editor;
18
+ this.disposables = disposables;
19
+ }
20
+ dispose() {
21
+ this.disposables.dispose();
22
+ }
23
+ }
24
+ let MainThreadNotebookEditors = class MainThreadNotebookEditors {
25
+ constructor(
26
+ extHostContext,
27
+ _editorService,
28
+ _notebookEditorService,
29
+ _editorGroupService,
30
+ _configurationService
31
+ ) {
32
+ this._editorService = _editorService;
33
+ this._notebookEditorService = _notebookEditorService;
34
+ this._editorGroupService = _editorGroupService;
35
+ this._configurationService = _configurationService;
36
+ this._disposables = ( new DisposableStore());
37
+ this._mainThreadEditors = ( new Map());
38
+ this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostNotebookEditors));
39
+ this._editorService.onDidActiveEditorChange(() => this._updateEditorViewColumns(), this, this._disposables);
40
+ this._editorGroupService.onDidRemoveGroup(() => this._updateEditorViewColumns(), this, this._disposables);
41
+ this._editorGroupService.onDidMoveGroup(() => this._updateEditorViewColumns(), this, this._disposables);
42
+ }
43
+ dispose() {
44
+ this._disposables.dispose();
45
+ dispose(( this._mainThreadEditors.values()));
46
+ }
47
+ handleEditorsAdded(editors) {
48
+ for (const editor of editors) {
49
+ const editorDisposables = ( new DisposableStore());
50
+ editorDisposables.add(editor.onDidChangeVisibleRanges(() => {
51
+ this._proxy.$acceptEditorPropertiesChanged(editor.getId(), {
52
+ visibleRanges: {
53
+ ranges: editor.visibleRanges
54
+ }
55
+ });
56
+ }));
57
+ editorDisposables.add(editor.onDidChangeSelection(() => {
58
+ this._proxy.$acceptEditorPropertiesChanged(editor.getId(), {
59
+ selections: {
60
+ selections: editor.getSelections()
61
+ }
62
+ });
63
+ }));
64
+ const wrapper = ( new MainThreadNotebook(editor, editorDisposables));
65
+ this._mainThreadEditors.set(editor.getId(), wrapper);
66
+ }
67
+ }
68
+ handleEditorsRemoved(editorIds) {
69
+ for (const id of editorIds) {
70
+ this._mainThreadEditors.get(id)?.dispose();
71
+ this._mainThreadEditors.delete(id);
72
+ }
73
+ }
74
+ _updateEditorViewColumns() {
75
+ const result = Object.create(null);
76
+ for (const editorPane of this._editorService.visibleEditorPanes) {
77
+ const candidate = getNotebookEditorFromEditorPane(editorPane);
78
+ if (candidate && ( this._mainThreadEditors.has(candidate.getId()))) {
79
+ result[candidate.getId()] = editorGroupToColumn(this._editorGroupService, editorPane.group);
80
+ }
81
+ }
82
+ if (!equals(result, this._currentViewColumnInfo)) {
83
+ this._currentViewColumnInfo = result;
84
+ this._proxy.$acceptEditorViewColumns(result);
85
+ }
86
+ }
87
+ async $tryShowNotebookDocument(resource, viewType, options) {
88
+ const editorOptions = {
89
+ cellSelections: options.selections,
90
+ preserveFocus: options.preserveFocus,
91
+ pinned: options.pinned,
92
+ activation: options.preserveFocus ? EditorActivation.RESTORE : undefined,
93
+ label: options.label,
94
+ override: viewType
95
+ };
96
+ const editorPane = await this._editorService.openEditor({
97
+ resource: URI.revive(resource),
98
+ options: editorOptions
99
+ }, columnToEditorGroup(this._editorGroupService, this._configurationService, options.position));
100
+ const notebookEditor = getNotebookEditorFromEditorPane(editorPane);
101
+ if (notebookEditor) {
102
+ return notebookEditor.getId();
103
+ } else {
104
+ throw ( new Error(
105
+ `Notebook Editor creation failure for document ${JSON.stringify(resource)}`
106
+ ));
107
+ }
108
+ }
109
+ async $tryRevealRange(id, range, revealType) {
110
+ const editor = this._notebookEditorService.getNotebookEditor(id);
111
+ if (!editor) {
112
+ return;
113
+ }
114
+ const notebookEditor = editor;
115
+ if (!notebookEditor.hasModel()) {
116
+ return;
117
+ }
118
+ if (range.start >= notebookEditor.getLength()) {
119
+ return;
120
+ }
121
+ const cell = notebookEditor.cellAt(range.start);
122
+ switch (revealType) {
123
+ case NotebookEditorRevealType.Default:
124
+ return notebookEditor.revealCellRangeInView(range);
125
+ case NotebookEditorRevealType.InCenter:
126
+ return notebookEditor.revealInCenter(cell);
127
+ case NotebookEditorRevealType.InCenterIfOutsideViewport:
128
+ return notebookEditor.revealInCenterIfOutsideViewport(cell);
129
+ case NotebookEditorRevealType.AtTop:
130
+ return notebookEditor.revealInViewAtTop(cell);
131
+ }
132
+ }
133
+ $trySetSelections(id, ranges) {
134
+ const editor = this._notebookEditorService.getNotebookEditor(id);
135
+ if (!editor) {
136
+ return;
137
+ }
138
+ editor.setSelections(ranges);
139
+ if (ranges.length) {
140
+ editor.setFocus({
141
+ start: ranges[0].start,
142
+ end: ranges[0].start + 1
143
+ });
144
+ }
145
+ }
146
+ };
147
+ MainThreadNotebookEditors = ( __decorate([( __param(1, IEditorService)), ( __param(2, INotebookEditorService)), ( __param(3, IEditorGroupsService)), ( __param(4, IConfigurationService))], MainThreadNotebookEditors));
148
+
149
+ export { MainThreadNotebookEditors };
@@ -0,0 +1,49 @@
1
+ import { UriComponents } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
2
+ import { ILanguageService } from "@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/language.service";
3
+ import { IExtHostContext } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extHostCustomers";
4
+ import { INotebookEditorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/services/notebookEditorService.service";
5
+ import { INotebookExecutionStateService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookExecutionStateService.service";
6
+ import { VariablesResult } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookKernelService";
7
+ import { INotebookKernelService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookKernelService.service";
8
+ import { SerializableObjectWithBuffers } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/proxyIdentifier";
9
+ import { ICellExecuteUpdateDto, ICellExecutionCompleteDto, INotebookKernelDto2, MainThreadNotebookKernelsShape } from "@codingame/monaco-vscode-api/vscode/vs/workbench/api/common/extHost.protocol";
10
+ import { INotebookService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookService.service";
11
+ export declare class MainThreadNotebookKernels implements MainThreadNotebookKernelsShape {
12
+ private readonly _languageService;
13
+ private readonly _notebookKernelService;
14
+ private readonly _notebookExecutionStateService;
15
+ private readonly _notebookService;
16
+ private readonly _editors;
17
+ private readonly _disposables;
18
+ private readonly _kernels;
19
+ private readonly _kernelDetectionTasks;
20
+ private readonly _kernelSourceActionProviders;
21
+ private readonly _kernelSourceActionProvidersEventRegistrations;
22
+ private readonly _proxy;
23
+ private readonly _executions;
24
+ private readonly _notebookExecutions;
25
+ constructor(extHostContext: IExtHostContext, _languageService: ILanguageService, _notebookKernelService: INotebookKernelService, _notebookExecutionStateService: INotebookExecutionStateService, _notebookService: INotebookService, notebookEditorService: INotebookEditorService);
26
+ dispose(): void;
27
+ private _onEditorAdd;
28
+ private _onEditorRemove;
29
+ $postMessage(handle: number, editorId: string | undefined, message: unknown): Promise<boolean>;
30
+ private variableRequestIndex;
31
+ private variableRequestMap;
32
+ $receiveVariable(requestId: string, variable: VariablesResult): void;
33
+ $addKernel(handle: number, data: INotebookKernelDto2): Promise<void>;
34
+ $updateKernel(handle: number, data: Partial<INotebookKernelDto2>): void;
35
+ $removeKernel(handle: number): void;
36
+ $updateNotebookPriority(handle: number, notebook: UriComponents, value: number | undefined): void;
37
+ $createExecution(handle: number, controllerId: string, rawUri: UriComponents, cellHandle: number): void;
38
+ $updateExecution(handle: number, data: SerializableObjectWithBuffers<ICellExecuteUpdateDto[]>): void;
39
+ $completeExecution(handle: number, data: SerializableObjectWithBuffers<ICellExecutionCompleteDto>): void;
40
+ $createNotebookExecution(handle: number, controllerId: string, rawUri: UriComponents): void;
41
+ $beginNotebookExecution(handle: number): void;
42
+ $completeNotebookExecution(handle: number): void;
43
+ $addKernelDetectionTask(handle: number, notebookType: string): Promise<void>;
44
+ $removeKernelDetectionTask(handle: number): void;
45
+ $addKernelSourceActionProvider(handle: number, eventHandle: number, notebookType: string): Promise<void>;
46
+ $removeKernelSourceActionProvider(handle: number, eventHandle: number): void;
47
+ $emitNotebookKernelSourceActionsChangeEvent(eventHandle: number): void;
48
+ $variablesUpdated(notebookUri: UriComponents): void;
49
+ }