@codingame/monaco-vscode-extensions-service-override 4.1.0 → 4.1.2
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/_virtual/semver.js +3 -0
- package/extensions.js +6 -6
- package/external/vscode-semver/semver.js +985 -0
- package/override/vs/workbench/browser/parts/editor/textEditor.weak.js +8 -0
- package/package.json +9 -9
- package/vscode/src/vs/base/common/console.js +62 -0
- package/vscode/src/vs/platform/extensionManagement/common/extensionManagementCLI.js +497 -0
- package/vscode/src/vs/platform/extensionResourceLoader/browser/extensionResourceLoaderService.js +44 -0
- package/vscode/src/vs/platform/lifecycle/common/lifecycle.js +27 -0
- package/vscode/src/vs/platform/remote/common/managedSocket.js +98 -0
- package/vscode/src/vs/workbench/api/browser/extensionHost.contribution.js +104 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadAiEmbeddingVector.js +31 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadAiRelatedInformation.js +35 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadAuthentication.js +254 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadBulkEdits.js +68 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadCLICommands.js +103 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChat.js +70 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.js +207 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChatVariables.js +41 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadClipboard.js +24 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadCodeInsets.js +108 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadCommands.js +98 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadComments.js +560 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadConfiguration.js +80 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadConsole.js +35 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadCustomEditors.js +579 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadDebugService.js +435 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadDecorations.js +102 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadDiagnostics.js +69 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadDialogs.js +68 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadDocumentContentProviders.js +79 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadDocuments.js +253 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadDocumentsAndEditors.js +370 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadDownloadService.js +22 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadEditSessionIdentityParticipant.js +41 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadEditor.js +414 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadEditorTabs.js +501 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadEditors.js +227 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadErrors.js +24 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadExtensionService.js +317 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadFileSystem.js +208 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadFileSystemEventService.js +369 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadInlineChat.js +72 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadInteractive.js +28 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadIssueReporter.js +50 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadLabelService.js +27 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadLanguageFeatures.js +1016 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModels.js +185 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadLanguages.js +78 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadLocalization.js +35 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadLogService.js +78 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadManagedSockets.js +93 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadMessageService.js +137 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebook.js +194 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocuments.js +123 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocumentsAndEditors.js +188 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDto.js +129 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookEditors.js +131 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookKernels.js +374 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookRenderers.js +25 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.js +48 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadOutputService.js +76 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadProfileContentHandlers.js +38 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadProgress.js +68 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadQuickDiff.js +42 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadQuickOpen.js +185 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadRemoteConnectionData.js +30 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadSCM.js +493 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadSaveParticipant.js +49 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadSearch.js +168 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadSecretState.js +70 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadShare.js +50 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadSpeech.js +99 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadStatusBar.js +53 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadStorage.js +72 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadTask.js +731 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadTelemetry.js +53 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadTerminalService.js +409 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadTerminalShellIntegration.js +51 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadTesting.js +219 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadTheming.js +24 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadTimeline.js +55 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadTreeViews.js +312 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadTunnelService.js +223 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadUriOpeners.js +110 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadUrls.js +61 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadWebviewManager.js +29 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadWebviewPanels.js +283 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadWebviewViews.js +100 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadWebviews.js +135 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadWindow.js +57 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadWorkspace.js +268 -0
- package/vscode/src/vs/workbench/api/common/shared/dataTransferCache.js +35 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/customTextEditorModel.js +76 -0
- package/vscode/src/vs/workbench/contrib/externalUriOpener/common/contributedOpeners.js +83 -0
- package/vscode/src/vs/workbench/services/extensions/browser/extensionService.js +285 -0
- package/vscode/src/vs/workbench/services/extensions/browser/webWorkerExtensionHost.js +276 -0
- package/vscode/src/vs/workbench/services/extensions/browser/webWorkerFileSystemProvider.js +52 -0
- package/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.js +1149 -0
- package/vscode/src/vs/workbench/services/extensions/common/extHostCustomers.js +41 -0
- package/vscode/src/vs/workbench/services/extensions/common/extensionDevOptions.js +25 -0
- package/vscode/src/vs/workbench/services/extensions/common/extensionHostManager.js +512 -0
- package/vscode/src/vs/workbench/services/extensions/common/extensionRunningLocationTracker.js +274 -0
- package/vscode/src/vs/workbench/services/extensions/common/extensionStorageMigration.js +58 -0
- package/vscode/src/vs/workbench/services/extensions/common/extensionsProposedApi.js +80 -0
- package/vscode/src/vs/workbench/services/extensions/common/extensionsUtil.js +64 -0
- package/vscode/src/vs/workbench/services/extensions/common/lazyCreateExtensionHostManager.js +161 -0
- package/vscode/src/vs/workbench/services/extensions/common/remoteConsoleUtil.js +49 -0
- package/vscode/src/vs/workbench/services/extensions/common/remoteExtensionHost.js +222 -0
|
@@ -0,0 +1,493 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
3
|
+
import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
|
|
4
|
+
import { DisposableStore, dispose, combinedDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
5
|
+
import { ISCMService, ISCMViewService } from 'vscode/vscode/vs/workbench/contrib/scm/common/scm';
|
|
6
|
+
import { MainContext, ExtHostContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
|
|
7
|
+
import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js';
|
|
8
|
+
import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation';
|
|
9
|
+
import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
|
|
10
|
+
import { IQuickDiffService } from 'vscode/vscode/vs/workbench/contrib/scm/common/quickDiff';
|
|
11
|
+
import { ResourceTree } from 'vscode/vscode/vs/base/common/resourceTree';
|
|
12
|
+
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity';
|
|
13
|
+
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
14
|
+
import { basename } from 'vscode/vscode/vs/base/common/resources';
|
|
15
|
+
|
|
16
|
+
function getIconFromIconDto(iconDto) {
|
|
17
|
+
if (iconDto === undefined) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
else if (URI.isUri(iconDto)) {
|
|
21
|
+
return URI.revive(iconDto);
|
|
22
|
+
}
|
|
23
|
+
else if (ThemeIcon.isThemeIcon(iconDto)) {
|
|
24
|
+
return iconDto;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
const icon = iconDto;
|
|
28
|
+
return { light: URI.revive(icon.light), dark: URI.revive(icon.dark) };
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
class MainThreadSCMResourceGroup {
|
|
32
|
+
get resourceTree() {
|
|
33
|
+
if (!this._resourceTree) {
|
|
34
|
+
const rootUri = this.provider.rootUri ?? URI.file('/');
|
|
35
|
+
this._resourceTree = ( new ResourceTree(this, rootUri, this._uriIdentService.extUri));
|
|
36
|
+
for (const resource of this.resources) {
|
|
37
|
+
this._resourceTree.add(resource.sourceUri, resource);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return this._resourceTree;
|
|
41
|
+
}
|
|
42
|
+
get hideWhenEmpty() { return !!this.features.hideWhenEmpty; }
|
|
43
|
+
constructor(sourceControlHandle, handle, provider, features, label, id, multiDiffEditorEnableViewChanges, _uriIdentService) {
|
|
44
|
+
this.sourceControlHandle = sourceControlHandle;
|
|
45
|
+
this.handle = handle;
|
|
46
|
+
this.provider = provider;
|
|
47
|
+
this.features = features;
|
|
48
|
+
this.label = label;
|
|
49
|
+
this.id = id;
|
|
50
|
+
this.multiDiffEditorEnableViewChanges = multiDiffEditorEnableViewChanges;
|
|
51
|
+
this._uriIdentService = _uriIdentService;
|
|
52
|
+
this.resources = [];
|
|
53
|
+
this._onDidChange = ( new Emitter());
|
|
54
|
+
this.onDidChange = this._onDidChange.event;
|
|
55
|
+
this._onDidChangeResources = ( new Emitter());
|
|
56
|
+
this.onDidChangeResources = this._onDidChangeResources.event;
|
|
57
|
+
}
|
|
58
|
+
toJSON() {
|
|
59
|
+
return {
|
|
60
|
+
$mid: 4 ,
|
|
61
|
+
sourceControlHandle: this.sourceControlHandle,
|
|
62
|
+
groupHandle: this.handle
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
splice(start, deleteCount, toInsert) {
|
|
66
|
+
this.resources.splice(start, deleteCount, ...toInsert);
|
|
67
|
+
this._resourceTree = undefined;
|
|
68
|
+
this._onDidChangeResources.fire();
|
|
69
|
+
}
|
|
70
|
+
$updateGroup(features) {
|
|
71
|
+
this.features = { ...this.features, ...features };
|
|
72
|
+
this._onDidChange.fire();
|
|
73
|
+
}
|
|
74
|
+
$updateGroupLabel(label) {
|
|
75
|
+
this.label = label;
|
|
76
|
+
this._onDidChange.fire();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
class MainThreadSCMResource {
|
|
80
|
+
constructor(proxy, sourceControlHandle, groupHandle, handle, sourceUri, resourceGroup, decorations, contextValue, command, multiDiffEditorOriginalUri, multiDiffEditorModifiedUri) {
|
|
81
|
+
this.proxy = proxy;
|
|
82
|
+
this.sourceControlHandle = sourceControlHandle;
|
|
83
|
+
this.groupHandle = groupHandle;
|
|
84
|
+
this.handle = handle;
|
|
85
|
+
this.sourceUri = sourceUri;
|
|
86
|
+
this.resourceGroup = resourceGroup;
|
|
87
|
+
this.decorations = decorations;
|
|
88
|
+
this.contextValue = contextValue;
|
|
89
|
+
this.command = command;
|
|
90
|
+
this.multiDiffEditorOriginalUri = multiDiffEditorOriginalUri;
|
|
91
|
+
this.multiDiffEditorModifiedUri = multiDiffEditorModifiedUri;
|
|
92
|
+
}
|
|
93
|
+
open(preserveFocus) {
|
|
94
|
+
return this.proxy.$executeResourceCommand(this.sourceControlHandle, this.groupHandle, this.handle, preserveFocus);
|
|
95
|
+
}
|
|
96
|
+
toJSON() {
|
|
97
|
+
return {
|
|
98
|
+
$mid: 3 ,
|
|
99
|
+
sourceControlHandle: this.sourceControlHandle,
|
|
100
|
+
groupHandle: this.groupHandle,
|
|
101
|
+
handle: this.handle
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
class MainThreadSCMHistoryProvider {
|
|
106
|
+
get currentHistoryItemGroup() { return this._currentHistoryItemGroup; }
|
|
107
|
+
set currentHistoryItemGroup(historyItemGroup) {
|
|
108
|
+
this._currentHistoryItemGroup = historyItemGroup;
|
|
109
|
+
this._onDidChangeCurrentHistoryItemGroup.fire();
|
|
110
|
+
}
|
|
111
|
+
constructor(proxy, handle) {
|
|
112
|
+
this.proxy = proxy;
|
|
113
|
+
this.handle = handle;
|
|
114
|
+
this._onDidChangeCurrentHistoryItemGroup = ( new Emitter());
|
|
115
|
+
this.onDidChangeCurrentHistoryItemGroup = this._onDidChangeCurrentHistoryItemGroup.event;
|
|
116
|
+
}
|
|
117
|
+
async resolveHistoryItemGroupCommonAncestor(historyItemGroupId1, historyItemGroupId2) {
|
|
118
|
+
return this.proxy.$resolveHistoryItemGroupCommonAncestor(this.handle, historyItemGroupId1, historyItemGroupId2, CancellationToken.None);
|
|
119
|
+
}
|
|
120
|
+
async provideHistoryItems(historyItemGroupId, options) {
|
|
121
|
+
const historyItems = await this.proxy.$provideHistoryItems(this.handle, historyItemGroupId, options, CancellationToken.None);
|
|
122
|
+
return historyItems?.map(historyItem => ({ ...historyItem, icon: getIconFromIconDto(historyItem.icon) }));
|
|
123
|
+
}
|
|
124
|
+
async provideHistoryItemSummary(historyItemId, historyItemParentId) {
|
|
125
|
+
const historyItem = await this.proxy.$provideHistoryItemSummary(this.handle, historyItemId, historyItemParentId, CancellationToken.None);
|
|
126
|
+
return historyItem ? { ...historyItem, icon: getIconFromIconDto(historyItem.icon) } : undefined;
|
|
127
|
+
}
|
|
128
|
+
async provideHistoryItemChanges(historyItemId, historyItemParentId) {
|
|
129
|
+
const changes = await this.proxy.$provideHistoryItemChanges(this.handle, historyItemId, historyItemParentId, CancellationToken.None);
|
|
130
|
+
return changes?.map(change => ({
|
|
131
|
+
uri: URI.revive(change.uri),
|
|
132
|
+
originalUri: change.originalUri && URI.revive(change.originalUri),
|
|
133
|
+
modifiedUri: change.modifiedUri && URI.revive(change.modifiedUri),
|
|
134
|
+
renameUri: change.renameUri && URI.revive(change.renameUri)
|
|
135
|
+
}));
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
class MainThreadSCMProvider {
|
|
139
|
+
static { this.ID_HANDLE = 0; }
|
|
140
|
+
get id() { return this._id; }
|
|
141
|
+
get handle() { return this._handle; }
|
|
142
|
+
get label() { return this._label; }
|
|
143
|
+
get rootUri() { return this._rootUri; }
|
|
144
|
+
get inputBoxDocumentUri() { return this._inputBoxDocumentUri; }
|
|
145
|
+
get contextValue() { return this._providerId; }
|
|
146
|
+
get commitTemplate() { return this.features.commitTemplate || ''; }
|
|
147
|
+
get historyProvider() { return this._historyProvider; }
|
|
148
|
+
get acceptInputCommand() { return this.features.acceptInputCommand; }
|
|
149
|
+
get actionButton() { return this.features.actionButton ?? undefined; }
|
|
150
|
+
get statusBarCommands() { return this.features.statusBarCommands; }
|
|
151
|
+
get count() { return this.features.count; }
|
|
152
|
+
get name() { return this._name ?? this._label; }
|
|
153
|
+
get onDidChangeStatusBarCommands() { return this._onDidChangeStatusBarCommands.event; }
|
|
154
|
+
constructor(proxy, _handle, _providerId, _label, _rootUri, _inputBoxDocumentUri, _quickDiffService, _uriIdentService, _workspaceContextService) {
|
|
155
|
+
this.proxy = proxy;
|
|
156
|
+
this._handle = _handle;
|
|
157
|
+
this._providerId = _providerId;
|
|
158
|
+
this._label = _label;
|
|
159
|
+
this._rootUri = _rootUri;
|
|
160
|
+
this._inputBoxDocumentUri = _inputBoxDocumentUri;
|
|
161
|
+
this._quickDiffService = _quickDiffService;
|
|
162
|
+
this._uriIdentService = _uriIdentService;
|
|
163
|
+
this._workspaceContextService = _workspaceContextService;
|
|
164
|
+
this._id = `scm${MainThreadSCMProvider.ID_HANDLE++}`;
|
|
165
|
+
this.groups = [];
|
|
166
|
+
this._onDidChangeResourceGroups = ( new Emitter());
|
|
167
|
+
this.onDidChangeResourceGroups = this._onDidChangeResourceGroups.event;
|
|
168
|
+
this._onDidChangeResources = ( new Emitter());
|
|
169
|
+
this.onDidChangeResources = this._onDidChangeResources.event;
|
|
170
|
+
this._groupsByHandle = Object.create(null);
|
|
171
|
+
this.features = {};
|
|
172
|
+
this._onDidChangeCommitTemplate = ( new Emitter());
|
|
173
|
+
this.onDidChangeCommitTemplate = this._onDidChangeCommitTemplate.event;
|
|
174
|
+
this._onDidChangeStatusBarCommands = ( new Emitter());
|
|
175
|
+
this._onDidChangeHistoryProvider = ( new Emitter());
|
|
176
|
+
this.onDidChangeHistoryProvider = this._onDidChangeHistoryProvider.event;
|
|
177
|
+
this._onDidChange = ( new Emitter());
|
|
178
|
+
this.onDidChange = this._onDidChange.event;
|
|
179
|
+
this.isSCM = true;
|
|
180
|
+
if (_rootUri) {
|
|
181
|
+
const folder = this._workspaceContextService.getWorkspaceFolder(_rootUri);
|
|
182
|
+
if (folder?.uri.toString() === ( _rootUri.toString())) {
|
|
183
|
+
this._name = folder.name;
|
|
184
|
+
}
|
|
185
|
+
else if (_rootUri.path !== '/') {
|
|
186
|
+
this._name = basename(_rootUri);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
$updateSourceControl(features) {
|
|
191
|
+
this.features = { ...this.features, ...features };
|
|
192
|
+
this._onDidChange.fire();
|
|
193
|
+
if (typeof features.commitTemplate !== 'undefined') {
|
|
194
|
+
this._onDidChangeCommitTemplate.fire(this.commitTemplate);
|
|
195
|
+
}
|
|
196
|
+
if (typeof features.statusBarCommands !== 'undefined') {
|
|
197
|
+
this._onDidChangeStatusBarCommands.fire(this.statusBarCommands);
|
|
198
|
+
}
|
|
199
|
+
if (features.hasQuickDiffProvider && !this._quickDiff) {
|
|
200
|
+
this._quickDiff = this._quickDiffService.addQuickDiffProvider({
|
|
201
|
+
label: features.quickDiffLabel ?? this.label,
|
|
202
|
+
rootUri: this.rootUri,
|
|
203
|
+
isSCM: this.isSCM,
|
|
204
|
+
getOriginalResource: (uri) => this.getOriginalResource(uri)
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
else if (features.hasQuickDiffProvider === false && this._quickDiff) {
|
|
208
|
+
this._quickDiff.dispose();
|
|
209
|
+
this._quickDiff = undefined;
|
|
210
|
+
}
|
|
211
|
+
if (features.hasHistoryProvider && !this._historyProvider) {
|
|
212
|
+
this._historyProvider = ( new MainThreadSCMHistoryProvider(this.proxy, this.handle));
|
|
213
|
+
this._onDidChangeHistoryProvider.fire();
|
|
214
|
+
}
|
|
215
|
+
else if (features.hasHistoryProvider === false && this._historyProvider) {
|
|
216
|
+
this._historyProvider = undefined;
|
|
217
|
+
this._onDidChangeHistoryProvider.fire();
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
$registerGroups(_groups) {
|
|
221
|
+
const groups = ( _groups.map(([handle, id, label, features, multiDiffEditorEnableViewChanges]) => {
|
|
222
|
+
const group = ( new MainThreadSCMResourceGroup(
|
|
223
|
+
this.handle,
|
|
224
|
+
handle,
|
|
225
|
+
this,
|
|
226
|
+
features,
|
|
227
|
+
label,
|
|
228
|
+
id,
|
|
229
|
+
multiDiffEditorEnableViewChanges,
|
|
230
|
+
this._uriIdentService
|
|
231
|
+
));
|
|
232
|
+
this._groupsByHandle[handle] = group;
|
|
233
|
+
return group;
|
|
234
|
+
}));
|
|
235
|
+
this.groups.splice(this.groups.length, 0, ...groups);
|
|
236
|
+
this._onDidChangeResourceGroups.fire();
|
|
237
|
+
}
|
|
238
|
+
$updateGroup(handle, features) {
|
|
239
|
+
const group = this._groupsByHandle[handle];
|
|
240
|
+
if (!group) {
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
group.$updateGroup(features);
|
|
244
|
+
}
|
|
245
|
+
$updateGroupLabel(handle, label) {
|
|
246
|
+
const group = this._groupsByHandle[handle];
|
|
247
|
+
if (!group) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
group.$updateGroupLabel(label);
|
|
251
|
+
}
|
|
252
|
+
$spliceGroupResourceStates(splices) {
|
|
253
|
+
for (const [groupHandle, groupSlices] of splices) {
|
|
254
|
+
const group = this._groupsByHandle[groupHandle];
|
|
255
|
+
if (!group) {
|
|
256
|
+
console.warn(`SCM group ${groupHandle} not found in provider ${this.label}`);
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
groupSlices.reverse();
|
|
260
|
+
for (const [start, deleteCount, rawResources] of groupSlices) {
|
|
261
|
+
const resources = ( rawResources.map(rawResource => {
|
|
262
|
+
const [handle, sourceUri, icons, tooltip, strikeThrough, faded, contextValue, command, multiDiffEditorOriginalUri, multiDiffEditorModifiedUri] = rawResource;
|
|
263
|
+
const [light, dark] = icons;
|
|
264
|
+
const icon = ThemeIcon.isThemeIcon(light) ? light : URI.revive(light);
|
|
265
|
+
const iconDark = (ThemeIcon.isThemeIcon(dark) ? dark : URI.revive(dark)) || icon;
|
|
266
|
+
const decorations = {
|
|
267
|
+
icon: icon,
|
|
268
|
+
iconDark: iconDark,
|
|
269
|
+
tooltip,
|
|
270
|
+
strikeThrough,
|
|
271
|
+
faded
|
|
272
|
+
};
|
|
273
|
+
return ( new MainThreadSCMResource(
|
|
274
|
+
this.proxy,
|
|
275
|
+
this.handle,
|
|
276
|
+
groupHandle,
|
|
277
|
+
handle,
|
|
278
|
+
URI.revive(sourceUri),
|
|
279
|
+
group,
|
|
280
|
+
decorations,
|
|
281
|
+
contextValue || undefined,
|
|
282
|
+
command,
|
|
283
|
+
URI.revive(multiDiffEditorOriginalUri),
|
|
284
|
+
URI.revive(multiDiffEditorModifiedUri)
|
|
285
|
+
));
|
|
286
|
+
}));
|
|
287
|
+
group.splice(start, deleteCount, resources);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
this._onDidChangeResources.fire();
|
|
291
|
+
}
|
|
292
|
+
$unregisterGroup(handle) {
|
|
293
|
+
const group = this._groupsByHandle[handle];
|
|
294
|
+
if (!group) {
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
delete this._groupsByHandle[handle];
|
|
298
|
+
this.groups.splice(this.groups.indexOf(group), 1);
|
|
299
|
+
this._onDidChangeResourceGroups.fire();
|
|
300
|
+
}
|
|
301
|
+
async getOriginalResource(uri) {
|
|
302
|
+
if (!this.features.hasQuickDiffProvider) {
|
|
303
|
+
return null;
|
|
304
|
+
}
|
|
305
|
+
const result = await this.proxy.$provideOriginalResource(this.handle, uri, CancellationToken.None);
|
|
306
|
+
return result && URI.revive(result);
|
|
307
|
+
}
|
|
308
|
+
$onDidChangeHistoryProviderCurrentHistoryItemGroup(currentHistoryItemGroup) {
|
|
309
|
+
if (!this._historyProvider) {
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
this._historyProvider.currentHistoryItemGroup = currentHistoryItemGroup ?? undefined;
|
|
313
|
+
}
|
|
314
|
+
toJSON() {
|
|
315
|
+
return {
|
|
316
|
+
$mid: 5 ,
|
|
317
|
+
handle: this.handle
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
dispose() {
|
|
321
|
+
this._quickDiff?.dispose();
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
let MainThreadSCM = class MainThreadSCM {
|
|
325
|
+
constructor(extHostContext, scmService, scmViewService, quickDiffService, _uriIdentService, workspaceContextService) {
|
|
326
|
+
this.scmService = scmService;
|
|
327
|
+
this.scmViewService = scmViewService;
|
|
328
|
+
this.quickDiffService = quickDiffService;
|
|
329
|
+
this._uriIdentService = _uriIdentService;
|
|
330
|
+
this.workspaceContextService = workspaceContextService;
|
|
331
|
+
this._repositories = ( new Map());
|
|
332
|
+
this._repositoryDisposables = ( new Map());
|
|
333
|
+
this._disposables = ( new DisposableStore());
|
|
334
|
+
this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostSCM));
|
|
335
|
+
}
|
|
336
|
+
dispose() {
|
|
337
|
+
dispose(( this._repositories.values()));
|
|
338
|
+
this._repositories.clear();
|
|
339
|
+
dispose(( this._repositoryDisposables.values()));
|
|
340
|
+
this._repositoryDisposables.clear();
|
|
341
|
+
this._disposables.dispose();
|
|
342
|
+
}
|
|
343
|
+
$registerSourceControl(handle, id, label, rootUri, inputBoxDocumentUri) {
|
|
344
|
+
const provider = ( new MainThreadSCMProvider(
|
|
345
|
+
this._proxy,
|
|
346
|
+
handle,
|
|
347
|
+
id,
|
|
348
|
+
label,
|
|
349
|
+
rootUri ? URI.revive(rootUri) : undefined,
|
|
350
|
+
URI.revive(inputBoxDocumentUri),
|
|
351
|
+
this.quickDiffService,
|
|
352
|
+
this._uriIdentService,
|
|
353
|
+
this.workspaceContextService
|
|
354
|
+
));
|
|
355
|
+
const repository = this.scmService.registerSCMProvider(provider);
|
|
356
|
+
this._repositories.set(handle, repository);
|
|
357
|
+
const disposable = combinedDisposable(Event.filter(this.scmViewService.onDidFocusRepository, r => r === repository)(_ => this._proxy.$setSelectedSourceControl(handle)), repository.input.onDidChange(({ value }) => this._proxy.$onInputBoxValueChange(handle, value)));
|
|
358
|
+
if (this.scmViewService.focusedRepository === repository) {
|
|
359
|
+
setTimeout(() => this._proxy.$setSelectedSourceControl(handle), 0);
|
|
360
|
+
}
|
|
361
|
+
if (repository.input.value) {
|
|
362
|
+
setTimeout(() => this._proxy.$onInputBoxValueChange(handle, repository.input.value), 0);
|
|
363
|
+
}
|
|
364
|
+
this._repositoryDisposables.set(handle, disposable);
|
|
365
|
+
}
|
|
366
|
+
$updateSourceControl(handle, features) {
|
|
367
|
+
const repository = this._repositories.get(handle);
|
|
368
|
+
if (!repository) {
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
const provider = repository.provider;
|
|
372
|
+
provider.$updateSourceControl(features);
|
|
373
|
+
}
|
|
374
|
+
$unregisterSourceControl(handle) {
|
|
375
|
+
const repository = this._repositories.get(handle);
|
|
376
|
+
if (!repository) {
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
this._repositoryDisposables.get(handle).dispose();
|
|
380
|
+
this._repositoryDisposables.delete(handle);
|
|
381
|
+
repository.dispose();
|
|
382
|
+
this._repositories.delete(handle);
|
|
383
|
+
}
|
|
384
|
+
$registerGroups(sourceControlHandle, groups, splices) {
|
|
385
|
+
const repository = this._repositories.get(sourceControlHandle);
|
|
386
|
+
if (!repository) {
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
const provider = repository.provider;
|
|
390
|
+
provider.$registerGroups(groups);
|
|
391
|
+
provider.$spliceGroupResourceStates(splices);
|
|
392
|
+
}
|
|
393
|
+
$updateGroup(sourceControlHandle, groupHandle, features) {
|
|
394
|
+
const repository = this._repositories.get(sourceControlHandle);
|
|
395
|
+
if (!repository) {
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
const provider = repository.provider;
|
|
399
|
+
provider.$updateGroup(groupHandle, features);
|
|
400
|
+
}
|
|
401
|
+
$updateGroupLabel(sourceControlHandle, groupHandle, label) {
|
|
402
|
+
const repository = this._repositories.get(sourceControlHandle);
|
|
403
|
+
if (!repository) {
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
const provider = repository.provider;
|
|
407
|
+
provider.$updateGroupLabel(groupHandle, label);
|
|
408
|
+
}
|
|
409
|
+
$spliceResourceStates(sourceControlHandle, splices) {
|
|
410
|
+
const repository = this._repositories.get(sourceControlHandle);
|
|
411
|
+
if (!repository) {
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
const provider = repository.provider;
|
|
415
|
+
provider.$spliceGroupResourceStates(splices);
|
|
416
|
+
}
|
|
417
|
+
$unregisterGroup(sourceControlHandle, handle) {
|
|
418
|
+
const repository = this._repositories.get(sourceControlHandle);
|
|
419
|
+
if (!repository) {
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
const provider = repository.provider;
|
|
423
|
+
provider.$unregisterGroup(handle);
|
|
424
|
+
}
|
|
425
|
+
$setInputBoxValue(sourceControlHandle, value) {
|
|
426
|
+
const repository = this._repositories.get(sourceControlHandle);
|
|
427
|
+
if (!repository) {
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
repository.input.setValue(value, false);
|
|
431
|
+
}
|
|
432
|
+
$setInputBoxPlaceholder(sourceControlHandle, placeholder) {
|
|
433
|
+
const repository = this._repositories.get(sourceControlHandle);
|
|
434
|
+
if (!repository) {
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
repository.input.placeholder = placeholder;
|
|
438
|
+
}
|
|
439
|
+
$setInputBoxEnablement(sourceControlHandle, enabled) {
|
|
440
|
+
const repository = this._repositories.get(sourceControlHandle);
|
|
441
|
+
if (!repository) {
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
repository.input.enabled = enabled;
|
|
445
|
+
}
|
|
446
|
+
$setInputBoxVisibility(sourceControlHandle, visible) {
|
|
447
|
+
const repository = this._repositories.get(sourceControlHandle);
|
|
448
|
+
if (!repository) {
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
repository.input.visible = visible;
|
|
452
|
+
}
|
|
453
|
+
$showValidationMessage(sourceControlHandle, message, type) {
|
|
454
|
+
const repository = this._repositories.get(sourceControlHandle);
|
|
455
|
+
if (!repository) {
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
repository.input.showValidationMessage(message, type);
|
|
459
|
+
}
|
|
460
|
+
$setValidationProviderIsEnabled(sourceControlHandle, enabled) {
|
|
461
|
+
const repository = this._repositories.get(sourceControlHandle);
|
|
462
|
+
if (!repository) {
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
if (enabled) {
|
|
466
|
+
repository.input.validateInput = async (value, pos) => {
|
|
467
|
+
const result = await this._proxy.$validateInput(sourceControlHandle, value, pos);
|
|
468
|
+
return result && { message: result[0], type: result[1] };
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
else {
|
|
472
|
+
repository.input.validateInput = async () => undefined;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
$onDidChangeHistoryProviderCurrentHistoryItemGroup(sourceControlHandle, historyItemGroup) {
|
|
476
|
+
const repository = this._repositories.get(sourceControlHandle);
|
|
477
|
+
if (!repository) {
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
const provider = repository.provider;
|
|
481
|
+
provider.$onDidChangeHistoryProviderCurrentHistoryItemGroup(historyItemGroup);
|
|
482
|
+
}
|
|
483
|
+
};
|
|
484
|
+
MainThreadSCM = __decorate([
|
|
485
|
+
extHostNamedCustomer(MainContext.MainThreadSCM),
|
|
486
|
+
( __param(1, ISCMService)),
|
|
487
|
+
( __param(2, ISCMViewService)),
|
|
488
|
+
( __param(3, IQuickDiffService)),
|
|
489
|
+
( __param(4, IUriIdentityService)),
|
|
490
|
+
( __param(5, IWorkspaceContextService))
|
|
491
|
+
], MainThreadSCM);
|
|
492
|
+
|
|
493
|
+
export { MainThreadSCM };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { shouldSynchronizeModel } from 'vscode/vscode/vs/editor/common/model';
|
|
3
|
+
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
4
|
+
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
5
|
+
import { extHostCustomer } from '../../services/extensions/common/extHostCustomers.js';
|
|
6
|
+
import { ITextFileService } from 'vscode/vscode/vs/workbench/services/textfile/common/textfiles';
|
|
7
|
+
import { ExtHostContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
|
|
8
|
+
import { raceCancellationError } from 'vscode/vscode/vs/base/common/async';
|
|
9
|
+
|
|
10
|
+
class ExtHostSaveParticipant {
|
|
11
|
+
constructor(extHostContext) {
|
|
12
|
+
this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostDocumentSaveParticipant));
|
|
13
|
+
}
|
|
14
|
+
async participate(editorModel, context, _progress, token) {
|
|
15
|
+
if (!editorModel.textEditorModel || !shouldSynchronizeModel(editorModel.textEditorModel)) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
const p = ( new Promise((resolve, reject) => {
|
|
19
|
+
setTimeout(() => reject(( new Error(( localizeWithPath(
|
|
20
|
+
'vs/workbench/api/browser/mainThreadSaveParticipant',
|
|
21
|
+
'timeout.onWillSave',
|
|
22
|
+
"Aborted onWillSaveTextDocument-event after 1750ms"
|
|
23
|
+
))))), 1750);
|
|
24
|
+
this._proxy.$participateInSave(editorModel.resource, context.reason).then(values => {
|
|
25
|
+
if (!values.every(success => success)) {
|
|
26
|
+
return Promise.reject(( new Error('listener failed')));
|
|
27
|
+
}
|
|
28
|
+
return undefined;
|
|
29
|
+
}).then(resolve, reject);
|
|
30
|
+
}));
|
|
31
|
+
return raceCancellationError(p, token);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
let SaveParticipant = class SaveParticipant {
|
|
35
|
+
constructor(extHostContext, instantiationService, _textFileService) {
|
|
36
|
+
this._textFileService = _textFileService;
|
|
37
|
+
this._saveParticipantDisposable = this._textFileService.files.addSaveParticipant(instantiationService.createInstance(ExtHostSaveParticipant, extHostContext));
|
|
38
|
+
}
|
|
39
|
+
dispose() {
|
|
40
|
+
this._saveParticipantDisposable.dispose();
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
SaveParticipant = __decorate([
|
|
44
|
+
extHostCustomer,
|
|
45
|
+
( __param(1, IInstantiationService)),
|
|
46
|
+
( __param(2, ITextFileService))
|
|
47
|
+
], SaveParticipant);
|
|
48
|
+
|
|
49
|
+
export { SaveParticipant };
|