@codingame/monaco-vscode-user-data-sync-service-override 1.85.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/external/rollup-plugin-styles/dist/runtime/inject-css.js +3 -0
- package/external/tslib/tslib.es6.js +11 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/override/vs/platform/dialogs/common/dialogs.js +8 -0
- package/override/vs/platform/userDataSync/common/extensionsSync.js +4 -0
- package/override/vs/platform/userDataSync/common/globalStateSync.js +5 -0
- package/package.json +24 -0
- package/userDataSync.d.ts +5 -0
- package/userDataSync.js +106 -0
- package/vscode/src/vs/base/browser/ui/icons/iconSelectBox.css.js +6 -0
- package/vscode/src/vs/base/browser/ui/icons/iconSelectBox.js +248 -0
- package/vscode/src/vs/platform/userDataProfile/browser/userDataProfile.js +95 -0
- package/vscode/src/vs/platform/userDataProfile/common/userDataProfileStorageService.js +5 -0
- package/vscode/src/vs/platform/userDataSync/common/abstractSynchronizer.js +774 -0
- package/vscode/src/vs/platform/userDataSync/common/extensionsSync.js +251 -0
- package/vscode/src/vs/platform/userDataSync/common/globalStateSync.js +115 -0
- package/vscode/src/vs/platform/userDataSync/common/keybindingsMerge.js +277 -0
- package/vscode/src/vs/platform/userDataSync/common/keybindingsSync.js +318 -0
- package/vscode/src/vs/platform/userDataSync/common/settingsSync.js +316 -0
- package/vscode/src/vs/platform/userDataSync/common/snippetsMerge.js +126 -0
- package/vscode/src/vs/platform/userDataSync/common/snippetsSync.js +476 -0
- package/vscode/src/vs/platform/userDataSync/common/tasksSync.js +244 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataAutoSyncService.js +466 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataProfilesManifestMerge.js +92 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataProfilesManifestSync.js +261 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncEnablementService.js +77 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncLocalStoreService.js +150 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncLog.js +41 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncResourceProvider.js +449 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncService.js +783 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncStoreService.js +553 -0
- package/vscode/src/vs/workbench/browser/iconSelectBox.js +98 -0
- package/vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSync.contribution.js +111 -0
- package/vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSync.js +1467 -0
- package/vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSyncConflictsView.js +225 -0
- package/vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSyncTrigger.js +61 -0
- package/vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSyncViews.js +860 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/extensionsResource.js +342 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/globalStateResource.js +147 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/keybindingsResource.js +119 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/media/userDataProfileView.css.js +6 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/settingsResource.js +140 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/snippetsResource.js +155 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/tasksResource.js +118 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileImportExportService.js +1753 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileInit.js +150 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileManagement.js +190 -0
- package/vscode/src/vs/workbench/services/userDataSync/browser/userDataSyncEnablementService.js +10 -0
- package/vscode/src/vs/workbench/services/userDataSync/browser/userDataSyncInit.js +447 -0
- package/vscode/src/vs/workbench/services/userDataSync/browser/userDataSyncWorkbenchService.js +786 -0
- package/vscode/src/vs/workbench/services/userDataSync/browser/webUserDataSyncEnablementService.js +40 -0
- package/vscode/src/vs/workbench/services/userDataSync/common/userDataSyncUtil.js +48 -0
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { CancellationToken } from 'monaco-editor/esm/vs/base/common/cancellation.js';
|
|
3
|
+
import { DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
4
|
+
import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
|
|
5
|
+
import { GlobalExtensionEnablementService } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionEnablementService';
|
|
6
|
+
import { EXTENSION_INSTALL_SKIP_WALKTHROUGH_CONTEXT, IExtensionManagementService, IExtensionGalleryService, IGlobalExtensionEnablementService } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement';
|
|
7
|
+
import { areSameExtensions } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagementUtil';
|
|
8
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
9
|
+
import { ServiceCollection } from 'monaco-editor/esm/vs/platform/instantiation/common/serviceCollection.js';
|
|
10
|
+
import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
11
|
+
import { IStorageService } from 'monaco-editor/esm/vs/platform/storage/common/storage.js';
|
|
12
|
+
import { IUserDataProfileStorageService } from '../../../../platform/userDataProfile/common/userDataProfileStorageService.js';
|
|
13
|
+
import { TreeItemCollapsibleState } from 'vscode/vscode/vs/workbench/common/views';
|
|
14
|
+
import { IUserDataProfileService } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile';
|
|
15
|
+
|
|
16
|
+
let ExtensionsResourceInitializer = class ExtensionsResourceInitializer {
|
|
17
|
+
constructor(userDataProfileService, extensionManagementService, extensionGalleryService, extensionEnablementService, logService) {
|
|
18
|
+
this.userDataProfileService = userDataProfileService;
|
|
19
|
+
this.extensionManagementService = extensionManagementService;
|
|
20
|
+
this.extensionGalleryService = extensionGalleryService;
|
|
21
|
+
this.extensionEnablementService = extensionEnablementService;
|
|
22
|
+
this.logService = logService;
|
|
23
|
+
}
|
|
24
|
+
async initialize(content) {
|
|
25
|
+
const profileExtensions = JSON.parse(content);
|
|
26
|
+
const installedExtensions = await this.extensionManagementService.getInstalled(undefined, this.userDataProfileService.currentProfile.extensionsResource);
|
|
27
|
+
const extensionsToEnableOrDisable = [];
|
|
28
|
+
const extensionsToInstall = [];
|
|
29
|
+
for (const e of profileExtensions) {
|
|
30
|
+
const isDisabled = ( this.extensionEnablementService.getDisabledExtensions().some(disabledExtension => areSameExtensions(disabledExtension, e.identifier)));
|
|
31
|
+
const installedExtension = installedExtensions.find(installed => areSameExtensions(installed.identifier, e.identifier));
|
|
32
|
+
if (!installedExtension || (!installedExtension.isBuiltin && installedExtension.preRelease !== e.preRelease)) {
|
|
33
|
+
extensionsToInstall.push(e);
|
|
34
|
+
}
|
|
35
|
+
if (isDisabled !== !!e.disabled) {
|
|
36
|
+
extensionsToEnableOrDisable.push({ extension: e.identifier, enable: !e.disabled });
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const extensionsToUninstall = installedExtensions.filter(extension => !extension.isBuiltin && !( profileExtensions.some(({ identifier }) => areSameExtensions(identifier, extension.identifier))));
|
|
40
|
+
for (const { extension, enable } of extensionsToEnableOrDisable) {
|
|
41
|
+
if (enable) {
|
|
42
|
+
this.logService.trace(`Initializing Profile: Enabling extension...`, extension.id);
|
|
43
|
+
await this.extensionEnablementService.enableExtension(extension);
|
|
44
|
+
this.logService.info(`Initializing Profile: Enabled extension...`, extension.id);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
this.logService.trace(`Initializing Profile: Disabling extension...`, extension.id);
|
|
48
|
+
await this.extensionEnablementService.disableExtension(extension);
|
|
49
|
+
this.logService.info(`Initializing Profile: Disabled extension...`, extension.id);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (extensionsToInstall.length) {
|
|
53
|
+
const galleryExtensions = await this.extensionGalleryService.getExtensions(( extensionsToInstall.map(
|
|
54
|
+
e => ({ ...e.identifier, version: e.version, hasPreRelease: e.version ? undefined : e.preRelease })
|
|
55
|
+
)), CancellationToken.None);
|
|
56
|
+
await Promise.all(( extensionsToInstall.map(async (e) => {
|
|
57
|
+
const extension = galleryExtensions.find(galleryExtension => areSameExtensions(galleryExtension.identifier, e.identifier));
|
|
58
|
+
if (!extension) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (await this.extensionManagementService.canInstall(extension)) {
|
|
62
|
+
this.logService.trace(`Initializing Profile: Installing extension...`, extension.identifier.id, extension.version);
|
|
63
|
+
await this.extensionManagementService.installFromGallery(extension, {
|
|
64
|
+
isMachineScoped: false,
|
|
65
|
+
donotIncludePackAndDependencies: true,
|
|
66
|
+
installGivenVersion: !!e.version,
|
|
67
|
+
installPreReleaseVersion: e.preRelease,
|
|
68
|
+
profileLocation: this.userDataProfileService.currentProfile.extensionsResource,
|
|
69
|
+
context: { [EXTENSION_INSTALL_SKIP_WALKTHROUGH_CONTEXT]: true }
|
|
70
|
+
});
|
|
71
|
+
this.logService.info(`Initializing Profile: Installed extension...`, extension.identifier.id, extension.version);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
this.logService.info(`Initializing Profile: Skipped installing extension because it cannot be installed.`, extension.identifier.id);
|
|
75
|
+
}
|
|
76
|
+
})));
|
|
77
|
+
}
|
|
78
|
+
if (extensionsToUninstall.length) {
|
|
79
|
+
await Promise.all(( extensionsToUninstall.map(e => this.extensionManagementService.uninstall(e))));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
ExtensionsResourceInitializer = ( __decorate([
|
|
84
|
+
( __param(0, IUserDataProfileService)),
|
|
85
|
+
( __param(1, IExtensionManagementService)),
|
|
86
|
+
( __param(2, IExtensionGalleryService)),
|
|
87
|
+
( __param(3, IGlobalExtensionEnablementService)),
|
|
88
|
+
( __param(4, ILogService))
|
|
89
|
+
], ExtensionsResourceInitializer));
|
|
90
|
+
let ExtensionsResource = class ExtensionsResource {
|
|
91
|
+
constructor(extensionManagementService, extensionGalleryService, userDataProfileStorageService, instantiationService, logService) {
|
|
92
|
+
this.extensionManagementService = extensionManagementService;
|
|
93
|
+
this.extensionGalleryService = extensionGalleryService;
|
|
94
|
+
this.userDataProfileStorageService = userDataProfileStorageService;
|
|
95
|
+
this.instantiationService = instantiationService;
|
|
96
|
+
this.logService = logService;
|
|
97
|
+
}
|
|
98
|
+
async getContent(profile, exclude) {
|
|
99
|
+
const extensions = await this.getLocalExtensions(profile);
|
|
100
|
+
return this.toContent(extensions, exclude);
|
|
101
|
+
}
|
|
102
|
+
toContent(extensions, exclude) {
|
|
103
|
+
return JSON.stringify(exclude?.length ? extensions.filter(e => !exclude.includes(e.identifier.id.toLowerCase())) : extensions);
|
|
104
|
+
}
|
|
105
|
+
async apply(content, profile) {
|
|
106
|
+
return this.withProfileScopedServices(profile, async (extensionEnablementService) => {
|
|
107
|
+
const profileExtensions = await this.getProfileExtensions(content);
|
|
108
|
+
const installedExtensions = await this.extensionManagementService.getInstalled(undefined, profile.extensionsResource);
|
|
109
|
+
const extensionsToEnableOrDisable = [];
|
|
110
|
+
const extensionsToInstall = [];
|
|
111
|
+
for (const e of profileExtensions) {
|
|
112
|
+
const isDisabled = ( extensionEnablementService.getDisabledExtensions().some(disabledExtension => areSameExtensions(disabledExtension, e.identifier)));
|
|
113
|
+
const installedExtension = installedExtensions.find(installed => areSameExtensions(installed.identifier, e.identifier));
|
|
114
|
+
if (!installedExtension || (!installedExtension.isBuiltin && installedExtension.preRelease !== e.preRelease)) {
|
|
115
|
+
extensionsToInstall.push(e);
|
|
116
|
+
}
|
|
117
|
+
if (isDisabled !== !!e.disabled) {
|
|
118
|
+
extensionsToEnableOrDisable.push({ extension: e.identifier, enable: !e.disabled });
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
const extensionsToUninstall = installedExtensions.filter(extension => !extension.isBuiltin && !( profileExtensions.some(({ identifier }) => areSameExtensions(identifier, extension.identifier))) && !extension.isApplicationScoped);
|
|
122
|
+
for (const { extension, enable } of extensionsToEnableOrDisable) {
|
|
123
|
+
if (enable) {
|
|
124
|
+
this.logService.trace(`Importing Profile (${profile.name}): Enabling extension...`, extension.id);
|
|
125
|
+
await extensionEnablementService.enableExtension(extension);
|
|
126
|
+
this.logService.info(`Importing Profile (${profile.name}): Enabled extension...`, extension.id);
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
this.logService.trace(`Importing Profile (${profile.name}): Disabling extension...`, extension.id);
|
|
130
|
+
await extensionEnablementService.disableExtension(extension);
|
|
131
|
+
this.logService.info(`Importing Profile (${profile.name}): Disabled extension...`, extension.id);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (extensionsToInstall.length) {
|
|
135
|
+
this.logService.info(`Importing Profile (${profile.name}): Started installing extensions.`);
|
|
136
|
+
const galleryExtensions = await this.extensionGalleryService.getExtensions(( extensionsToInstall.map(
|
|
137
|
+
e => ({ ...e.identifier, version: e.version, hasPreRelease: e.version ? undefined : e.preRelease })
|
|
138
|
+
)), CancellationToken.None);
|
|
139
|
+
const installExtensionInfos = [];
|
|
140
|
+
await Promise.all(( extensionsToInstall.map(async (e) => {
|
|
141
|
+
const extension = galleryExtensions.find(galleryExtension => areSameExtensions(galleryExtension.identifier, e.identifier));
|
|
142
|
+
if (!extension) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
if (await this.extensionManagementService.canInstall(extension)) {
|
|
146
|
+
installExtensionInfos.push({
|
|
147
|
+
extension,
|
|
148
|
+
options: {
|
|
149
|
+
isMachineScoped: false,
|
|
150
|
+
donotIncludePackAndDependencies: true,
|
|
151
|
+
installGivenVersion: !!e.version,
|
|
152
|
+
installPreReleaseVersion: e.preRelease,
|
|
153
|
+
profileLocation: profile.extensionsResource,
|
|
154
|
+
context: { [EXTENSION_INSTALL_SKIP_WALKTHROUGH_CONTEXT]: true }
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
this.logService.info(`Importing Profile (${profile.name}): Skipped installing extension because it cannot be installed.`, extension.identifier.id);
|
|
160
|
+
}
|
|
161
|
+
})));
|
|
162
|
+
if (installExtensionInfos.length) {
|
|
163
|
+
await this.extensionManagementService.installGalleryExtensions(installExtensionInfos);
|
|
164
|
+
}
|
|
165
|
+
this.logService.info(`Importing Profile (${profile.name}): Finished installing extensions.`);
|
|
166
|
+
}
|
|
167
|
+
if (extensionsToUninstall.length) {
|
|
168
|
+
await Promise.all(( extensionsToUninstall.map(e => this.extensionManagementService.uninstall(e))));
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
async copy(from, to, disableExtensions) {
|
|
173
|
+
await this.extensionManagementService.copyExtensions(from.extensionsResource, to.extensionsResource);
|
|
174
|
+
const extensionsToDisable = await this.withProfileScopedServices(from, async (extensionEnablementService) => extensionEnablementService.getDisabledExtensions());
|
|
175
|
+
if (disableExtensions) {
|
|
176
|
+
const extensions = await this.extensionManagementService.getInstalled(1 , to.extensionsResource);
|
|
177
|
+
for (const extension of extensions) {
|
|
178
|
+
extensionsToDisable.push(extension.identifier);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
await this.withProfileScopedServices(to, async (extensionEnablementService) => Promise.all(( extensionsToDisable.map(extension => extensionEnablementService.disableExtension(extension)))));
|
|
182
|
+
}
|
|
183
|
+
async getLocalExtensions(profile) {
|
|
184
|
+
return this.withProfileScopedServices(profile, async (extensionEnablementService) => {
|
|
185
|
+
const result = [];
|
|
186
|
+
const installedExtensions = await this.extensionManagementService.getInstalled(undefined, profile.extensionsResource);
|
|
187
|
+
const disabledExtensions = extensionEnablementService.getDisabledExtensions();
|
|
188
|
+
for (const extension of installedExtensions) {
|
|
189
|
+
const { identifier, preRelease } = extension;
|
|
190
|
+
const disabled = ( disabledExtensions.some(disabledExtension => areSameExtensions(disabledExtension, identifier)));
|
|
191
|
+
if (extension.isBuiltin && !disabled) {
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
if (!extension.isBuiltin) {
|
|
195
|
+
if (!extension.identifier.uuid) {
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
const profileExtension = { identifier, displayName: extension.manifest.displayName };
|
|
200
|
+
if (disabled) {
|
|
201
|
+
profileExtension.disabled = true;
|
|
202
|
+
}
|
|
203
|
+
if (!extension.isBuiltin && extension.pinned) {
|
|
204
|
+
profileExtension.version = extension.manifest.version;
|
|
205
|
+
}
|
|
206
|
+
if (!profileExtension.version && preRelease) {
|
|
207
|
+
profileExtension.preRelease = true;
|
|
208
|
+
}
|
|
209
|
+
result.push(profileExtension);
|
|
210
|
+
}
|
|
211
|
+
return result;
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
async getProfileExtensions(content) {
|
|
215
|
+
return JSON.parse(content);
|
|
216
|
+
}
|
|
217
|
+
async withProfileScopedServices(profile, fn) {
|
|
218
|
+
return this.userDataProfileStorageService.withProfileScopedStorageService(profile, async (storageService) => {
|
|
219
|
+
const disposables = ( new DisposableStore());
|
|
220
|
+
const instantiationService = this.instantiationService.createChild(( new ServiceCollection([IStorageService, storageService])));
|
|
221
|
+
const extensionEnablementService = disposables.add(instantiationService.createInstance(GlobalExtensionEnablementService));
|
|
222
|
+
try {
|
|
223
|
+
return await fn(extensionEnablementService);
|
|
224
|
+
}
|
|
225
|
+
finally {
|
|
226
|
+
disposables.dispose();
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
ExtensionsResource = ( __decorate([
|
|
232
|
+
( __param(0, IExtensionManagementService)),
|
|
233
|
+
( __param(1, IExtensionGalleryService)),
|
|
234
|
+
( __param(2, IUserDataProfileStorageService)),
|
|
235
|
+
( __param(3, IInstantiationService)),
|
|
236
|
+
( __param(4, ILogService))
|
|
237
|
+
], ExtensionsResource));
|
|
238
|
+
class ExtensionsResourceTreeItem {
|
|
239
|
+
constructor() {
|
|
240
|
+
this.type = "extensions" ;
|
|
241
|
+
this.handle = "extensions" ;
|
|
242
|
+
this.label = { label: ( localizeWithPath(
|
|
243
|
+
'vs/workbench/services/userDataProfile/browser/extensionsResource',
|
|
244
|
+
'extensions',
|
|
245
|
+
"Extensions"
|
|
246
|
+
)) };
|
|
247
|
+
this.collapsibleState = TreeItemCollapsibleState.Expanded;
|
|
248
|
+
this.contextValue = "extensions" ;
|
|
249
|
+
this.excludedExtensions = ( new Set());
|
|
250
|
+
}
|
|
251
|
+
async getChildren() {
|
|
252
|
+
const extensions = (await this.getExtensions()).sort((a, b) => (a.displayName ?? a.identifier.id).localeCompare(b.displayName ?? b.identifier.id));
|
|
253
|
+
const that = this;
|
|
254
|
+
return ( extensions.map(e => ({
|
|
255
|
+
handle: e.identifier.id.toLowerCase(),
|
|
256
|
+
parent: this,
|
|
257
|
+
label: { label: e.displayName || e.identifier.id },
|
|
258
|
+
description: e.disabled ? ( localizeWithPath(
|
|
259
|
+
'vs/workbench/services/userDataProfile/browser/extensionsResource',
|
|
260
|
+
'disabled',
|
|
261
|
+
"Disabled"
|
|
262
|
+
)) : undefined,
|
|
263
|
+
collapsibleState: TreeItemCollapsibleState.None,
|
|
264
|
+
checkbox: that.checkbox ? {
|
|
265
|
+
get isChecked() { return !( that.excludedExtensions.has(e.identifier.id.toLowerCase())); },
|
|
266
|
+
set isChecked(value) {
|
|
267
|
+
if (value) {
|
|
268
|
+
that.excludedExtensions.delete(e.identifier.id.toLowerCase());
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
that.excludedExtensions.add(e.identifier.id.toLowerCase());
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
tooltip: ( localizeWithPath(
|
|
275
|
+
'vs/workbench/services/userDataProfile/browser/extensionsResource',
|
|
276
|
+
'exclude',
|
|
277
|
+
"Select {0} Extension",
|
|
278
|
+
e.displayName || e.identifier.id
|
|
279
|
+
)),
|
|
280
|
+
accessibilityInformation: {
|
|
281
|
+
label: ( localizeWithPath(
|
|
282
|
+
'vs/workbench/services/userDataProfile/browser/extensionsResource',
|
|
283
|
+
'exclude',
|
|
284
|
+
"Select {0} Extension",
|
|
285
|
+
e.displayName || e.identifier.id
|
|
286
|
+
)),
|
|
287
|
+
}
|
|
288
|
+
} : undefined,
|
|
289
|
+
command: {
|
|
290
|
+
id: 'extension.open',
|
|
291
|
+
title: '',
|
|
292
|
+
arguments: [e.identifier.id, undefined, true]
|
|
293
|
+
}
|
|
294
|
+
})));
|
|
295
|
+
}
|
|
296
|
+
async hasContent() {
|
|
297
|
+
const extensions = await this.getExtensions();
|
|
298
|
+
return extensions.length > 0;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
let ExtensionsResourceExportTreeItem = class ExtensionsResourceExportTreeItem extends ExtensionsResourceTreeItem {
|
|
302
|
+
constructor(profile, instantiationService) {
|
|
303
|
+
super();
|
|
304
|
+
this.profile = profile;
|
|
305
|
+
this.instantiationService = instantiationService;
|
|
306
|
+
}
|
|
307
|
+
isFromDefaultProfile() {
|
|
308
|
+
return !this.profile.isDefault && !!this.profile.useDefaultFlags?.extensions;
|
|
309
|
+
}
|
|
310
|
+
getExtensions() {
|
|
311
|
+
return this.instantiationService.createInstance(ExtensionsResource).getLocalExtensions(this.profile);
|
|
312
|
+
}
|
|
313
|
+
async getContent() {
|
|
314
|
+
return this.instantiationService.createInstance(ExtensionsResource).getContent(this.profile, [...( this.excludedExtensions.values())]);
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
ExtensionsResourceExportTreeItem = ( __decorate([
|
|
318
|
+
( __param(1, IInstantiationService))
|
|
319
|
+
], ExtensionsResourceExportTreeItem));
|
|
320
|
+
let ExtensionsResourceImportTreeItem = class ExtensionsResourceImportTreeItem extends ExtensionsResourceTreeItem {
|
|
321
|
+
constructor(content, instantiationService) {
|
|
322
|
+
super();
|
|
323
|
+
this.content = content;
|
|
324
|
+
this.instantiationService = instantiationService;
|
|
325
|
+
}
|
|
326
|
+
isFromDefaultProfile() {
|
|
327
|
+
return false;
|
|
328
|
+
}
|
|
329
|
+
getExtensions() {
|
|
330
|
+
return this.instantiationService.createInstance(ExtensionsResource).getProfileExtensions(this.content);
|
|
331
|
+
}
|
|
332
|
+
async getContent() {
|
|
333
|
+
const extensionsResource = this.instantiationService.createInstance(ExtensionsResource);
|
|
334
|
+
const extensions = await extensionsResource.getProfileExtensions(this.content);
|
|
335
|
+
return extensionsResource.toContent(extensions, [...( this.excludedExtensions.values())]);
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
ExtensionsResourceImportTreeItem = ( __decorate([
|
|
339
|
+
( __param(1, IInstantiationService))
|
|
340
|
+
], ExtensionsResourceImportTreeItem));
|
|
341
|
+
|
|
342
|
+
export { ExtensionsResource, ExtensionsResourceExportTreeItem, ExtensionsResourceImportTreeItem, ExtensionsResourceInitializer, ExtensionsResourceTreeItem };
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
|
|
3
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
4
|
+
import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
5
|
+
import { IStorageService } from 'monaco-editor/esm/vs/platform/storage/common/storage.js';
|
|
6
|
+
import { IUriIdentityService } from 'monaco-editor/esm/vs/platform/uriIdentity/common/uriIdentity.js';
|
|
7
|
+
import { IUserDataProfileStorageService } from '../../../../platform/userDataProfile/common/userDataProfileStorageService.js';
|
|
8
|
+
import { API_OPEN_EDITOR_COMMAND_ID } from 'vscode/vscode/vs/workbench/browser/parts/editor/editorCommands';
|
|
9
|
+
import { TreeItemCollapsibleState } from 'vscode/vscode/vs/workbench/common/views';
|
|
10
|
+
|
|
11
|
+
let GlobalStateResourceInitializer = class GlobalStateResourceInitializer {
|
|
12
|
+
constructor(storageService) {
|
|
13
|
+
this.storageService = storageService;
|
|
14
|
+
}
|
|
15
|
+
async initialize(content) {
|
|
16
|
+
const globalState = JSON.parse(content);
|
|
17
|
+
const storageKeys = ( Object.keys(globalState.storage));
|
|
18
|
+
if (storageKeys.length) {
|
|
19
|
+
const storageEntries = [];
|
|
20
|
+
for (const key of storageKeys) {
|
|
21
|
+
storageEntries.push({ key, value: globalState.storage[key], scope: 0 , target: 0 });
|
|
22
|
+
}
|
|
23
|
+
this.storageService.storeAll(storageEntries, true);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
GlobalStateResourceInitializer = ( __decorate([
|
|
28
|
+
( __param(0, IStorageService))
|
|
29
|
+
], GlobalStateResourceInitializer));
|
|
30
|
+
let GlobalStateResource = class GlobalStateResource {
|
|
31
|
+
constructor(storageService, userDataProfileStorageService, logService) {
|
|
32
|
+
this.storageService = storageService;
|
|
33
|
+
this.userDataProfileStorageService = userDataProfileStorageService;
|
|
34
|
+
this.logService = logService;
|
|
35
|
+
}
|
|
36
|
+
async getContent(profile) {
|
|
37
|
+
const globalState = await this.getGlobalState(profile);
|
|
38
|
+
return JSON.stringify(globalState);
|
|
39
|
+
}
|
|
40
|
+
async apply(content, profile) {
|
|
41
|
+
const globalState = JSON.parse(content);
|
|
42
|
+
await this.writeGlobalState(globalState, profile);
|
|
43
|
+
}
|
|
44
|
+
async getGlobalState(profile) {
|
|
45
|
+
const storage = {};
|
|
46
|
+
const storageData = await this.userDataProfileStorageService.readStorageData(profile);
|
|
47
|
+
for (const [key, value] of storageData) {
|
|
48
|
+
if (value.value !== undefined && value.target === 0 ) {
|
|
49
|
+
storage[key] = value.value;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return { storage };
|
|
53
|
+
}
|
|
54
|
+
async writeGlobalState(globalState, profile) {
|
|
55
|
+
const storageKeys = ( Object.keys(globalState.storage));
|
|
56
|
+
if (storageKeys.length) {
|
|
57
|
+
const updatedStorage = ( new Map());
|
|
58
|
+
const nonProfileKeys = [
|
|
59
|
+
...( this.storageService.keys(-1, 1 )),
|
|
60
|
+
...( this.storageService.keys(1, 0 )),
|
|
61
|
+
...( this.storageService.keys(1, 1 )),
|
|
62
|
+
];
|
|
63
|
+
for (const key of storageKeys) {
|
|
64
|
+
if (nonProfileKeys.includes(key)) {
|
|
65
|
+
this.logService.info(`Importing Profile (${profile.name}): Ignoring global state key '${key}' because it is not a profile key.`);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
updatedStorage.set(key, globalState.storage[key]);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
await this.userDataProfileStorageService.updateStorageData(profile, updatedStorage, 0 );
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
GlobalStateResource = ( __decorate([
|
|
76
|
+
( __param(0, IStorageService)),
|
|
77
|
+
( __param(1, IUserDataProfileStorageService)),
|
|
78
|
+
( __param(2, ILogService))
|
|
79
|
+
], GlobalStateResource));
|
|
80
|
+
class GlobalStateResourceTreeItem {
|
|
81
|
+
constructor(resource, uriIdentityService) {
|
|
82
|
+
this.resource = resource;
|
|
83
|
+
this.uriIdentityService = uriIdentityService;
|
|
84
|
+
this.type = "globalState" ;
|
|
85
|
+
this.handle = "globalState" ;
|
|
86
|
+
this.label = { label: ( localizeWithPath(
|
|
87
|
+
'vs/workbench/services/userDataProfile/browser/globalStateResource',
|
|
88
|
+
'globalState',
|
|
89
|
+
"UI State"
|
|
90
|
+
)) };
|
|
91
|
+
this.collapsibleState = TreeItemCollapsibleState.Collapsed;
|
|
92
|
+
}
|
|
93
|
+
async getChildren() {
|
|
94
|
+
return [{
|
|
95
|
+
handle: ( this.resource.toString()),
|
|
96
|
+
resourceUri: this.resource,
|
|
97
|
+
collapsibleState: TreeItemCollapsibleState.None,
|
|
98
|
+
accessibilityInformation: {
|
|
99
|
+
label: this.uriIdentityService.extUri.basename(this.resource)
|
|
100
|
+
},
|
|
101
|
+
parent: this,
|
|
102
|
+
command: {
|
|
103
|
+
id: API_OPEN_EDITOR_COMMAND_ID,
|
|
104
|
+
title: '',
|
|
105
|
+
arguments: [this.resource, undefined, undefined]
|
|
106
|
+
}
|
|
107
|
+
}];
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
let GlobalStateResourceExportTreeItem = class GlobalStateResourceExportTreeItem extends GlobalStateResourceTreeItem {
|
|
111
|
+
constructor(profile, resource, uriIdentityService, instantiationService) {
|
|
112
|
+
super(resource, uriIdentityService);
|
|
113
|
+
this.profile = profile;
|
|
114
|
+
this.instantiationService = instantiationService;
|
|
115
|
+
}
|
|
116
|
+
async hasContent() {
|
|
117
|
+
const globalState = await this.instantiationService.createInstance(GlobalStateResource).getGlobalState(this.profile);
|
|
118
|
+
return ( Object.keys(globalState.storage)).length > 0;
|
|
119
|
+
}
|
|
120
|
+
async getContent() {
|
|
121
|
+
return this.instantiationService.createInstance(GlobalStateResource).getContent(this.profile);
|
|
122
|
+
}
|
|
123
|
+
isFromDefaultProfile() {
|
|
124
|
+
return !this.profile.isDefault && !!this.profile.useDefaultFlags?.globalState;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
GlobalStateResourceExportTreeItem = ( __decorate([
|
|
128
|
+
( __param(2, IUriIdentityService)),
|
|
129
|
+
( __param(3, IInstantiationService))
|
|
130
|
+
], GlobalStateResourceExportTreeItem));
|
|
131
|
+
let GlobalStateResourceImportTreeItem = class GlobalStateResourceImportTreeItem extends GlobalStateResourceTreeItem {
|
|
132
|
+
constructor(content, resource, uriIdentityService) {
|
|
133
|
+
super(resource, uriIdentityService);
|
|
134
|
+
this.content = content;
|
|
135
|
+
}
|
|
136
|
+
async getContent() {
|
|
137
|
+
return this.content;
|
|
138
|
+
}
|
|
139
|
+
isFromDefaultProfile() {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
GlobalStateResourceImportTreeItem = ( __decorate([
|
|
144
|
+
( __param(2, IUriIdentityService))
|
|
145
|
+
], GlobalStateResourceImportTreeItem));
|
|
146
|
+
|
|
147
|
+
export { GlobalStateResource, GlobalStateResourceExportTreeItem, GlobalStateResourceImportTreeItem, GlobalStateResourceInitializer, GlobalStateResourceTreeItem };
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { VSBuffer } from 'monaco-editor/esm/vs/base/common/buffer.js';
|
|
3
|
+
import { FileOperationError, IFileService } from 'monaco-editor/esm/vs/platform/files/common/files.js';
|
|
4
|
+
import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
5
|
+
import { IUserDataProfileService } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile';
|
|
6
|
+
import { platform } from 'monaco-editor/esm/vs/base/common/platform.js';
|
|
7
|
+
import { TreeItemCollapsibleState } from 'vscode/vscode/vs/workbench/common/views';
|
|
8
|
+
import { API_OPEN_EDITOR_COMMAND_ID } from 'vscode/vscode/vs/workbench/browser/parts/editor/editorCommands';
|
|
9
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
10
|
+
import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
|
|
11
|
+
import { IUriIdentityService } from 'monaco-editor/esm/vs/platform/uriIdentity/common/uriIdentity.js';
|
|
12
|
+
|
|
13
|
+
let KeybindingsResourceInitializer = class KeybindingsResourceInitializer {
|
|
14
|
+
constructor(userDataProfileService, fileService, logService) {
|
|
15
|
+
this.userDataProfileService = userDataProfileService;
|
|
16
|
+
this.fileService = fileService;
|
|
17
|
+
this.logService = logService;
|
|
18
|
+
}
|
|
19
|
+
async initialize(content) {
|
|
20
|
+
const keybindingsContent = JSON.parse(content);
|
|
21
|
+
if (keybindingsContent.keybindings === null) {
|
|
22
|
+
this.logService.info(`Initializing Profile: No keybindings to apply...`);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
await this.fileService.writeFile(this.userDataProfileService.currentProfile.keybindingsResource, VSBuffer.fromString(keybindingsContent.keybindings));
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
KeybindingsResourceInitializer = ( __decorate([
|
|
29
|
+
( __param(0, IUserDataProfileService)),
|
|
30
|
+
( __param(1, IFileService)),
|
|
31
|
+
( __param(2, ILogService))
|
|
32
|
+
], KeybindingsResourceInitializer));
|
|
33
|
+
let KeybindingsResource = class KeybindingsResource {
|
|
34
|
+
constructor(fileService, logService) {
|
|
35
|
+
this.fileService = fileService;
|
|
36
|
+
this.logService = logService;
|
|
37
|
+
}
|
|
38
|
+
async getContent(profile) {
|
|
39
|
+
const keybindingsContent = await this.getKeybindingsResourceContent(profile);
|
|
40
|
+
return JSON.stringify(keybindingsContent);
|
|
41
|
+
}
|
|
42
|
+
async getKeybindingsResourceContent(profile) {
|
|
43
|
+
const keybindings = await this.getKeybindingsContent(profile);
|
|
44
|
+
return { keybindings, platform };
|
|
45
|
+
}
|
|
46
|
+
async apply(content, profile) {
|
|
47
|
+
const keybindingsContent = JSON.parse(content);
|
|
48
|
+
if (keybindingsContent.keybindings === null) {
|
|
49
|
+
this.logService.info(`Importing Profile (${profile.name}): No keybindings to apply...`);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
await this.fileService.writeFile(profile.keybindingsResource, VSBuffer.fromString(keybindingsContent.keybindings));
|
|
53
|
+
}
|
|
54
|
+
async getKeybindingsContent(profile) {
|
|
55
|
+
try {
|
|
56
|
+
const content = await this.fileService.readFile(profile.keybindingsResource);
|
|
57
|
+
return ( content.value.toString());
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
if (error instanceof FileOperationError && error.fileOperationResult === 1 ) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
KeybindingsResource = ( __decorate([
|
|
70
|
+
( __param(0, IFileService)),
|
|
71
|
+
( __param(1, ILogService))
|
|
72
|
+
], KeybindingsResource));
|
|
73
|
+
let KeybindingsResourceTreeItem = class KeybindingsResourceTreeItem {
|
|
74
|
+
constructor(profile, uriIdentityService, instantiationService) {
|
|
75
|
+
this.profile = profile;
|
|
76
|
+
this.uriIdentityService = uriIdentityService;
|
|
77
|
+
this.instantiationService = instantiationService;
|
|
78
|
+
this.type = "keybindings" ;
|
|
79
|
+
this.handle = "keybindings" ;
|
|
80
|
+
this.label = { label: ( localizeWithPath(
|
|
81
|
+
'vs/workbench/services/userDataProfile/browser/keybindingsResource',
|
|
82
|
+
'keybindings',
|
|
83
|
+
"Keyboard Shortcuts"
|
|
84
|
+
)) };
|
|
85
|
+
this.collapsibleState = TreeItemCollapsibleState.Expanded;
|
|
86
|
+
}
|
|
87
|
+
isFromDefaultProfile() {
|
|
88
|
+
return !this.profile.isDefault && !!this.profile.useDefaultFlags?.keybindings;
|
|
89
|
+
}
|
|
90
|
+
async getChildren() {
|
|
91
|
+
return [{
|
|
92
|
+
handle: ( this.profile.keybindingsResource.toString()),
|
|
93
|
+
resourceUri: this.profile.keybindingsResource,
|
|
94
|
+
collapsibleState: TreeItemCollapsibleState.None,
|
|
95
|
+
parent: this,
|
|
96
|
+
accessibilityInformation: {
|
|
97
|
+
label: this.uriIdentityService.extUri.basename(this.profile.settingsResource)
|
|
98
|
+
},
|
|
99
|
+
command: {
|
|
100
|
+
id: API_OPEN_EDITOR_COMMAND_ID,
|
|
101
|
+
title: '',
|
|
102
|
+
arguments: [this.profile.keybindingsResource, undefined, undefined]
|
|
103
|
+
}
|
|
104
|
+
}];
|
|
105
|
+
}
|
|
106
|
+
async hasContent() {
|
|
107
|
+
const keybindingsContent = await this.instantiationService.createInstance(KeybindingsResource).getKeybindingsResourceContent(this.profile);
|
|
108
|
+
return keybindingsContent.keybindings !== null;
|
|
109
|
+
}
|
|
110
|
+
async getContent() {
|
|
111
|
+
return this.instantiationService.createInstance(KeybindingsResource).getContent(this.profile);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
KeybindingsResourceTreeItem = ( __decorate([
|
|
115
|
+
( __param(1, IUriIdentityService)),
|
|
116
|
+
( __param(2, IInstantiationService))
|
|
117
|
+
], KeybindingsResourceTreeItem));
|
|
118
|
+
|
|
119
|
+
export { KeybindingsResource, KeybindingsResourceInitializer, KeybindingsResourceTreeItem };
|
package/vscode/src/vs/workbench/services/userDataProfile/browser/media/userDataProfileView.css.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import n from '../../../../../../../../external/rollup-plugin-styles/dist/runtime/inject-css.js';
|
|
2
|
+
|
|
3
|
+
var css = ".profile-view-tree-container .customview-tree .monaco-list .monaco-list-row .custom-view-tree-node-item .actions{display:inherit}.monaco-workbench .pane>.pane-body>.profile-view-message-container{box-sizing:border-box;display:flex;padding:13px 20px 0}.monaco-workbench .pane>.pane-body>.profile-view-message-container p{margin-block-end:0;margin-block-start:0}.monaco-workbench .pane>.pane-body>.profile-view-message-container a{color:var(--vscode-textLink-foreground)}.monaco-workbench .pane>.pane-body>.profile-view-message-container a:hover{color:var(--vscode-textLink-activeForeground);text-decoration:underline}.monaco-workbench .pane>.pane-body>.profile-view-message-container a:active{color:var(--vscode-textLink-activeForeground)}.monaco-workbench .pane>.pane-body>.profile-view-message-container.hide{display:none}.monaco-workbench .pane>.pane-body>.profile-view-buttons-container{box-sizing:border-box;display:flex;flex-direction:column;padding:13px 20px}.monaco-workbench .pane>.pane-body>.profile-view-buttons-container>.monaco-button,.monaco-workbench .pane>.pane-body>.profile-view-buttons-container>.monaco-button-dropdown{margin-block-start:13px;margin-inline-end:0;margin-inline-start:0;margin-left:auto;margin-right:auto;max-width:260px}.monaco-workbench .pane>.pane-body>.profile-view-buttons-container>.monaco-button-dropdown{width:100%}.monaco-workbench .pane>.pane-body>.profile-view-buttons-container>.monaco-button-dropdown>.monaco-dropdown-button{align-items:center;display:flex;padding:0 4px}.profile-edit-widget{padding:4px 6px 0 11px}.profile-edit-widget>.profile-icon-container{display:flex;margin-bottom:8px}.profile-edit-widget>.profile-icon-container>.profile-icon{border-radius:5px;cursor:pointer;padding:3px}.profile-edit-widget>.profile-icon-container>.profile-icon.codicon{font-size:18px}.profile-edit-widget>.profile-icon-container>.profile-icon:hover{background-color:var(--vscode-toolbar-hoverBackground);outline:1px dashed var(--vscode-toolbar-hoverOutline);outline-offset:-1px}.profile-edit-widget>.profile-type-container{align-items:center;display:flex;justify-content:space-between;margin-bottom:8px}.profile-edit-widget>.profile-icon-container>.profile-icon-label,.profile-edit-widget>.profile-type-container>.profile-type-create-label{align-items:center;display:inline-flex;width:90px}.profile-edit-widget>.profile-icon-container:only-child>.profile-icon-label{width:45px}.profile-edit-widget>.profile-icon-container>.profile-icon-id{align-items:center;display:inline-flex;font-size:.9em;margin-left:5px;opacity:.8}.profile-edit-widget>.profile-type-container>.profile-type-select-container{align-items:center;display:flex;flex:1;justify-content:center;overflow:hidden}.profile-edit-widget>.profile-type-container>.profile-type-select-container>.monaco-select-box{border-radius:2px;cursor:pointer;line-height:17px;padding:2px 23px 2px 8px}";
|
|
4
|
+
n(css,{});
|
|
5
|
+
|
|
6
|
+
export { css, css as default };
|