@codingame/monaco-vscode-extensions-service-override 3.2.3 → 4.1.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 (108) hide show
  1. package/extensions.js +6 -87
  2. package/override/vs/platform/dialogs/common/dialogs.js +2 -0
  3. package/package.json +9 -9
  4. package/_virtual/semver.js +0 -3
  5. package/external/vscode-semver/semver.js +0 -985
  6. package/override/vs/workbench/browser/parts/editor/textEditor.weak.js +0 -8
  7. package/vscode/src/vs/base/common/console.js +0 -59
  8. package/vscode/src/vs/platform/extensionManagement/common/extensionManagementCLI.js +0 -497
  9. package/vscode/src/vs/platform/extensionResourceLoader/browser/extensionResourceLoaderService.js +0 -44
  10. package/vscode/src/vs/platform/lifecycle/common/lifecycle.js +0 -27
  11. package/vscode/src/vs/platform/remote/common/managedSocket.js +0 -98
  12. package/vscode/src/vs/workbench/api/browser/mainThreadAiEmbeddingVector.js +0 -31
  13. package/vscode/src/vs/workbench/api/browser/mainThreadAiRelatedInformation.js +0 -35
  14. package/vscode/src/vs/workbench/api/browser/mainThreadAuthentication.js +0 -227
  15. package/vscode/src/vs/workbench/api/browser/mainThreadBulkEdits.js +0 -68
  16. package/vscode/src/vs/workbench/api/browser/mainThreadCLICommands.js +0 -103
  17. package/vscode/src/vs/workbench/api/browser/mainThreadChat.js +0 -83
  18. package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.js +0 -203
  19. package/vscode/src/vs/workbench/api/browser/mainThreadChatProvider.js +0 -201
  20. package/vscode/src/vs/workbench/api/browser/mainThreadChatVariables.js +0 -41
  21. package/vscode/src/vs/workbench/api/browser/mainThreadClipboard.js +0 -24
  22. package/vscode/src/vs/workbench/api/browser/mainThreadCodeInsets.js +0 -107
  23. package/vscode/src/vs/workbench/api/browser/mainThreadCommands.js +0 -98
  24. package/vscode/src/vs/workbench/api/browser/mainThreadComments.js +0 -545
  25. package/vscode/src/vs/workbench/api/browser/mainThreadConfiguration.js +0 -80
  26. package/vscode/src/vs/workbench/api/browser/mainThreadConsole.js +0 -35
  27. package/vscode/src/vs/workbench/api/browser/mainThreadCustomEditors.js +0 -578
  28. package/vscode/src/vs/workbench/api/browser/mainThreadDebugService.js +0 -424
  29. package/vscode/src/vs/workbench/api/browser/mainThreadDecorations.js +0 -102
  30. package/vscode/src/vs/workbench/api/browser/mainThreadDiagnostics.js +0 -69
  31. package/vscode/src/vs/workbench/api/browser/mainThreadDialogs.js +0 -68
  32. package/vscode/src/vs/workbench/api/browser/mainThreadDocumentContentProviders.js +0 -79
  33. package/vscode/src/vs/workbench/api/browser/mainThreadDocuments.js +0 -253
  34. package/vscode/src/vs/workbench/api/browser/mainThreadDocumentsAndEditors.js +0 -370
  35. package/vscode/src/vs/workbench/api/browser/mainThreadDownloadService.js +0 -22
  36. package/vscode/src/vs/workbench/api/browser/mainThreadEditSessionIdentityParticipant.js +0 -41
  37. package/vscode/src/vs/workbench/api/browser/mainThreadEditor.js +0 -414
  38. package/vscode/src/vs/workbench/api/browser/mainThreadEditorTabs.js +0 -482
  39. package/vscode/src/vs/workbench/api/browser/mainThreadEditors.js +0 -227
  40. package/vscode/src/vs/workbench/api/browser/mainThreadErrors.js +0 -24
  41. package/vscode/src/vs/workbench/api/browser/mainThreadExtensionService.js +0 -317
  42. package/vscode/src/vs/workbench/api/browser/mainThreadFileSystem.js +0 -208
  43. package/vscode/src/vs/workbench/api/browser/mainThreadFileSystemEventService.js +0 -374
  44. package/vscode/src/vs/workbench/api/browser/mainThreadInlineChat.js +0 -72
  45. package/vscode/src/vs/workbench/api/browser/mainThreadInteractive.js +0 -28
  46. package/vscode/src/vs/workbench/api/browser/mainThreadIssueReporter.js +0 -50
  47. package/vscode/src/vs/workbench/api/browser/mainThreadLabelService.js +0 -27
  48. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageFeatures.js +0 -991
  49. package/vscode/src/vs/workbench/api/browser/mainThreadLanguages.js +0 -78
  50. package/vscode/src/vs/workbench/api/browser/mainThreadLocalization.js +0 -35
  51. package/vscode/src/vs/workbench/api/browser/mainThreadLogService.js +0 -78
  52. package/vscode/src/vs/workbench/api/browser/mainThreadManagedSockets.js +0 -93
  53. package/vscode/src/vs/workbench/api/browser/mainThreadMessageService.js +0 -137
  54. package/vscode/src/vs/workbench/api/browser/mainThreadNotebook.js +0 -194
  55. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocuments.js +0 -123
  56. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocumentsAndEditors.js +0 -188
  57. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDto.js +0 -129
  58. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookEditors.js +0 -131
  59. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookKernels.js +0 -374
  60. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookRenderers.js +0 -25
  61. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.js +0 -48
  62. package/vscode/src/vs/workbench/api/browser/mainThreadOutputService.js +0 -76
  63. package/vscode/src/vs/workbench/api/browser/mainThreadProfilContentHandlers.js +0 -38
  64. package/vscode/src/vs/workbench/api/browser/mainThreadProgress.js +0 -68
  65. package/vscode/src/vs/workbench/api/browser/mainThreadQuickDiff.js +0 -42
  66. package/vscode/src/vs/workbench/api/browser/mainThreadQuickOpen.js +0 -185
  67. package/vscode/src/vs/workbench/api/browser/mainThreadRemoteConnectionData.js +0 -30
  68. package/vscode/src/vs/workbench/api/browser/mainThreadSCM.js +0 -493
  69. package/vscode/src/vs/workbench/api/browser/mainThreadSaveParticipant.js +0 -49
  70. package/vscode/src/vs/workbench/api/browser/mainThreadSearch.js +0 -146
  71. package/vscode/src/vs/workbench/api/browser/mainThreadSecretState.js +0 -70
  72. package/vscode/src/vs/workbench/api/browser/mainThreadShare.js +0 -50
  73. package/vscode/src/vs/workbench/api/browser/mainThreadSpeech.js +0 -99
  74. package/vscode/src/vs/workbench/api/browser/mainThreadStatusBar.js +0 -53
  75. package/vscode/src/vs/workbench/api/browser/mainThreadStorage.js +0 -72
  76. package/vscode/src/vs/workbench/api/browser/mainThreadTask.js +0 -731
  77. package/vscode/src/vs/workbench/api/browser/mainThreadTelemetry.js +0 -53
  78. package/vscode/src/vs/workbench/api/browser/mainThreadTerminalService.js +0 -408
  79. package/vscode/src/vs/workbench/api/browser/mainThreadTesting.js +0 -195
  80. package/vscode/src/vs/workbench/api/browser/mainThreadTheming.js +0 -24
  81. package/vscode/src/vs/workbench/api/browser/mainThreadTimeline.js +0 -55
  82. package/vscode/src/vs/workbench/api/browser/mainThreadTreeViews.js +0 -312
  83. package/vscode/src/vs/workbench/api/browser/mainThreadTunnelService.js +0 -223
  84. package/vscode/src/vs/workbench/api/browser/mainThreadUriOpeners.js +0 -110
  85. package/vscode/src/vs/workbench/api/browser/mainThreadUrls.js +0 -61
  86. package/vscode/src/vs/workbench/api/browser/mainThreadWebviewManager.js +0 -29
  87. package/vscode/src/vs/workbench/api/browser/mainThreadWebviewPanels.js +0 -283
  88. package/vscode/src/vs/workbench/api/browser/mainThreadWebviewViews.js +0 -100
  89. package/vscode/src/vs/workbench/api/browser/mainThreadWebviews.js +0 -135
  90. package/vscode/src/vs/workbench/api/browser/mainThreadWindow.js +0 -57
  91. package/vscode/src/vs/workbench/api/browser/mainThreadWorkspace.js +0 -268
  92. package/vscode/src/vs/workbench/api/common/shared/dataTransferCache.js +0 -35
  93. package/vscode/src/vs/workbench/contrib/customEditor/common/customTextEditorModel.js +0 -73
  94. package/vscode/src/vs/workbench/contrib/externalUriOpener/common/contributedOpeners.js +0 -83
  95. package/vscode/src/vs/workbench/services/extensions/browser/extensionService.js +0 -284
  96. package/vscode/src/vs/workbench/services/extensions/browser/webWorkerExtensionHost.js +0 -276
  97. package/vscode/src/vs/workbench/services/extensions/browser/webWorkerFileSystemProvider.js +0 -52
  98. package/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.js +0 -1138
  99. package/vscode/src/vs/workbench/services/extensions/common/extHostCustomers.js +0 -41
  100. package/vscode/src/vs/workbench/services/extensions/common/extensionDevOptions.js +0 -25
  101. package/vscode/src/vs/workbench/services/extensions/common/extensionHostManager.js +0 -512
  102. package/vscode/src/vs/workbench/services/extensions/common/extensionRunningLocationTracker.js +0 -274
  103. package/vscode/src/vs/workbench/services/extensions/common/extensionStorageMigration.js +0 -58
  104. package/vscode/src/vs/workbench/services/extensions/common/extensionsProposedApi.js +0 -80
  105. package/vscode/src/vs/workbench/services/extensions/common/extensionsUtil.js +0 -64
  106. package/vscode/src/vs/workbench/services/extensions/common/lazyCreateExtensionHostManager.js +0 -161
  107. package/vscode/src/vs/workbench/services/extensions/common/remoteConsoleUtil.js +0 -49
  108. package/vscode/src/vs/workbench/services/extensions/common/remoteExtensionHost.js +0 -222
