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