@codingame/monaco-vscode-user-data-profile-service-override 11.1.2 → 12.0.1
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/index.d.ts +2 -1
- package/index.js +126 -1
- package/package.json +31 -8
- package/vscode/src/vs/base/browser/ui/radio/radio.css.js +1 -1
- package/vscode/src/vs/base/browser/ui/radio/radio.d.ts +37 -0
- package/vscode/src/vs/base/browser/ui/radio/radio.js +1 -0
- package/vscode/src/vs/platform/userDataProfile/browser/userDataProfile.d.ts +16 -0
- package/vscode/src/vs/platform/userDataProfile/browser/userDataProfile.js +3 -2
- package/vscode/src/vs/platform/userDataProfile/common/userDataProfileStorageService.d.ts +42 -0
- package/vscode/src/vs/platform/userDataProfile/common/userDataProfileStorageService.js +10 -11
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/media/userDataProfilesEditor.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.contribution.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.contribution.js +3 -2
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.d.ts +53 -0
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.js +65 -63
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfileActions.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfileActions.js +5 -4
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditor.d.ts +73 -0
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditor.js +298 -307
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditorModel.d.ts +236 -0
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditorModel.js +168 -166
- package/vscode/src/vs/workbench/contrib/userDataProfile/common/userDataProfile.d.ts +7 -0
- package/vscode/src/vs/workbench/services/userData/browser/userDataInit.d.ts +19 -0
- package/vscode/src/vs/workbench/services/userData/browser/userDataInit.js +4 -2
- package/vscode/src/vs/workbench/services/userDataProfile/browser/extensionsResource.d.ts +77 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/extensionsResource.js +83 -82
- package/vscode/src/vs/workbench/services/userDataProfile/browser/globalStateResource.d.ts +58 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/globalStateResource.js +31 -28
- package/vscode/src/vs/workbench/services/userDataProfile/browser/keybindingsResource.d.ts +47 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/keybindingsResource.js +24 -24
- package/vscode/src/vs/workbench/services/userDataProfile/browser/media/userDataProfileView.css.js +1 -1
- package/vscode/src/vs/workbench/services/userDataProfile/browser/settingsResource.d.ts +48 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/settingsResource.js +29 -29
- package/vscode/src/vs/workbench/services/userDataProfile/browser/snippetsResource.d.ts +43 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/snippetsResource.js +54 -54
- package/vscode/src/vs/workbench/services/userDataProfile/browser/tasksResource.d.ts +45 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/tasksResource.js +24 -24
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileImportExportService.d.ts +63 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileImportExportService.js +106 -111
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileInit.d.ts +32 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileInit.js +11 -8
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileManagement.d.ts +58 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileManagement.js +35 -33
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileStorageService.d.ts +18 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileStorageService.js +7 -5
- package/vscode/src/vs/workbench/services/userDataSync/browser/userDataSyncInit.d.ts +45 -0
- package/vscode/src/vs/workbench/services/userDataSync/browser/userDataSyncInit.js +25 -22
- package/vscode/src/vs/workbench/services/userDataSync/common/userDataSyncUtil.d.ts +18 -0
- package/vscode/src/vs/workbench/services/userDataSync/common/userDataSyncUtil.js +3 -1
- package/userDataProfile.js +0 -125
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { URI } from "vscode/vscode/vs/base/common/uri";
|
|
2
|
+
import { IUserDataProfile } from "vscode/vscode/vs/platform/userDataProfile/common/userDataProfile";
|
|
3
|
+
import { IEditorPane } from "vscode/vscode/vs/workbench/common/editor";
|
|
4
|
+
export interface IUserDataProfilesEditor extends IEditorPane {
|
|
5
|
+
createNewProfile(copyFrom?: URI | IUserDataProfile): Promise<void>;
|
|
6
|
+
selectProfile(profile: IUserDataProfile): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IInstantiationService } from "vscode/vscode/vs/platform/instantiation/common/instantiation";
|
|
2
|
+
import { IUserDataInitializationService } from "vscode/vscode/vs/workbench/services/userData/browser/userDataInit.service";
|
|
3
|
+
export interface IUserDataInitializer {
|
|
4
|
+
requiresInitialization(): Promise<boolean>;
|
|
5
|
+
whenInitializationFinished(): Promise<void>;
|
|
6
|
+
initializeRequiredResources(): Promise<void>;
|
|
7
|
+
initializeInstalledExtensions(instantiationService: IInstantiationService): Promise<void>;
|
|
8
|
+
initializeOtherResources(instantiationService: IInstantiationService): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
export declare class UserDataInitializationService implements IUserDataInitializationService {
|
|
11
|
+
private readonly initializers;
|
|
12
|
+
_serviceBrand: any;
|
|
13
|
+
constructor(initializers?: IUserDataInitializer[]);
|
|
14
|
+
whenInitializationFinished(): Promise<void>;
|
|
15
|
+
requiresInitialization(): Promise<boolean>;
|
|
16
|
+
initializeRequiredResources(): Promise<void>;
|
|
17
|
+
initializeOtherResources(instantiationService: IInstantiationService): Promise<void>;
|
|
18
|
+
initializeInstalledExtensions(instantiationService: IInstantiationService): Promise<void>;
|
|
19
|
+
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
|
|
2
3
|
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
3
4
|
import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
4
5
|
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
6
|
+
import { LifecyclePhase } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
|
|
5
7
|
import { isWeb } from 'vscode/vscode/vs/base/common/platform';
|
|
6
8
|
import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions.service';
|
|
7
9
|
import { mark } from 'vscode/vscode/vs/base/common/performance';
|
|
@@ -56,7 +58,7 @@ InitializeOtherResourcesContribution = ( __decorate([
|
|
|
56
58
|
], InitializeOtherResourcesContribution));
|
|
57
59
|
if (isWeb) {
|
|
58
60
|
const workbenchRegistry = ( Registry.as(Extensions.Workbench));
|
|
59
|
-
workbenchRegistry.registerWorkbenchContribution(InitializeOtherResourcesContribution,
|
|
61
|
+
workbenchRegistry.registerWorkbenchContribution(InitializeOtherResourcesContribution, LifecyclePhase.Restored);
|
|
60
62
|
}
|
|
61
63
|
|
|
62
64
|
export { UserDataInitializationService };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { CancellationToken } from "vscode/vscode/vs/base/common/cancellation";
|
|
2
|
+
import { IExtensionIdentifier } from "vscode/vscode/vs/platform/extensionManagement/common/extensionManagement";
|
|
3
|
+
import { IGlobalExtensionEnablementService } from "vscode/vscode/vs/platform/extensionManagement/common/extensionManagement.service";
|
|
4
|
+
import { IExtensionManagementService } from "vscode/vscode/vs/platform/extensionManagement/common/extensionManagement.service";
|
|
5
|
+
import { IExtensionGalleryService } from "vscode/vscode/vs/platform/extensionManagement/common/extensionManagement.service";
|
|
6
|
+
import { IInstantiationService } from "vscode/vscode/vs/platform/instantiation/common/instantiation";
|
|
7
|
+
import { ILogService } from "vscode/vscode/vs/platform/log/common/log.service";
|
|
8
|
+
import { IUserDataProfile, ProfileResourceType } from "vscode/vscode/vs/platform/userDataProfile/common/userDataProfile";
|
|
9
|
+
import { IUserDataProfileStorageService } from "vscode/vscode/vs/platform/userDataProfile/common/userDataProfileStorageService.service";
|
|
10
|
+
import { ITreeItemCheckboxState, TreeItemCollapsibleState } from "vscode/vscode/vs/workbench/common/views";
|
|
11
|
+
import { IProfileResource, IProfileResourceChildTreeItem, IProfileResourceInitializer, IProfileResourceTreeItem } from "@codingame/monaco-vscode-e72c94ca-257a-5b75-8b68-5a5fa3c18255-common/vscode/vs/workbench/services/userDataProfile/common/userDataProfile";
|
|
12
|
+
import { IUserDataProfileService } from "vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile.service";
|
|
13
|
+
interface IProfileExtension {
|
|
14
|
+
identifier: IExtensionIdentifier;
|
|
15
|
+
displayName?: string;
|
|
16
|
+
preRelease?: boolean;
|
|
17
|
+
applicationScoped?: boolean;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
version?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare class ExtensionsResourceInitializer implements IProfileResourceInitializer {
|
|
22
|
+
private readonly userDataProfileService;
|
|
23
|
+
private readonly extensionManagementService;
|
|
24
|
+
private readonly extensionGalleryService;
|
|
25
|
+
private readonly extensionEnablementService;
|
|
26
|
+
private readonly logService;
|
|
27
|
+
constructor(userDataProfileService: IUserDataProfileService, extensionManagementService: IExtensionManagementService, extensionGalleryService: IExtensionGalleryService, extensionEnablementService: IGlobalExtensionEnablementService, logService: ILogService);
|
|
28
|
+
initialize(content: string): Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
export declare class ExtensionsResource implements IProfileResource {
|
|
31
|
+
private readonly extensionManagementService;
|
|
32
|
+
private readonly extensionGalleryService;
|
|
33
|
+
private readonly userDataProfileStorageService;
|
|
34
|
+
private readonly instantiationService;
|
|
35
|
+
private readonly logService;
|
|
36
|
+
constructor(extensionManagementService: IExtensionManagementService, extensionGalleryService: IExtensionGalleryService, userDataProfileStorageService: IUserDataProfileStorageService, instantiationService: IInstantiationService, logService: ILogService);
|
|
37
|
+
getContent(profile: IUserDataProfile, exclude?: string[]): Promise<string>;
|
|
38
|
+
toContent(extensions: IProfileExtension[], exclude?: string[]): string;
|
|
39
|
+
apply(content: string, profile: IUserDataProfile, progress?: (message: string) => void, token?: CancellationToken): Promise<void>;
|
|
40
|
+
copy(from: IUserDataProfile, to: IUserDataProfile, disableExtensions: boolean): Promise<void>;
|
|
41
|
+
getLocalExtensions(profile: IUserDataProfile): Promise<IProfileExtension[]>;
|
|
42
|
+
getProfileExtensions(content: string): Promise<IProfileExtension[]>;
|
|
43
|
+
private withProfileScopedServices;
|
|
44
|
+
}
|
|
45
|
+
export declare abstract class ExtensionsResourceTreeItem implements IProfileResourceTreeItem {
|
|
46
|
+
readonly type = ProfileResourceType.Extensions;
|
|
47
|
+
readonly handle = ProfileResourceType.Extensions;
|
|
48
|
+
readonly label: {
|
|
49
|
+
label: string;
|
|
50
|
+
};
|
|
51
|
+
readonly collapsibleState = TreeItemCollapsibleState.Expanded;
|
|
52
|
+
contextValue: ProfileResourceType;
|
|
53
|
+
checkbox: ITreeItemCheckboxState | undefined;
|
|
54
|
+
protected readonly excludedExtensions: Set<string>;
|
|
55
|
+
getChildren(): Promise<Array<IProfileResourceChildTreeItem & IProfileExtension>>;
|
|
56
|
+
hasContent(): Promise<boolean>;
|
|
57
|
+
abstract isFromDefaultProfile(): boolean;
|
|
58
|
+
abstract getContent(): Promise<string>;
|
|
59
|
+
protected abstract getExtensions(): Promise<IProfileExtension[]>;
|
|
60
|
+
}
|
|
61
|
+
export declare class ExtensionsResourceExportTreeItem extends ExtensionsResourceTreeItem {
|
|
62
|
+
private readonly profile;
|
|
63
|
+
private readonly instantiationService;
|
|
64
|
+
constructor(profile: IUserDataProfile, instantiationService: IInstantiationService);
|
|
65
|
+
isFromDefaultProfile(): boolean;
|
|
66
|
+
protected getExtensions(): Promise<IProfileExtension[]>;
|
|
67
|
+
getContent(): Promise<string>;
|
|
68
|
+
}
|
|
69
|
+
export declare class ExtensionsResourceImportTreeItem extends ExtensionsResourceTreeItem {
|
|
70
|
+
private readonly content;
|
|
71
|
+
private readonly instantiationService;
|
|
72
|
+
constructor(content: string, instantiationService: IInstantiationService);
|
|
73
|
+
isFromDefaultProfile(): boolean;
|
|
74
|
+
protected getExtensions(): Promise<IProfileExtension[]>;
|
|
75
|
+
getContent(): Promise<string>;
|
|
76
|
+
}
|
|
77
|
+
export {};
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
|
|
2
3
|
import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation';
|
|
3
4
|
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
4
5
|
import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
5
6
|
import { localize } from 'vscode/vscode/vs/nls';
|
|
6
|
-
import { GlobalExtensionEnablementService } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionEnablementService';
|
|
7
|
+
import { GlobalExtensionEnablementService } from '@codingame/monaco-vscode-a2719803-af40-5ae9-a29f-8a2231c33056-common/vscode/vs/platform/extensionManagement/common/extensionEnablementService';
|
|
7
8
|
import { EXTENSION_INSTALL_SKIP_WALKTHROUGH_CONTEXT } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement';
|
|
8
9
|
import { IExtensionManagementService, IExtensionGalleryService, IGlobalExtensionEnablementService } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement.service';
|
|
9
10
|
import { areSameExtensions } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagementUtil';
|
|
11
|
+
import { ExtensionType } from 'vscode/vscode/vs/platform/extensions/common/extensions';
|
|
10
12
|
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
11
13
|
import { ServiceCollection } from 'vscode/vscode/vs/platform/instantiation/common/serviceCollection';
|
|
12
14
|
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
13
15
|
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
16
|
+
import { ProfileResourceType } from 'vscode/vscode/vs/platform/userDataProfile/common/userDataProfile';
|
|
14
17
|
import { IUserDataProfileStorageService } from 'vscode/vscode/vs/platform/userDataProfile/common/userDataProfileStorageService.service';
|
|
15
18
|
import { TreeItemCollapsibleState } from 'vscode/vscode/vs/workbench/common/views';
|
|
16
19
|
import { IUserDataProfileService } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile.service';
|
|
@@ -29,7 +32,7 @@ let ExtensionsResourceInitializer = class ExtensionsResourceInitializer {
|
|
|
29
32
|
const extensionsToEnableOrDisable = [];
|
|
30
33
|
const extensionsToInstall = [];
|
|
31
34
|
for (const e of profileExtensions) {
|
|
32
|
-
const isDisabled = (
|
|
35
|
+
const isDisabled = ( this.extensionEnablementService.getDisabledExtensions().some(disabledExtension => areSameExtensions(disabledExtension, e.identifier)));
|
|
33
36
|
const installedExtension = installedExtensions.find(installed => areSameExtensions(installed.identifier, e.identifier));
|
|
34
37
|
if (!installedExtension || (!installedExtension.isBuiltin && installedExtension.preRelease !== e.preRelease)) {
|
|
35
38
|
extensionsToInstall.push(e);
|
|
@@ -38,7 +41,7 @@ let ExtensionsResourceInitializer = class ExtensionsResourceInitializer {
|
|
|
38
41
|
extensionsToEnableOrDisable.push({ extension: e.identifier, enable: !e.disabled });
|
|
39
42
|
}
|
|
40
43
|
}
|
|
41
|
-
const extensionsToUninstall = installedExtensions.filter(extension => !extension.isBuiltin && !(
|
|
44
|
+
const extensionsToUninstall = installedExtensions.filter(extension => !extension.isBuiltin && !( profileExtensions.some(({ identifier }) => areSameExtensions(identifier, extension.identifier))));
|
|
42
45
|
for (const { extension, enable } of extensionsToEnableOrDisable) {
|
|
43
46
|
if (enable) {
|
|
44
47
|
this.logService.trace(`Initializing Profile: Enabling extension...`, extension.id);
|
|
@@ -52,15 +55,15 @@ let ExtensionsResourceInitializer = class ExtensionsResourceInitializer {
|
|
|
52
55
|
}
|
|
53
56
|
}
|
|
54
57
|
if (extensionsToInstall.length) {
|
|
55
|
-
const galleryExtensions = await this.extensionGalleryService.getExtensions((
|
|
58
|
+
const galleryExtensions = await this.extensionGalleryService.getExtensions(( extensionsToInstall.map(
|
|
56
59
|
e => ({ ...e.identifier, version: e.version, hasPreRelease: e.version ? undefined : e.preRelease })
|
|
57
|
-
))
|
|
58
|
-
await Promise.all((
|
|
60
|
+
)), CancellationToken.None);
|
|
61
|
+
await Promise.all(( extensionsToInstall.map(async (e) => {
|
|
59
62
|
const extension = galleryExtensions.find(galleryExtension => areSameExtensions(galleryExtension.identifier, e.identifier));
|
|
60
63
|
if (!extension) {
|
|
61
64
|
return;
|
|
62
65
|
}
|
|
63
|
-
if (await this.extensionManagementService.canInstall(extension)) {
|
|
66
|
+
if ((await this.extensionManagementService.canInstall(extension)) === true) {
|
|
64
67
|
this.logService.trace(`Initializing Profile: Installing extension...`, extension.identifier.id, extension.version);
|
|
65
68
|
await this.extensionManagementService.installFromGallery(extension, {
|
|
66
69
|
isMachineScoped: false,
|
|
@@ -75,20 +78,20 @@ let ExtensionsResourceInitializer = class ExtensionsResourceInitializer {
|
|
|
75
78
|
else {
|
|
76
79
|
this.logService.info(`Initializing Profile: Skipped installing extension because it cannot be installed.`, extension.identifier.id);
|
|
77
80
|
}
|
|
78
|
-
})))
|
|
81
|
+
})));
|
|
79
82
|
}
|
|
80
83
|
if (extensionsToUninstall.length) {
|
|
81
|
-
await Promise.all((
|
|
84
|
+
await Promise.all(( extensionsToUninstall.map(e => this.extensionManagementService.uninstall(e))));
|
|
82
85
|
}
|
|
83
86
|
}
|
|
84
87
|
};
|
|
85
|
-
ExtensionsResourceInitializer = (
|
|
86
|
-
(
|
|
87
|
-
(
|
|
88
|
-
(
|
|
89
|
-
(
|
|
90
|
-
(
|
|
91
|
-
], ExtensionsResourceInitializer))
|
|
88
|
+
ExtensionsResourceInitializer = ( __decorate([
|
|
89
|
+
( __param(0, IUserDataProfileService)),
|
|
90
|
+
( __param(1, IExtensionManagementService)),
|
|
91
|
+
( __param(2, IExtensionGalleryService)),
|
|
92
|
+
( __param(3, IGlobalExtensionEnablementService)),
|
|
93
|
+
( __param(4, ILogService))
|
|
94
|
+
], ExtensionsResourceInitializer));
|
|
92
95
|
let ExtensionsResource = class ExtensionsResource {
|
|
93
96
|
constructor(extensionManagementService, extensionGalleryService, userDataProfileStorageService, instantiationService, logService) {
|
|
94
97
|
this.extensionManagementService = extensionManagementService;
|
|
@@ -111,7 +114,7 @@ let ExtensionsResource = class ExtensionsResource {
|
|
|
111
114
|
const extensionsToEnableOrDisable = [];
|
|
112
115
|
const extensionsToInstall = [];
|
|
113
116
|
for (const e of profileExtensions) {
|
|
114
|
-
const isDisabled = (
|
|
117
|
+
const isDisabled = ( extensionEnablementService.getDisabledExtensions().some(disabledExtension => areSameExtensions(disabledExtension, e.identifier)));
|
|
115
118
|
const installedExtension = installedExtensions.find(installed => areSameExtensions(installed.identifier, e.identifier));
|
|
116
119
|
if (!installedExtension || (!installedExtension.isBuiltin && installedExtension.preRelease !== e.preRelease)) {
|
|
117
120
|
extensionsToInstall.push(e);
|
|
@@ -120,7 +123,7 @@ let ExtensionsResource = class ExtensionsResource {
|
|
|
120
123
|
extensionsToEnableOrDisable.push({ extension: e.identifier, enable: !e.disabled });
|
|
121
124
|
}
|
|
122
125
|
}
|
|
123
|
-
const extensionsToUninstall = installedExtensions.filter(extension => !extension.isBuiltin && !(
|
|
126
|
+
const extensionsToUninstall = installedExtensions.filter(extension => !extension.isBuiltin && !( profileExtensions.some(({ identifier }) => areSameExtensions(identifier, extension.identifier))) && !extension.isApplicationScoped);
|
|
124
127
|
for (const { extension, enable } of extensionsToEnableOrDisable) {
|
|
125
128
|
if (enable) {
|
|
126
129
|
this.logService.trace(`Importing Profile (${profile.name}): Enabling extension...`, extension.id);
|
|
@@ -135,16 +138,16 @@ let ExtensionsResource = class ExtensionsResource {
|
|
|
135
138
|
}
|
|
136
139
|
if (extensionsToInstall.length) {
|
|
137
140
|
this.logService.info(`Importing Profile (${profile.name}): Started installing extensions.`);
|
|
138
|
-
const galleryExtensions = await this.extensionGalleryService.getExtensions((
|
|
141
|
+
const galleryExtensions = await this.extensionGalleryService.getExtensions(( extensionsToInstall.map(
|
|
139
142
|
e => ({ ...e.identifier, version: e.version, hasPreRelease: e.version ? undefined : e.preRelease })
|
|
140
|
-
))
|
|
143
|
+
)), CancellationToken.None);
|
|
141
144
|
const installExtensionInfos = [];
|
|
142
|
-
await Promise.all((
|
|
145
|
+
await Promise.all(( extensionsToInstall.map(async (e) => {
|
|
143
146
|
const extension = galleryExtensions.find(galleryExtension => areSameExtensions(galleryExtension.identifier, e.identifier));
|
|
144
147
|
if (!extension) {
|
|
145
148
|
return;
|
|
146
149
|
}
|
|
147
|
-
if (await this.extensionManagementService.canInstall(extension)) {
|
|
150
|
+
if ((await this.extensionManagementService.canInstall(extension)) === true) {
|
|
148
151
|
installExtensionInfos.push({
|
|
149
152
|
extension,
|
|
150
153
|
options: {
|
|
@@ -160,7 +163,7 @@ let ExtensionsResource = class ExtensionsResource {
|
|
|
160
163
|
else {
|
|
161
164
|
this.logService.info(`Importing Profile (${profile.name}): Skipped installing extension because it cannot be installed.`, extension.identifier.id);
|
|
162
165
|
}
|
|
163
|
-
})))
|
|
166
|
+
})));
|
|
164
167
|
if (installExtensionInfos.length) {
|
|
165
168
|
if (token) {
|
|
166
169
|
for (const installExtensionInfo of installExtensionInfos) {
|
|
@@ -168,7 +171,7 @@ let ExtensionsResource = class ExtensionsResource {
|
|
|
168
171
|
return;
|
|
169
172
|
}
|
|
170
173
|
progress?.(( localize(
|
|
171
|
-
|
|
174
|
+
11973,
|
|
172
175
|
"Installing extension {0}...",
|
|
173
176
|
installExtensionInfo.extension.displayName ?? installExtensionInfo.extension.identifier.id
|
|
174
177
|
)));
|
|
@@ -182,7 +185,7 @@ let ExtensionsResource = class ExtensionsResource {
|
|
|
182
185
|
this.logService.info(`Importing Profile (${profile.name}): Finished installing extensions.`);
|
|
183
186
|
}
|
|
184
187
|
if (extensionsToUninstall.length) {
|
|
185
|
-
await Promise.all((
|
|
188
|
+
await Promise.all(( extensionsToUninstall.map(e => this.extensionManagementService.uninstall(e))));
|
|
186
189
|
}
|
|
187
190
|
});
|
|
188
191
|
}
|
|
@@ -190,21 +193,21 @@ let ExtensionsResource = class ExtensionsResource {
|
|
|
190
193
|
await this.extensionManagementService.copyExtensions(from.extensionsResource, to.extensionsResource);
|
|
191
194
|
const extensionsToDisable = await this.withProfileScopedServices(from, async (extensionEnablementService) => extensionEnablementService.getDisabledExtensions());
|
|
192
195
|
if (disableExtensions) {
|
|
193
|
-
const extensions = await this.extensionManagementService.getInstalled(
|
|
196
|
+
const extensions = await this.extensionManagementService.getInstalled(ExtensionType.User, to.extensionsResource);
|
|
194
197
|
for (const extension of extensions) {
|
|
195
198
|
extensionsToDisable.push(extension.identifier);
|
|
196
199
|
}
|
|
197
200
|
}
|
|
198
|
-
await this.withProfileScopedServices(to, async (extensionEnablementService) => Promise.all((
|
|
201
|
+
await this.withProfileScopedServices(to, async (extensionEnablementService) => Promise.all(( extensionsToDisable.map(extension => extensionEnablementService.disableExtension(extension)))));
|
|
199
202
|
}
|
|
200
203
|
async getLocalExtensions(profile) {
|
|
201
204
|
return this.withProfileScopedServices(profile, async (extensionEnablementService) => {
|
|
202
|
-
const result = (
|
|
205
|
+
const result = ( new Map());
|
|
203
206
|
const installedExtensions = await this.extensionManagementService.getInstalled(undefined, profile.extensionsResource);
|
|
204
207
|
const disabledExtensions = extensionEnablementService.getDisabledExtensions();
|
|
205
208
|
for (const extension of installedExtensions) {
|
|
206
209
|
const { identifier, preRelease } = extension;
|
|
207
|
-
const disabled = (
|
|
210
|
+
const disabled = ( disabledExtensions.some(disabledExtension => areSameExtensions(disabledExtension, identifier)));
|
|
208
211
|
if (extension.isBuiltin && !disabled) {
|
|
209
212
|
continue;
|
|
210
213
|
}
|
|
@@ -230,7 +233,7 @@ let ExtensionsResource = class ExtensionsResource {
|
|
|
230
233
|
profileExtension.applicationScoped = extension.isApplicationScoped;
|
|
231
234
|
result.set(profileExtension.identifier.id.toLowerCase(), profileExtension);
|
|
232
235
|
}
|
|
233
|
-
return [...(
|
|
236
|
+
return [...( result.values())];
|
|
234
237
|
});
|
|
235
238
|
}
|
|
236
239
|
async getProfileExtensions(content) {
|
|
@@ -238,8 +241,8 @@ let ExtensionsResource = class ExtensionsResource {
|
|
|
238
241
|
}
|
|
239
242
|
async withProfileScopedServices(profile, fn) {
|
|
240
243
|
return this.userDataProfileStorageService.withProfileScopedStorageService(profile, async (storageService) => {
|
|
241
|
-
const disposables = (
|
|
242
|
-
const instantiationService = disposables.add(this.instantiationService.createChild((
|
|
244
|
+
const disposables = ( new DisposableStore());
|
|
245
|
+
const instantiationService = disposables.add(this.instantiationService.createChild(( new ServiceCollection([IStorageService, storageService]))));
|
|
243
246
|
const extensionEnablementService = disposables.add(instantiationService.createInstance(GlobalExtensionEnablementService));
|
|
244
247
|
try {
|
|
245
248
|
return await fn(extensionEnablementService);
|
|
@@ -250,56 +253,54 @@ let ExtensionsResource = class ExtensionsResource {
|
|
|
250
253
|
});
|
|
251
254
|
}
|
|
252
255
|
};
|
|
253
|
-
ExtensionsResource = (
|
|
254
|
-
(
|
|
255
|
-
(
|
|
256
|
-
(
|
|
257
|
-
(
|
|
258
|
-
(
|
|
259
|
-
], ExtensionsResource))
|
|
256
|
+
ExtensionsResource = ( __decorate([
|
|
257
|
+
( __param(0, IExtensionManagementService)),
|
|
258
|
+
( __param(1, IExtensionGalleryService)),
|
|
259
|
+
( __param(2, IUserDataProfileStorageService)),
|
|
260
|
+
( __param(3, IInstantiationService)),
|
|
261
|
+
( __param(4, ILogService))
|
|
262
|
+
], ExtensionsResource));
|
|
260
263
|
class ExtensionsResourceTreeItem {
|
|
261
264
|
constructor() {
|
|
262
|
-
this.type =
|
|
263
|
-
this.handle =
|
|
264
|
-
this.label = { label: ( localize(
|
|
265
|
+
this.type = ProfileResourceType.Extensions;
|
|
266
|
+
this.handle = ProfileResourceType.Extensions;
|
|
267
|
+
this.label = { label: ( localize(11974, "Extensions")) };
|
|
265
268
|
this.collapsibleState = TreeItemCollapsibleState.Expanded;
|
|
266
|
-
this.contextValue =
|
|
267
|
-
this.excludedExtensions = (
|
|
269
|
+
this.contextValue = ProfileResourceType.Extensions;
|
|
270
|
+
this.excludedExtensions = ( new Set());
|
|
268
271
|
}
|
|
269
272
|
async getChildren() {
|
|
270
273
|
const extensions = (await this.getExtensions()).sort((a, b) => (a.displayName ?? a.identifier.id).localeCompare(b.displayName ?? b.identifier.id));
|
|
271
274
|
const that = this;
|
|
272
|
-
return (
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
that.excludedExtensions.delete(e.identifier.id.toLowerCase());
|
|
285
|
-
}
|
|
286
|
-
else {
|
|
287
|
-
that.excludedExtensions.add(e.identifier.id.toLowerCase());
|
|
288
|
-
}
|
|
289
|
-
},
|
|
290
|
-
tooltip: ( localize(9005, "Select {0} Extension", e.displayName || e.identifier.id)),
|
|
291
|
-
accessibilityInformation: {
|
|
292
|
-
label: ( localize(9005, "Select {0} Extension", e.displayName || e.identifier.id)),
|
|
275
|
+
return (extensions.map(e => ({
|
|
276
|
+
...e,
|
|
277
|
+
handle: e.identifier.id.toLowerCase(),
|
|
278
|
+
parent: this,
|
|
279
|
+
label: { label: e.displayName || e.identifier.id },
|
|
280
|
+
description: e.applicationScoped ? ( localize(11975, "All Profiles")) : undefined,
|
|
281
|
+
collapsibleState: TreeItemCollapsibleState.None,
|
|
282
|
+
checkbox: that.checkbox ? {
|
|
283
|
+
get isChecked() { return !( that.excludedExtensions.has(e.identifier.id.toLowerCase())); },
|
|
284
|
+
set isChecked(value) {
|
|
285
|
+
if (value) {
|
|
286
|
+
that.excludedExtensions.delete(e.identifier.id.toLowerCase());
|
|
293
287
|
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
288
|
+
else {
|
|
289
|
+
that.excludedExtensions.add(e.identifier.id.toLowerCase());
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
tooltip: ( localize(11976, "Select {0} Extension", e.displayName || e.identifier.id)),
|
|
293
|
+
accessibilityInformation: {
|
|
294
|
+
label: ( localize(11976, "Select {0} Extension", e.displayName || e.identifier.id)),
|
|
300
295
|
}
|
|
301
|
-
}
|
|
302
|
-
|
|
296
|
+
} : undefined,
|
|
297
|
+
themeIcon: Codicon.extensions,
|
|
298
|
+
command: {
|
|
299
|
+
id: 'extension.open',
|
|
300
|
+
title: '',
|
|
301
|
+
arguments: [e.identifier.id, undefined, true]
|
|
302
|
+
}
|
|
303
|
+
})));
|
|
303
304
|
}
|
|
304
305
|
async hasContent() {
|
|
305
306
|
const extensions = await this.getExtensions();
|
|
@@ -319,12 +320,12 @@ let ExtensionsResourceExportTreeItem = class ExtensionsResourceExportTreeItem ex
|
|
|
319
320
|
return this.instantiationService.createInstance(ExtensionsResource).getLocalExtensions(this.profile);
|
|
320
321
|
}
|
|
321
322
|
async getContent() {
|
|
322
|
-
return this.instantiationService.createInstance(ExtensionsResource).getContent(this.profile, [...(
|
|
323
|
+
return this.instantiationService.createInstance(ExtensionsResource).getContent(this.profile, [...( this.excludedExtensions.values())]);
|
|
323
324
|
}
|
|
324
325
|
};
|
|
325
|
-
ExtensionsResourceExportTreeItem = (
|
|
326
|
-
(
|
|
327
|
-
], ExtensionsResourceExportTreeItem))
|
|
326
|
+
ExtensionsResourceExportTreeItem = ( __decorate([
|
|
327
|
+
( __param(1, IInstantiationService))
|
|
328
|
+
], ExtensionsResourceExportTreeItem));
|
|
328
329
|
let ExtensionsResourceImportTreeItem = class ExtensionsResourceImportTreeItem extends ExtensionsResourceTreeItem {
|
|
329
330
|
constructor(content, instantiationService) {
|
|
330
331
|
super();
|
|
@@ -340,11 +341,11 @@ let ExtensionsResourceImportTreeItem = class ExtensionsResourceImportTreeItem ex
|
|
|
340
341
|
async getContent() {
|
|
341
342
|
const extensionsResource = this.instantiationService.createInstance(ExtensionsResource);
|
|
342
343
|
const extensions = await extensionsResource.getProfileExtensions(this.content);
|
|
343
|
-
return extensionsResource.toContent(extensions, [...(
|
|
344
|
+
return extensionsResource.toContent(extensions, [...( this.excludedExtensions.values())]);
|
|
344
345
|
}
|
|
345
346
|
};
|
|
346
|
-
ExtensionsResourceImportTreeItem = (
|
|
347
|
-
(
|
|
348
|
-
], ExtensionsResourceImportTreeItem))
|
|
347
|
+
ExtensionsResourceImportTreeItem = ( __decorate([
|
|
348
|
+
( __param(1, IInstantiationService))
|
|
349
|
+
], ExtensionsResourceImportTreeItem));
|
|
349
350
|
|
|
350
351
|
export { ExtensionsResource, ExtensionsResourceExportTreeItem, ExtensionsResourceImportTreeItem, ExtensionsResourceInitializer, ExtensionsResourceTreeItem };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { IStringDictionary } from "vscode/vscode/vs/base/common/collections";
|
|
2
|
+
import { URI } from "vscode/vscode/vs/base/common/uri";
|
|
3
|
+
import { IInstantiationService } from "vscode/vscode/vs/platform/instantiation/common/instantiation";
|
|
4
|
+
import { ILogService } from "vscode/vscode/vs/platform/log/common/log.service";
|
|
5
|
+
import { IStorageService } from "vscode/vscode/vs/platform/storage/common/storage.service";
|
|
6
|
+
import { IUriIdentityService } from "vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service";
|
|
7
|
+
import { IUserDataProfile, ProfileResourceType } from "vscode/vscode/vs/platform/userDataProfile/common/userDataProfile";
|
|
8
|
+
import { IUserDataProfileStorageService } from "vscode/vscode/vs/platform/userDataProfile/common/userDataProfileStorageService.service";
|
|
9
|
+
import { ITreeItemCheckboxState, TreeItemCollapsibleState } from "vscode/vscode/vs/workbench/common/views";
|
|
10
|
+
import { IProfileResource, IProfileResourceChildTreeItem, IProfileResourceInitializer, IProfileResourceTreeItem } from "@codingame/monaco-vscode-e72c94ca-257a-5b75-8b68-5a5fa3c18255-common/vscode/vs/workbench/services/userDataProfile/common/userDataProfile";
|
|
11
|
+
interface IGlobalState {
|
|
12
|
+
storage: IStringDictionary<string>;
|
|
13
|
+
}
|
|
14
|
+
export declare class GlobalStateResourceInitializer implements IProfileResourceInitializer {
|
|
15
|
+
private readonly storageService;
|
|
16
|
+
constructor(storageService: IStorageService);
|
|
17
|
+
initialize(content: string): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
export declare class GlobalStateResource implements IProfileResource {
|
|
20
|
+
private readonly storageService;
|
|
21
|
+
private readonly userDataProfileStorageService;
|
|
22
|
+
private readonly logService;
|
|
23
|
+
constructor(storageService: IStorageService, userDataProfileStorageService: IUserDataProfileStorageService, logService: ILogService);
|
|
24
|
+
getContent(profile: IUserDataProfile): Promise<string>;
|
|
25
|
+
apply(content: string, profile: IUserDataProfile): Promise<void>;
|
|
26
|
+
getGlobalState(profile: IUserDataProfile): Promise<IGlobalState>;
|
|
27
|
+
private writeGlobalState;
|
|
28
|
+
}
|
|
29
|
+
export declare abstract class GlobalStateResourceTreeItem implements IProfileResourceTreeItem {
|
|
30
|
+
private readonly resource;
|
|
31
|
+
private readonly uriIdentityService;
|
|
32
|
+
readonly type = ProfileResourceType.GlobalState;
|
|
33
|
+
readonly handle = ProfileResourceType.GlobalState;
|
|
34
|
+
readonly label: {
|
|
35
|
+
label: string;
|
|
36
|
+
};
|
|
37
|
+
readonly collapsibleState = TreeItemCollapsibleState.Collapsed;
|
|
38
|
+
checkbox: ITreeItemCheckboxState | undefined;
|
|
39
|
+
constructor(resource: URI, uriIdentityService: IUriIdentityService);
|
|
40
|
+
getChildren(): Promise<IProfileResourceChildTreeItem[]>;
|
|
41
|
+
abstract getContent(): Promise<string>;
|
|
42
|
+
abstract isFromDefaultProfile(): boolean;
|
|
43
|
+
}
|
|
44
|
+
export declare class GlobalStateResourceExportTreeItem extends GlobalStateResourceTreeItem {
|
|
45
|
+
private readonly profile;
|
|
46
|
+
private readonly instantiationService;
|
|
47
|
+
constructor(profile: IUserDataProfile, resource: URI, uriIdentityService: IUriIdentityService, instantiationService: IInstantiationService);
|
|
48
|
+
hasContent(): Promise<boolean>;
|
|
49
|
+
getContent(): Promise<string>;
|
|
50
|
+
isFromDefaultProfile(): boolean;
|
|
51
|
+
}
|
|
52
|
+
export declare class GlobalStateResourceImportTreeItem extends GlobalStateResourceTreeItem {
|
|
53
|
+
private readonly content;
|
|
54
|
+
constructor(content: string, resource: URI, uriIdentityService: IUriIdentityService);
|
|
55
|
+
getContent(): Promise<string>;
|
|
56
|
+
isFromDefaultProfile(): boolean;
|
|
57
|
+
}
|
|
58
|
+
export {};
|