@@ -1,482 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
2
- import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
3
- import { MainContext, ExtHostContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
4
- import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js';
5
- import { EditorResourceAccessor, SideBySideEditor } from 'vscode/vscode/vs/workbench/common/editor';
6
- import { DiffEditorInput } from 'vscode/vscode/vs/workbench/common/editor/diffEditorInput';
7
- import { editorGroupToColumn, columnToEditorGroup } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupColumn';
8
- import { IEditorGroupsService, preferredSideBySideGroupDirection } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
9
- import { IEditorService, SIDE_GROUP } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
10
- import { AbstractTextResourceEditorInput } from 'vscode/vscode/vs/workbench/common/editor/textResourceEditorInput';
11
- import { NotebookEditorInput } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookEditorInput';
12
- import { CustomEditorInput } from 'vscode/vscode/vs/workbench/contrib/customEditor/browser/customEditorInput';
13
- import { URI } from 'vscode/vscode/vs/base/common/uri';
14
- import { WebviewInput } from 'vscode/vscode/vs/workbench/contrib/webviewPanel/browser/webviewEditorInput';
15
- import { TerminalEditorInput } from 'vscode/vscode/vs/workbench/contrib/terminal/browser/terminalEditorInput';
16
- import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
17
- import { SideBySideEditorInput } from 'vscode/vscode/vs/workbench/common/editor/sideBySideEditorInput';
18
- import { isEqual } from 'vscode/vscode/vs/base/common/resources';
19
- import { isGroupEditorMoveEvent } from 'vscode/vscode/vs/workbench/common/editor/editorGroupModel';
20
- import { InteractiveEditorInput } from 'vscode/vscode/vs/workbench/contrib/interactive/browser/interactiveEditorInput';
21
- import { MergeEditorInput } from 'vscode/vscode/vs/workbench/contrib/mergeEditor/browser/mergeEditorInput';
22
- import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
23
- import { ChatEditorInput } from 'vscode/vscode/vs/workbench/contrib/chat/browser/chatEditorInput';
24
-
25
- let MainThreadEditorTabs = class MainThreadEditorTabs {
26
- constructor(extHostContext, _editorGroupsService, _configurationService, _logService, editorService) {
27
- this._editorGroupsService = _editorGroupsService;
28
- this._configurationService = _configurationService;
29
- this._logService = _logService;
30
- this._dispoables = ( new DisposableStore());
31
- this._tabGroupModel = [];
32
- this._groupLookup = ( new Map());
33
- this._tabInfoLookup = ( new Map());
34
- this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostEditorTabs));
35
- this._dispoables.add(editorService.onDidEditorsChange((event) => {
36
- try {
37
- this._updateTabsModel(event);
38
- }
39
- catch {
40
- this._logService.error('Failed to update model, rebuilding');
41
- this._createTabsModel();
42
- }
43
- }));
44
- this._dispoables.add(this._editorGroupsService.onDidAddGroup(() => this._createTabsModel()));
45
- this._dispoables.add(this._editorGroupsService.onDidRemoveGroup(() => this._createTabsModel()));
46
- this._editorGroupsService.whenReady.then(() => this._createTabsModel());
47
- }
48
- dispose() {
49
- this._groupLookup.clear();
50
- this._tabInfoLookup.clear();
51
- this._dispoables.dispose();
52
- }
53
- _buildTabObject(group, editor, editorIndex) {
54
- const editorId = editor.editorId;
55
- const tab = {
56
- id: this._generateTabId(editor, group.id),
57
- label: editor.getName(),
58
- editorId,
59
- input: this._editorInputToDto(editor),
60
- isPinned: group.isSticky(editorIndex),
61
- isPreview: !group.isPinned(editorIndex),
62
- isActive: group.isActive(editor),
63
- isDirty: editor.isDirty()
64
- };
65
- return tab;
66
- }
67
- _editorInputToDto(editor) {
68
- if (editor instanceof MergeEditorInput) {
69
- return {
70
- kind: 3 ,
71
- base: editor.base,
72
- input1: editor.input1.uri,
73
- input2: editor.input2.uri,
74
- result: editor.resource
75
- };
76
- }
77
- if (editor instanceof AbstractTextResourceEditorInput) {
78
- return {
79
- kind: 1 ,
80
- uri: editor.resource
81
- };
82
- }
83
- if (editor instanceof SideBySideEditorInput && !(editor instanceof DiffEditorInput)) {
84
- const primaryResource = editor.primary.resource;
85
- const secondaryResource = editor.secondary.resource;
86
- if (editor.primary instanceof AbstractTextResourceEditorInput
87
- && editor.secondary instanceof AbstractTextResourceEditorInput
88
- && isEqual(primaryResource, secondaryResource)
89
- && primaryResource
90
- && secondaryResource) {
91
- return {
92
- kind: 1 ,
93
- uri: primaryResource
94
- };
95
- }
96
- return { kind: 0 };
97
- }
98
- if (editor instanceof NotebookEditorInput) {
99
- return {
100
- kind: 4 ,
101
- notebookType: editor.viewType,
102
- uri: editor.resource
103
- };
104
- }
105
- if (editor instanceof CustomEditorInput) {
106
- return {
107
- kind: 6 ,
108
- viewType: editor.viewType,
109
- uri: editor.resource,
110
- };
111
- }
112
- if (editor instanceof WebviewInput) {
113
- return {
114
- kind: 7 ,
115
- viewType: editor.viewType
116
- };
117
- }
118
- if (editor instanceof TerminalEditorInput) {
119
- return {
120
- kind: 8
121
- };
122
- }
123
- if (editor instanceof DiffEditorInput) {
124
- if (editor.modified instanceof AbstractTextResourceEditorInput && editor.original instanceof AbstractTextResourceEditorInput) {
125
- return {
126
- kind: 2 ,
127
- modified: editor.modified.resource,
128
- original: editor.original.resource
129
- };
130
- }
131
- if (editor.modified instanceof NotebookEditorInput && editor.original instanceof NotebookEditorInput) {
132
- return {
133
- kind: 5 ,
134
- notebookType: editor.original.viewType,
135
- modified: editor.modified.resource,
136
- original: editor.original.resource
137
- };
138
- }
139
- }
140
- if (editor instanceof InteractiveEditorInput) {
141
- return {
142
- kind: 9 ,
143
- uri: editor.resource,
144
- inputBoxUri: editor.inputResource
145
- };
146
- }
147
- if (editor instanceof ChatEditorInput) {
148
- return {
149
- kind: 10 ,
150
- providerId: editor.providerId ?? 'unknown',
151
- };
152
- }
153
- return { kind: 0 };
154
- }
155
- _generateTabId(editor, groupId) {
156
- let resourceString;
157
- const resource = EditorResourceAccessor.getCanonicalUri(editor, { supportSideBySide: SideBySideEditor.BOTH });
158
- if (resource instanceof URI) {
159
- resourceString = ( resource.toString());
160
- }
161
- else {
162
- resourceString = `${resource?.primary?.toString()}-${resource?.secondary?.toString()}`;
163
- }
164
- return `${groupId}~${editor.editorId}-${editor.typeId}-${resourceString} `;
165
- }
166
- _onDidGroupActivate() {
167
- const activeGroupId = this._editorGroupsService.activeGroup.id;
168
- const activeGroup = this._groupLookup.get(activeGroupId);
169
- if (activeGroup) {
170
- activeGroup.isActive = true;
171
- this._proxy.$acceptTabGroupUpdate(activeGroup);
172
- }
173
- }
174
- _onDidTabLabelChange(groupId, editorInput, editorIndex) {
175
- const tabId = this._generateTabId(editorInput, groupId);
176
- const tabInfo = this._tabInfoLookup.get(tabId);
177
- if (tabInfo) {
178
- tabInfo.tab.label = editorInput.getName();
179
- this._proxy.$acceptTabOperation({
180
- groupId,
181
- index: editorIndex,
182
- tabDto: tabInfo.tab,
183
- kind: 2
184
- });
185
- }
186
- else {
187
- this._logService.error('Invalid model for label change, rebuilding');
188
- this._createTabsModel();
189
- }
190
- }
191
- _onDidTabOpen(groupId, editorInput, editorIndex) {
192
- const group = this._editorGroupsService.getGroup(groupId);
193
- const groupInModel = this._groupLookup.get(groupId) !== undefined;
194
- if (!group || !groupInModel) {
195
- this._createTabsModel();
196
- return;
197
- }
198
- const tabs = this._groupLookup.get(groupId)?.tabs;
199
- if (!tabs) {
200
- return;
201
- }
202
- const tabObject = this._buildTabObject(group, editorInput, editorIndex);
203
- tabs.splice(editorIndex, 0, tabObject);
204
- this._tabInfoLookup.set(this._generateTabId(editorInput, groupId), { group, editorInput, tab: tabObject });
205
- this._proxy.$acceptTabOperation({
206
- groupId,
207
- index: editorIndex,
208
- tabDto: tabObject,
209
- kind: 0
210
- });
211
- }
212
- _onDidTabClose(groupId, editorIndex) {
213
- const group = this._editorGroupsService.getGroup(groupId);
214
- const tabs = this._groupLookup.get(groupId)?.tabs;
215
- if (!group || !tabs) {
216
- this._createTabsModel();
217
- return;
218
- }
219
- const removedTab = tabs.splice(editorIndex, 1);
220
- if (removedTab.length === 0) {
221
- return;
222
- }
223
- this._tabInfoLookup.delete(removedTab[0]?.id ?? '');
224
- this._proxy.$acceptTabOperation({
225
- groupId,
226
- index: editorIndex,
227
- tabDto: removedTab[0],
228
- kind: 1
229
- });
230
- }
231
- _onDidTabActiveChange(groupId, editorIndex) {
232
- const tabs = this._groupLookup.get(groupId)?.tabs;
233
- if (!tabs) {
234
- return;
235
- }
236
- const activeTab = tabs[editorIndex];
237
- activeTab.isActive = true;
238
- this._proxy.$acceptTabOperation({
239
- groupId,
240
- index: editorIndex,
241
- tabDto: activeTab,
242
- kind: 2
243
- });
244
- }
245
- _onDidTabDirty(groupId, editorIndex, editor) {
246
- const tabId = this._generateTabId(editor, groupId);
247
- const tabInfo = this._tabInfoLookup.get(tabId);
248
- if (!tabInfo) {
249
- this._logService.error('Invalid model for dirty change, rebuilding');
250
- this._createTabsModel();
251
- return;
252
- }
253
- tabInfo.tab.isDirty = editor.isDirty();
254
- this._proxy.$acceptTabOperation({
255
- groupId,
256
- index: editorIndex,
257
- tabDto: tabInfo.tab,
258
- kind: 2
259
- });
260
- }
261
- _onDidTabPinChange(groupId, editorIndex, editor) {
262
- const tabId = this._generateTabId(editor, groupId);
263
- const tabInfo = this._tabInfoLookup.get(tabId);
264
- const group = tabInfo?.group;
265
- const tab = tabInfo?.tab;
266
- if (!group || !tab) {
267
- this._logService.error('Invalid model for sticky change, rebuilding');
268
- this._createTabsModel();
269
- return;
270
- }
271
- tab.isPinned = group.isSticky(editorIndex);
272
- this._proxy.$acceptTabOperation({
273
- groupId,
274
- index: editorIndex,
275
- tabDto: tab,
276
- kind: 2
277
- });
278
- }
279
- _onDidTabPreviewChange(groupId, editorIndex, editor) {
280
- const tabId = this._generateTabId(editor, groupId);
281
- const tabInfo = this._tabInfoLookup.get(tabId);
282
- const group = tabInfo?.group;
283
- const tab = tabInfo?.tab;
284
- if (!group || !tab) {
285
- this._logService.error('Invalid model for sticky change, rebuilding');
286
- this._createTabsModel();
287
- return;
288
- }
289
- tab.isPreview = !group.isPinned(editorIndex);
290
- this._proxy.$acceptTabOperation({
291
- kind: 2 ,
292
- groupId,
293
- tabDto: tab,
294
- index: editorIndex
295
- });
296
- }
297
- _onDidTabMove(groupId, editorIndex, oldEditorIndex, editor) {
298
- const tabs = this._groupLookup.get(groupId)?.tabs;
299
- if (!tabs) {
300
- this._logService.error('Invalid model for move change, rebuilding');
301
- this._createTabsModel();
302
- return;
303
- }
304
- const removedTab = tabs.splice(oldEditorIndex, 1);
305
- if (removedTab.length === 0) {
306
- return;
307
- }
308
- tabs.splice(editorIndex, 0, removedTab[0]);
309
- this._proxy.$acceptTabOperation({
310
- kind: 3 ,
311
- groupId,
312
- tabDto: removedTab[0],
313
- index: editorIndex,
314
- oldIndex: oldEditorIndex
315
- });
316
- }
317
- _createTabsModel() {
318
- this._tabGroupModel = [];
319
- this._groupLookup.clear();
320
- this._tabInfoLookup.clear();
321
- let tabs = [];
322
- for (const group of this._editorGroupsService.groups) {
323
- const currentTabGroupModel = {
324
- groupId: group.id,
325
- isActive: group.id === this._editorGroupsService.activeGroup.id,
326
- viewColumn: editorGroupToColumn(this._editorGroupsService, group),
327
- tabs: []
328
- };
329
- group.editors.forEach((editor, editorIndex) => {
330
- const tab = this._buildTabObject(group, editor, editorIndex);
331
- tabs.push(tab);
332
- this._tabInfoLookup.set(this._generateTabId(editor, group.id), {
333
- group,
334
- tab,
335
- editorInput: editor
336
- });
337
- });
338
- currentTabGroupModel.tabs = tabs;
339
- this._tabGroupModel.push(currentTabGroupModel);
340
- this._groupLookup.set(group.id, currentTabGroupModel);
341
- tabs = [];
342
- }
343
- this._proxy.$acceptEditorTabModel(this._tabGroupModel);
344
- }
345
- _updateTabsModel(changeEvent) {
346
- const event = changeEvent.event;
347
- const groupId = changeEvent.groupId;
348
- switch (event.kind) {
349
- case 0 :
350
- if (groupId === this._editorGroupsService.activeGroup.id) {
351
- this._onDidGroupActivate();
352
- break;
353
- }
354
- else {
355
- return;
356
- }
357
- case 8 :
358
- if (event.editor !== undefined && event.editorIndex !== undefined) {
359
- this._onDidTabLabelChange(groupId, event.editor, event.editorIndex);
360
- break;
361
- }
362
- case 4 :
363
- if (event.editor !== undefined && event.editorIndex !== undefined) {
364
- this._onDidTabOpen(groupId, event.editor, event.editorIndex);
365
- break;
366
- }
367
- case 5 :
368
- if (event.editorIndex !== undefined) {
369
- this._onDidTabClose(groupId, event.editorIndex);
370
- break;
371
- }
372
- case 7 :
373
- if (event.editorIndex !== undefined) {
374
- this._onDidTabActiveChange(groupId, event.editorIndex);
375
- break;
376
- }
377
- case 12 :
378
- if (event.editorIndex !== undefined && event.editor !== undefined) {
379
- this._onDidTabDirty(groupId, event.editorIndex, event.editor);
380
- break;
381
- }
382
- case 11 :
383
- if (event.editorIndex !== undefined && event.editor !== undefined) {
384
- this._onDidTabPinChange(groupId, event.editorIndex, event.editor);
385
- break;
386
- }
387
- case 10 :
388
- if (event.editorIndex !== undefined && event.editor !== undefined) {
389
- this._onDidTabPreviewChange(groupId, event.editorIndex, event.editor);
390
- break;
391
- }
392
- case 6 :
393
- if (isGroupEditorMoveEvent(event) && event.editor && event.editorIndex !== undefined && event.oldEditorIndex !== undefined) {
394
- this._onDidTabMove(groupId, event.editorIndex, event.oldEditorIndex, event.editor);
395
- break;
396
- }
397
- default:
398
- this._createTabsModel();
399
- }
400
- }
401
- $moveTab(tabId, index, viewColumn, preserveFocus) {
402
- const groupId = columnToEditorGroup(this._editorGroupsService, this._configurationService, viewColumn);
403
- const tabInfo = this._tabInfoLookup.get(tabId);
404
- const tab = tabInfo?.tab;
405
- if (!tab) {
406
- throw new Error(`Attempted to close tab with id ${tabId} which does not exist`);
407
- }
408
- let targetGroup;
409
- const sourceGroup = this._editorGroupsService.getGroup(tabInfo.group.id);
410
- if (!sourceGroup) {
411
- return;
412
- }
413
- if (this._groupLookup.get(groupId) === undefined) {
414
- let direction = 3 ;
415
- if (viewColumn === SIDE_GROUP) {
416
- direction = preferredSideBySideGroupDirection(this._configurationService);
417
- }
418
- targetGroup = this._editorGroupsService.addGroup(this._editorGroupsService.groups[this._editorGroupsService.groups.length - 1], direction);
419
- }
420
- else {
421
- targetGroup = this._editorGroupsService.getGroup(groupId);
422
- }
423
- if (!targetGroup) {
424
- return;
425
- }
426
- if (index < 0 || index > targetGroup.editors.length) {
427
- index = targetGroup.editors.length;
428
- }
429
- const editorInput = tabInfo?.editorInput;
430
- if (!editorInput) {
431
- return;
432
- }
433
- sourceGroup.moveEditor(editorInput, targetGroup, { index, preserveFocus });
434
- return;
435
- }
436
- async $closeTab(tabIds, preserveFocus) {
437
- const groups = ( new Map());
438
- for (const tabId of tabIds) {
439
- const tabInfo = this._tabInfoLookup.get(tabId);
440
- const tab = tabInfo?.tab;
441
- const group = tabInfo?.group;
442
- const editorTab = tabInfo?.editorInput;
443
- if (!group || !tab || !tabInfo || !editorTab) {
444
- continue;
445
- }
446
- const groupEditors = groups.get(group);
447
- if (!groupEditors) {
448
- groups.set(group, [editorTab]);
449
- }
450
- else {
451
- groupEditors.push(editorTab);
452
- }
453
- }
454
- const results = [];
455
- for (const [group, editors] of groups) {
456
- results.push(await group.closeEditors(editors, { preserveFocus }));
457
- }
458
- return results.every(result => result);
459
- }
460
- async $closeGroup(groupIds, preserveFocus) {
461
- const groupCloseResults = [];
462
- for (const groupId of groupIds) {
463
- const group = this._editorGroupsService.getGroup(groupId);
464
- if (group) {
465
- groupCloseResults.push(await group.closeAllEditors());
466
- if (group.count === 0 && this._editorGroupsService.getGroup(group.id)) {
467
- this._editorGroupsService.removeGroup(group);
468
- }
469
- }
470
- }
471
- return groupCloseResults.every(result => result);
472
- }
473
- };
474
- MainThreadEditorTabs = __decorate([
475
- extHostNamedCustomer(MainContext.MainThreadEditorTabs),
476
- ( __param(1, IEditorGroupsService)),
477
- ( __param(2, IConfigurationService)),
478
- ( __param(3, ILogService)),
479
- ( __param(4, IEditorService))
480
- ], MainThreadEditorTabs);
481
-
482
- export { MainThreadEditorTabs };