@codingame/monaco-vscode-api 1.78.5-next.0 → 1.78.5
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/dist/json.js +1 -1
- package/dist/service-override/configuration.js +2 -2
- package/dist/service-override/keybindings.js +1 -1
- package/dist/services.js +2 -2
- package/dist/vscode/vs/base/common/jsonEdit.js +1 -1
- package/dist/vscode/vs/base/common/jsonFormatter.js +1 -1
- package/dist/vscode/vs/platform/extensionResourceLoader/common/extensionResourceLoader.js +1 -1
- package/dist/vscode/vs/platform/files/common/fileService.js +2 -2
- package/dist/vscode/vs/platform/telemetry/common/telemetryUtils.js +1 -1
- package/dist/vscode/vs/platform/userDataSync/common/settingsMerge.js +1 -1
- package/dist/vscode/vs/platform/workspaces/common/workspaces.js +3 -3
- package/dist/vscode/vs/workbench/api/browser/mainThreadBulkEdits.js +1 -1
- package/dist/vscode/vs/workbench/api/browser/mainThreadDiagnostics.js +1 -1
- package/dist/vscode/vs/workbench/api/browser/mainThreadDocuments.js +1 -1
- package/dist/vscode/vs/workbench/api/browser/mainThreadDocumentsAndEditors.js +1 -1
- package/dist/vscode/vs/workbench/api/browser/mainThreadFileSystemEventService.js +1 -1
- package/dist/vscode/vs/workbench/api/browser/mainThreadLanguageFeatures.js +1 -1
- package/dist/vscode/vs/workbench/api/browser/mainThreadTelemetry.js +1 -1
- package/dist/vscode/vs/workbench/api/common/extHostExtensionService.js +8 -8
- package/dist/vscode/vs/workbench/api/common/extHostTelemetry.js +1 -1
- package/dist/vscode/vs/workbench/browser/parts/dialogs/dialog.web.contribution.js +1 -1
- package/dist/vscode/vs/workbench/browser/parts/dialogs/dialogHandler.js +1 -1
- package/dist/vscode/vs/workbench/common/contributions.js +1 -1
- package/dist/vscode/vs/workbench/contrib/codeEditor/browser/languageConfigurationExtensionPoint.js +1 -1
- package/dist/vscode/vs/workbench/contrib/debug/browser/callStackEditorContribution.js +1 -1
- package/dist/vscode/vs/workbench/contrib/debug/browser/debugConfigurationManager.js +3 -3
- package/dist/vscode/vs/workbench/contrib/debug/browser/debugEditorContribution.js +2 -2
- package/dist/vscode/vs/workbench/contrib/debug/browser/debugService.js +1 -1
- package/dist/vscode/vs/workbench/contrib/debug/browser/debugSession.js +2 -2
- package/dist/vscode/vs/workbench/contrib/debug/common/debugModel.js +1 -1
- package/dist/vscode/vs/workbench/contrib/debug/common/debugStorage.js +1 -1
- package/dist/vscode/vs/workbench/contrib/files/browser/explorerService.js +1 -1
- package/dist/vscode/vs/workbench/contrib/quickaccess/browser/commandsQuickAccess.js +1 -1
- package/dist/vscode/vs/workbench/contrib/snippets/browser/snippetsFile.js +1 -1
- package/dist/vscode/vs/workbench/services/configuration/browser/configurationService.js +1 -1
- package/dist/vscode/vs/workbench/services/configuration/common/configurationEditing.js +4 -4
- package/dist/vscode/vs/workbench/services/configuration/common/jsonEditingService.js +2 -2
- package/dist/vscode/vs/workbench/services/decorations/browser/decorationsService.js +1 -1
- package/dist/vscode/vs/workbench/services/extensions/common/extensionsRegistry.js +1 -1
- package/dist/vscode/vs/workbench/services/keybinding/browser/keybindingService.js +1 -1
- package/dist/vscode/vs/workbench/services/keybinding/browser/keyboardLayoutService.js +1 -1
- package/dist/vscode/vs/workbench/services/lifecycle/common/lifecycleService.js +1 -1
- package/dist/vscode/vs/workbench/services/preferences/browser/preferencesService.js +2 -2
- package/dist/vscode/vs/workbench/services/preferences/common/preferencesModels.js +1 -1
- package/dist/vscode/vs/workbench/services/search/common/searchService.js +1 -1
- package/dist/vscode/vs/workbench/services/textfile/browser/browserTextFileService.js +1 -1
- package/dist/vscode/vs/workbench/services/textfile/browser/textFileService.js +2 -2
- package/dist/vscode/vs/workbench/services/textfile/common/encoding.js +1 -1
- package/dist/vscode/vs/workbench/services/textfile/common/textEditorService.js +1 -1
- package/dist/vscode/vs/workbench/services/textfile/common/textFileEditorModel.js +1 -1
- package/dist/vscode/vs/workbench/services/textfile/common/textFileEditorModelManager.js +1 -1
- package/dist/vscode/vs/workbench/services/textmodelResolver/common/textModelResolverService.js +1 -1
- package/dist/vscode/vs/workbench/services/themes/browser/fileIconThemeData.js +3 -3
- package/dist/vscode/vs/workbench/services/themes/browser/productIconThemeData.js +3 -3
- package/dist/vscode/vs/workbench/services/themes/browser/workbenchThemeService.js +1 -1
- package/dist/vscode/vs/workbench/services/themes/common/colorThemeData.js +5 -5
- package/dist/vscode/vs/workbench/services/userDataProfile/common/userDataProfileService.js +1 -1
- package/dist/vscode/vs/workbench/services/workingCopy/common/workingCopyBackupService.js +1 -1
- package/dist/vscode/vs/workbench/services/workingCopy/common/workingCopyFileService.js +1 -1
- package/dist/vscode/vs/workbench/services/workspaces/browser/abstractWorkspaceEditingService.js +2 -2
- package/dist/vscode/vs/workbench/services/workspaces/browser/workspacesService.js +1 -1
- package/dist/vscode-services/missing-services.js +3 -3
- package/monaco-editor-treemending.patch +819 -819
- package/package.json +3 -2
- package/dist/vscode/vs/base/common/json.js +0 -713
- package/dist/vscode/vs/base/common/performance.js +0 -18
- package/dist/vscode/vs/base/common/stream.js +0 -300
- package/dist/vscode/vs/platform/product/common/productService.js +0 -4
- package/dist/vscode/vs/platform/remote/common/remoteHosts.js +0 -18
- package/dist/vscode/vs/platform/uriIdentity/common/uriIdentity.js +0 -3
- package/dist/vscode/vs/platform/userDataProfile/common/userDataProfile.js +0 -427
|
@@ -1,427 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../node_modules/tslib/tslib.es6.js';
|
|
2
|
-
import { hash } from 'monaco-editor/esm/vs/base/common/hash.js';
|
|
3
|
-
import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
4
|
-
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
5
|
-
import { joinPath, basename } from 'monaco-editor/esm/vs/base/common/resources.js';
|
|
6
|
-
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
7
|
-
import { localize } from 'monaco-editor/esm/vs/nls.js';
|
|
8
|
-
import { IEnvironmentService } from 'monaco-editor/esm/vs/platform/environment/common/environment.js';
|
|
9
|
-
import { toFileOperationResult, IFileService } from 'monaco-editor/esm/vs/platform/files/common/files.js';
|
|
10
|
-
import { createDecorator } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
11
|
-
import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
12
|
-
import { isSingleFolderWorkspaceIdentifier, isWorkspaceIdentifier } from 'monaco-editor/esm/vs/platform/workspace/common/workspace.js';
|
|
13
|
-
import { ResourceMap } from 'monaco-editor/esm/vs/base/common/map.js';
|
|
14
|
-
import { IUriIdentityService } from '../../uriIdentity/common/uriIdentity.js';
|
|
15
|
-
import { Promises } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
16
|
-
import { generateUuid } from 'monaco-editor/esm/vs/base/common/uuid.js';
|
|
17
|
-
import { escapeRegExpCharacters } from 'monaco-editor/esm/vs/base/common/strings.js';
|
|
18
|
-
import { isString } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
19
|
-
const IUserDataProfilesService = ( createDecorator('IUserDataProfilesService'));
|
|
20
|
-
function toUserDataProfile(id, name, location, profilesCacheHome, options) {
|
|
21
|
-
return {
|
|
22
|
-
id,
|
|
23
|
-
name,
|
|
24
|
-
location,
|
|
25
|
-
isDefault: false,
|
|
26
|
-
shortName: options?.shortName,
|
|
27
|
-
globalStorageHome: joinPath(location, 'globalStorage'),
|
|
28
|
-
settingsResource: joinPath(location, 'settings.json'),
|
|
29
|
-
keybindingsResource: joinPath(location, 'keybindings.json'),
|
|
30
|
-
tasksResource: joinPath(location, 'tasks.json'),
|
|
31
|
-
snippetsHome: joinPath(location, 'snippets'),
|
|
32
|
-
extensionsResource: joinPath(location, 'extensions.json'),
|
|
33
|
-
cacheHome: joinPath(profilesCacheHome, id),
|
|
34
|
-
useDefaultFlags: options?.useDefaultFlags,
|
|
35
|
-
isTransient: options?.transient
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
let UserDataProfilesService = class UserDataProfilesService extends Disposable {
|
|
39
|
-
get defaultProfile() { return this.profiles[0]; }
|
|
40
|
-
get profiles() { return [...this.profilesObject.profiles, ...this.transientProfilesObject.profiles]; }
|
|
41
|
-
constructor(environmentService, fileService, uriIdentityService, logService) {
|
|
42
|
-
super();
|
|
43
|
-
this.environmentService = environmentService;
|
|
44
|
-
this.fileService = fileService;
|
|
45
|
-
this.uriIdentityService = uriIdentityService;
|
|
46
|
-
this.logService = logService;
|
|
47
|
-
this.enabled = true;
|
|
48
|
-
this._onDidChangeProfiles = this._register(( new Emitter()));
|
|
49
|
-
this.onDidChangeProfiles = this._onDidChangeProfiles.event;
|
|
50
|
-
this._onWillCreateProfile = this._register(( new Emitter()));
|
|
51
|
-
this.onWillCreateProfile = this._onWillCreateProfile.event;
|
|
52
|
-
this._onWillRemoveProfile = this._register(( new Emitter()));
|
|
53
|
-
this.onWillRemoveProfile = this._onWillRemoveProfile.event;
|
|
54
|
-
this._onDidResetWorkspaces = this._register(( new Emitter()));
|
|
55
|
-
this.onDidResetWorkspaces = this._onDidResetWorkspaces.event;
|
|
56
|
-
this.profileCreationPromises = ( new Map());
|
|
57
|
-
this.transientProfilesObject = {
|
|
58
|
-
profiles: [],
|
|
59
|
-
workspaces: ( new ResourceMap()),
|
|
60
|
-
emptyWindows: ( new Map())
|
|
61
|
-
};
|
|
62
|
-
this.profilesHome = joinPath(this.environmentService.userRoamingDataHome, 'profiles');
|
|
63
|
-
this.profilesCacheHome = joinPath(this.environmentService.cacheHome, 'CachedProfilesData');
|
|
64
|
-
}
|
|
65
|
-
init() {
|
|
66
|
-
this._profilesObject = undefined;
|
|
67
|
-
}
|
|
68
|
-
setEnablement(enabled) {
|
|
69
|
-
if (this.enabled !== enabled) {
|
|
70
|
-
this._profilesObject = undefined;
|
|
71
|
-
this.enabled = enabled;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
isEnabled() {
|
|
75
|
-
return this.enabled;
|
|
76
|
-
}
|
|
77
|
-
get profilesObject() {
|
|
78
|
-
if (!this._profilesObject) {
|
|
79
|
-
const profiles = [];
|
|
80
|
-
if (this.enabled) {
|
|
81
|
-
try {
|
|
82
|
-
for (const storedProfile of this.getStoredProfiles()) {
|
|
83
|
-
if (!storedProfile.name || !isString(storedProfile.name) || !storedProfile.location) {
|
|
84
|
-
this.logService.warn('Skipping the invalid stored profile', storedProfile.location || storedProfile.name);
|
|
85
|
-
continue;
|
|
86
|
-
}
|
|
87
|
-
profiles.push(toUserDataProfile(basename(storedProfile.location), storedProfile.name, storedProfile.location, this.profilesCacheHome, { shortName: storedProfile.shortName, useDefaultFlags: storedProfile.useDefaultFlags }));
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
catch (error) {
|
|
91
|
-
this.logService.error(error);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
const workspaces = ( new ResourceMap());
|
|
95
|
-
const emptyWindows = ( new Map());
|
|
96
|
-
const defaultProfile = this.createDefaultProfile();
|
|
97
|
-
profiles.unshift({ ...defaultProfile, extensionsResource: this.getDefaultProfileExtensionsLocation() ?? defaultProfile.extensionsResource, isDefault: true });
|
|
98
|
-
if (profiles.length) {
|
|
99
|
-
try {
|
|
100
|
-
const profileAssociaitions = this.getStoredProfileAssociations();
|
|
101
|
-
if (profileAssociaitions.workspaces) {
|
|
102
|
-
for (const [workspacePath, profileId] of Object.entries(profileAssociaitions.workspaces)) {
|
|
103
|
-
const workspace = ( URI.parse(workspacePath));
|
|
104
|
-
const profile = profiles.find(p => p.id === profileId);
|
|
105
|
-
if (profile) {
|
|
106
|
-
workspaces.set(workspace, profile);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
if (profileAssociaitions.emptyWindows) {
|
|
111
|
-
for (const [windowId, profileId] of Object.entries(profileAssociaitions.emptyWindows)) {
|
|
112
|
-
const profile = profiles.find(p => p.id === profileId);
|
|
113
|
-
if (profile) {
|
|
114
|
-
emptyWindows.set(windowId, profile);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
catch (error) {
|
|
120
|
-
this.logService.error(error);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
this._profilesObject = { profiles, workspaces, emptyWindows };
|
|
124
|
-
}
|
|
125
|
-
return this._profilesObject;
|
|
126
|
-
}
|
|
127
|
-
createDefaultProfile() {
|
|
128
|
-
return toUserDataProfile('__default__profile__', ( localize('defaultProfile', "Default")), this.environmentService.userRoamingDataHome, this.profilesCacheHome);
|
|
129
|
-
}
|
|
130
|
-
async createTransientProfile(workspaceIdentifier) {
|
|
131
|
-
const namePrefix = `Temp`;
|
|
132
|
-
const nameRegEx = ( new RegExp(`${escapeRegExpCharacters(namePrefix)}\\s(\\d+)`));
|
|
133
|
-
let nameIndex = 0;
|
|
134
|
-
for (const profile of this.profiles) {
|
|
135
|
-
const matches = nameRegEx.exec(profile.name);
|
|
136
|
-
const index = matches ? parseInt(matches[1]) : 0;
|
|
137
|
-
nameIndex = index > nameIndex ? index : nameIndex;
|
|
138
|
-
}
|
|
139
|
-
const name = `${namePrefix} ${nameIndex + 1}`;
|
|
140
|
-
return this.createProfile(( hash(generateUuid()).toString(16)), name, { transient: true }, workspaceIdentifier);
|
|
141
|
-
}
|
|
142
|
-
async createNamedProfile(name, options, workspaceIdentifier) {
|
|
143
|
-
return this.createProfile(( hash(generateUuid()).toString(16)), name, options, workspaceIdentifier);
|
|
144
|
-
}
|
|
145
|
-
async createProfile(id, name, options, workspaceIdentifier) {
|
|
146
|
-
if (!this.enabled) {
|
|
147
|
-
throw new Error(`Profiles are disabled in the current environment.`);
|
|
148
|
-
}
|
|
149
|
-
const profile = await this.doCreateProfile(id, name, options);
|
|
150
|
-
if (workspaceIdentifier) {
|
|
151
|
-
await this.setProfileForWorkspace(workspaceIdentifier, profile);
|
|
152
|
-
}
|
|
153
|
-
return profile;
|
|
154
|
-
}
|
|
155
|
-
async doCreateProfile(id, name, options) {
|
|
156
|
-
if (!isString(name) || !name) {
|
|
157
|
-
throw new Error('Name of the profile is mandatory and must be of type `string`');
|
|
158
|
-
}
|
|
159
|
-
let profileCreationPromise = this.profileCreationPromises.get(name);
|
|
160
|
-
if (!profileCreationPromise) {
|
|
161
|
-
profileCreationPromise = (async () => {
|
|
162
|
-
try {
|
|
163
|
-
const existing = this.profiles.find(p => p.name === name || p.id === id);
|
|
164
|
-
if (existing) {
|
|
165
|
-
return existing;
|
|
166
|
-
}
|
|
167
|
-
const profile = toUserDataProfile(id, name, joinPath(this.profilesHome, id), this.profilesCacheHome, options);
|
|
168
|
-
await this.fileService.createFolder(profile.location);
|
|
169
|
-
const joiners = [];
|
|
170
|
-
this._onWillCreateProfile.fire({
|
|
171
|
-
profile,
|
|
172
|
-
join(promise) {
|
|
173
|
-
joiners.push(promise);
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
await Promises.settled(joiners);
|
|
177
|
-
this.updateProfiles([profile], [], []);
|
|
178
|
-
return profile;
|
|
179
|
-
}
|
|
180
|
-
finally {
|
|
181
|
-
this.profileCreationPromises.delete(name);
|
|
182
|
-
}
|
|
183
|
-
})();
|
|
184
|
-
this.profileCreationPromises.set(name, profileCreationPromise);
|
|
185
|
-
}
|
|
186
|
-
return profileCreationPromise;
|
|
187
|
-
}
|
|
188
|
-
async updateProfile(profileToUpdate, options) {
|
|
189
|
-
if (!this.enabled) {
|
|
190
|
-
throw new Error(`Profiles are disabled in the current environment.`);
|
|
191
|
-
}
|
|
192
|
-
let profile = this.profiles.find(p => p.id === profileToUpdate.id);
|
|
193
|
-
if (!profile) {
|
|
194
|
-
throw new Error(`Profile '${profileToUpdate.name}' does not exist`);
|
|
195
|
-
}
|
|
196
|
-
profile = toUserDataProfile(profile.id, options.name ?? profile.name, profile.location, this.profilesCacheHome, { shortName: options.shortName ?? profile.shortName, transient: options.transient ?? profile.isTransient, useDefaultFlags: options.useDefaultFlags ?? profile.useDefaultFlags });
|
|
197
|
-
this.updateProfiles([], [], [profile]);
|
|
198
|
-
return profile;
|
|
199
|
-
}
|
|
200
|
-
async removeProfile(profileToRemove) {
|
|
201
|
-
if (!this.enabled) {
|
|
202
|
-
throw new Error(`Profiles are disabled in the current environment.`);
|
|
203
|
-
}
|
|
204
|
-
if (profileToRemove.isDefault) {
|
|
205
|
-
throw new Error('Cannot remove default profile');
|
|
206
|
-
}
|
|
207
|
-
const profile = this.profiles.find(p => p.id === profileToRemove.id);
|
|
208
|
-
if (!profile) {
|
|
209
|
-
throw new Error(`Profile '${profileToRemove.name}' does not exist`);
|
|
210
|
-
}
|
|
211
|
-
const joiners = [];
|
|
212
|
-
this._onWillRemoveProfile.fire({
|
|
213
|
-
profile,
|
|
214
|
-
join(promise) {
|
|
215
|
-
joiners.push(promise);
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
try {
|
|
219
|
-
await Promise.allSettled(joiners);
|
|
220
|
-
}
|
|
221
|
-
catch (error) {
|
|
222
|
-
this.logService.error(error);
|
|
223
|
-
}
|
|
224
|
-
for (const windowId of [...( this.profilesObject.emptyWindows.keys())]) {
|
|
225
|
-
if (profile.id === this.profilesObject.emptyWindows.get(windowId)?.id) {
|
|
226
|
-
this.profilesObject.emptyWindows.delete(windowId);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
for (const workspace of [...( this.profilesObject.workspaces.keys())]) {
|
|
230
|
-
if (profile.id === this.profilesObject.workspaces.get(workspace)?.id) {
|
|
231
|
-
this.profilesObject.workspaces.delete(workspace);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
this.updateStoredProfileAssociations();
|
|
235
|
-
this.updateProfiles([], [profile], []);
|
|
236
|
-
try {
|
|
237
|
-
await this.fileService.del(profile.cacheHome, { recursive: true });
|
|
238
|
-
}
|
|
239
|
-
catch (error) {
|
|
240
|
-
if (toFileOperationResult(error) !== 1 ) {
|
|
241
|
-
this.logService.error(error);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
try {
|
|
245
|
-
if (this.profiles.length === 1) {
|
|
246
|
-
await this.fileService.del(this.profilesHome, { recursive: true });
|
|
247
|
-
}
|
|
248
|
-
else {
|
|
249
|
-
await this.fileService.del(profile.location, { recursive: true });
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
catch (error) {
|
|
253
|
-
this.logService.error(error);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
async setProfileForWorkspace(workspaceIdentifier, profileToSet) {
|
|
257
|
-
if (!this.enabled) {
|
|
258
|
-
throw new Error(`Profiles are disabled in the current environment.`);
|
|
259
|
-
}
|
|
260
|
-
const profile = this.profiles.find(p => p.id === profileToSet.id);
|
|
261
|
-
if (!profile) {
|
|
262
|
-
throw new Error(`Profile '${profileToSet.name}' does not exist`);
|
|
263
|
-
}
|
|
264
|
-
this.updateWorkspaceAssociation(workspaceIdentifier, profile);
|
|
265
|
-
}
|
|
266
|
-
unsetWorkspace(workspaceIdentifier, transient) {
|
|
267
|
-
if (!this.enabled) {
|
|
268
|
-
throw new Error(`Profiles are disabled in the current environment.`);
|
|
269
|
-
}
|
|
270
|
-
this.updateWorkspaceAssociation(workspaceIdentifier, undefined, transient);
|
|
271
|
-
}
|
|
272
|
-
async resetWorkspaces() {
|
|
273
|
-
this.transientProfilesObject.workspaces.clear();
|
|
274
|
-
this.transientProfilesObject.emptyWindows.clear();
|
|
275
|
-
this.profilesObject.workspaces.clear();
|
|
276
|
-
this.profilesObject.emptyWindows.clear();
|
|
277
|
-
this.updateStoredProfileAssociations();
|
|
278
|
-
this._onDidResetWorkspaces.fire();
|
|
279
|
-
}
|
|
280
|
-
async cleanUp() {
|
|
281
|
-
if (!this.enabled) {
|
|
282
|
-
return;
|
|
283
|
-
}
|
|
284
|
-
if (await this.fileService.exists(this.profilesHome)) {
|
|
285
|
-
const stat = await this.fileService.resolve(this.profilesHome);
|
|
286
|
-
await Promise.all(( (stat.children || [])
|
|
287
|
-
.filter(child => child.isDirectory && this.profiles.every(p => !this.uriIdentityService.extUri.isEqual(p.location, child.resource)))
|
|
288
|
-
.map(child => this.fileService.del(child.resource, { recursive: true }))));
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
async cleanUpTransientProfiles() {
|
|
292
|
-
if (!this.enabled) {
|
|
293
|
-
return;
|
|
294
|
-
}
|
|
295
|
-
const unAssociatedTransientProfiles = this.transientProfilesObject.profiles.filter(p => !this.isProfileAssociatedToWorkspace(p));
|
|
296
|
-
await Promise.allSettled(( unAssociatedTransientProfiles.map(p => this.removeProfile(p))));
|
|
297
|
-
}
|
|
298
|
-
getProfileForWorkspace(workspaceIdentifier) {
|
|
299
|
-
const workspace = this.getWorkspace(workspaceIdentifier);
|
|
300
|
-
return URI.isUri(workspace) ? this.transientProfilesObject.workspaces.get(workspace) ?? this.profilesObject.workspaces.get(workspace) : this.transientProfilesObject.emptyWindows.get(workspace) ?? this.profilesObject.emptyWindows.get(workspace);
|
|
301
|
-
}
|
|
302
|
-
getWorkspace(workspaceIdentifier) {
|
|
303
|
-
if (isSingleFolderWorkspaceIdentifier(workspaceIdentifier)) {
|
|
304
|
-
return workspaceIdentifier.uri;
|
|
305
|
-
}
|
|
306
|
-
if (isWorkspaceIdentifier(workspaceIdentifier)) {
|
|
307
|
-
return workspaceIdentifier.configPath;
|
|
308
|
-
}
|
|
309
|
-
return workspaceIdentifier.id;
|
|
310
|
-
}
|
|
311
|
-
isProfileAssociatedToWorkspace(profile) {
|
|
312
|
-
if (( [...( this.transientProfilesObject.emptyWindows.values())].some(
|
|
313
|
-
windowProfile => this.uriIdentityService.extUri.isEqual(windowProfile.location, profile.location)
|
|
314
|
-
))) {
|
|
315
|
-
return true;
|
|
316
|
-
}
|
|
317
|
-
if (( [...( this.transientProfilesObject.workspaces.values())].some(
|
|
318
|
-
workspaceProfile => this.uriIdentityService.extUri.isEqual(workspaceProfile.location, profile.location)
|
|
319
|
-
))) {
|
|
320
|
-
return true;
|
|
321
|
-
}
|
|
322
|
-
if (( [...( this.profilesObject.emptyWindows.values())].some(
|
|
323
|
-
windowProfile => this.uriIdentityService.extUri.isEqual(windowProfile.location, profile.location)
|
|
324
|
-
))) {
|
|
325
|
-
return true;
|
|
326
|
-
}
|
|
327
|
-
if (( [...( this.profilesObject.workspaces.values())].some(
|
|
328
|
-
workspaceProfile => this.uriIdentityService.extUri.isEqual(workspaceProfile.location, profile.location)
|
|
329
|
-
))) {
|
|
330
|
-
return true;
|
|
331
|
-
}
|
|
332
|
-
return false;
|
|
333
|
-
}
|
|
334
|
-
updateProfiles(added, removed, updated) {
|
|
335
|
-
const allProfiles = [...this.profiles, ...added];
|
|
336
|
-
const storedProfiles = [];
|
|
337
|
-
this.transientProfilesObject.profiles = [];
|
|
338
|
-
for (let profile of allProfiles) {
|
|
339
|
-
if (profile.isDefault) {
|
|
340
|
-
continue;
|
|
341
|
-
}
|
|
342
|
-
if (( removed.some(p => profile.id === p.id))) {
|
|
343
|
-
continue;
|
|
344
|
-
}
|
|
345
|
-
profile = updated.find(p => profile.id === p.id) ?? profile;
|
|
346
|
-
if (profile.isTransient) {
|
|
347
|
-
this.transientProfilesObject.profiles.push(profile);
|
|
348
|
-
}
|
|
349
|
-
else {
|
|
350
|
-
storedProfiles.push({ location: profile.location, name: profile.name, shortName: profile.shortName, useDefaultFlags: profile.useDefaultFlags });
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
this.saveStoredProfiles(storedProfiles);
|
|
354
|
-
this._profilesObject = undefined;
|
|
355
|
-
this.triggerProfilesChanges(added, removed, updated);
|
|
356
|
-
}
|
|
357
|
-
triggerProfilesChanges(added, removed, updated) {
|
|
358
|
-
this._onDidChangeProfiles.fire({ added, removed, updated, all: this.profiles });
|
|
359
|
-
}
|
|
360
|
-
updateWorkspaceAssociation(workspaceIdentifier, newProfile, transient) {
|
|
361
|
-
transient = newProfile?.isTransient ? true : transient;
|
|
362
|
-
if (!transient) {
|
|
363
|
-
this.updateWorkspaceAssociation(workspaceIdentifier, undefined, true);
|
|
364
|
-
}
|
|
365
|
-
const workspace = this.getWorkspace(workspaceIdentifier);
|
|
366
|
-
const profilesObject = transient ? this.transientProfilesObject : this.profilesObject;
|
|
367
|
-
if (URI.isUri(workspace)) {
|
|
368
|
-
profilesObject.workspaces.delete(workspace);
|
|
369
|
-
if (newProfile) {
|
|
370
|
-
profilesObject.workspaces.set(workspace, newProfile);
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
else {
|
|
374
|
-
profilesObject.emptyWindows.delete(workspace);
|
|
375
|
-
if (newProfile) {
|
|
376
|
-
profilesObject.emptyWindows.set(workspace, newProfile);
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
if (!transient) {
|
|
380
|
-
this.updateStoredProfileAssociations();
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
updateStoredProfileAssociations() {
|
|
384
|
-
const workspaces = {};
|
|
385
|
-
for (const [workspace, profile] of this.profilesObject.workspaces.entries()) {
|
|
386
|
-
workspaces[( workspace.toString())] = profile.id;
|
|
387
|
-
}
|
|
388
|
-
const emptyWindows = {};
|
|
389
|
-
for (const [windowId, profile] of this.profilesObject.emptyWindows.entries()) {
|
|
390
|
-
emptyWindows[( windowId.toString())] = profile.id;
|
|
391
|
-
}
|
|
392
|
-
this.saveStoredProfileAssociations({ workspaces, emptyWindows });
|
|
393
|
-
this._profilesObject = undefined;
|
|
394
|
-
}
|
|
395
|
-
migrateStoredProfileAssociations(storedProfileAssociations) {
|
|
396
|
-
const workspaces = {};
|
|
397
|
-
const defaultProfile = this.createDefaultProfile();
|
|
398
|
-
if (storedProfileAssociations.workspaces) {
|
|
399
|
-
for (const [workspace, location] of Object.entries(storedProfileAssociations.workspaces)) {
|
|
400
|
-
const uri = ( URI.parse(location));
|
|
401
|
-
workspaces[workspace] = this.uriIdentityService.extUri.isEqual(uri, defaultProfile.location) ? defaultProfile.id : this.uriIdentityService.extUri.basename(uri);
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
const emptyWindows = {};
|
|
405
|
-
if (storedProfileAssociations.emptyWindows) {
|
|
406
|
-
for (const [workspace, location] of Object.entries(storedProfileAssociations.emptyWindows)) {
|
|
407
|
-
const uri = ( URI.parse(location));
|
|
408
|
-
emptyWindows[workspace] = this.uriIdentityService.extUri.isEqual(uri, defaultProfile.location) ? defaultProfile.id : this.uriIdentityService.extUri.basename(uri);
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
return { workspaces, emptyWindows };
|
|
412
|
-
}
|
|
413
|
-
getStoredProfiles() { return []; }
|
|
414
|
-
saveStoredProfiles(storedProfiles) { throw new Error('not implemented'); }
|
|
415
|
-
getStoredProfileAssociations() { return {}; }
|
|
416
|
-
saveStoredProfileAssociations(storedProfileAssociations) { throw new Error('not implemented'); }
|
|
417
|
-
getDefaultProfileExtensionsLocation() { return undefined; }
|
|
418
|
-
};
|
|
419
|
-
UserDataProfilesService.PROFILES_KEY = 'userDataProfiles';
|
|
420
|
-
UserDataProfilesService.PROFILE_ASSOCIATIONS_KEY = 'profileAssociations';
|
|
421
|
-
UserDataProfilesService = ( __decorate([
|
|
422
|
-
( __param(0, IEnvironmentService)),
|
|
423
|
-
( __param(1, IFileService)),
|
|
424
|
-
( __param(2, IUriIdentityService)),
|
|
425
|
-
( __param(3, ILogService))
|
|
426
|
-
], UserDataProfilesService));
|
|
427
|
-
export { IUserDataProfilesService, UserDataProfilesService, toUserDataProfile };
|