@codingame/monaco-vscode-user-data-profile-service-override 33.0.9 → 34.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.js +24 -24
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfileActions.js +3 -3
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditor.js +79 -79
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditorModel.js +26 -26
- package/vscode/src/vs/workbench/services/userDataProfile/browser/extensionsResource.js +5 -5
- package/vscode/src/vs/workbench/services/userDataProfile/browser/globalStateResource.js +1 -1
- package/vscode/src/vs/workbench/services/userDataProfile/browser/keybindingsResource.js +1 -1
- package/vscode/src/vs/workbench/services/userDataProfile/browser/mcpProfileResource.js +1 -1
- package/vscode/src/vs/workbench/services/userDataProfile/browser/settingsResource.js +1 -1
- package/vscode/src/vs/workbench/services/userDataProfile/browser/snippetsResource.d.ts +5 -2
- package/vscode/src/vs/workbench/services/userDataProfile/browser/snippetsResource.js +34 -8
- package/vscode/src/vs/workbench/services/userDataProfile/browser/tasksResource.js +1 -1
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileImportExportService.js +42 -39
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileInit.js +6 -1
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileManagement.js +8 -8
package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditorModel.js
CHANGED
|
@@ -223,15 +223,15 @@ let AbstractUserDataProfileElement = class AbstractUserDataProfileElement extend
|
|
|
223
223
|
}
|
|
224
224
|
validate() {
|
|
225
225
|
if (!this.name) {
|
|
226
|
-
this.message = ( localize(
|
|
226
|
+
this.message = ( localize(15850, "Profile name is required and must be a non-empty value."));
|
|
227
227
|
return;
|
|
228
228
|
}
|
|
229
229
|
if (this.shouldValidateName() && this.name !== this.getInitialName() && ( this.userDataProfilesService.profiles.some(p => p.name === this.name))) {
|
|
230
|
-
this.message = ( localize(
|
|
230
|
+
this.message = ( localize(15851, "Profile with name {0} already exists.", this.name));
|
|
231
231
|
return;
|
|
232
232
|
}
|
|
233
233
|
if (this.flags && this.flags.settings && this.flags.keybindings && this.flags.tasks && this.flags.snippets && this.flags.extensions) {
|
|
234
|
-
this.message = ( localize(
|
|
234
|
+
this.message = ( localize(15852, "The profile should contain at least one configuration."));
|
|
235
235
|
return;
|
|
236
236
|
}
|
|
237
237
|
this.message = undefined;
|
|
@@ -254,7 +254,7 @@ let AbstractUserDataProfileElement = class AbstractUserDataProfileElement extend
|
|
|
254
254
|
resourceType: r,
|
|
255
255
|
openAction: children.length ? toAction({
|
|
256
256
|
id: "_open",
|
|
257
|
-
label: ( localize(
|
|
257
|
+
label: ( localize(15853, "Open to the Side")),
|
|
258
258
|
class: ThemeIcon.asClassName(Codicon.goToFile),
|
|
259
259
|
run: () => children[0]?.openAction?.run()
|
|
260
260
|
}) : undefined
|
|
@@ -301,7 +301,7 @@ let AbstractUserDataProfileElement = class AbstractUserDataProfileElement extend
|
|
|
301
301
|
icon: child.themeIcon,
|
|
302
302
|
openAction: toAction({
|
|
303
303
|
id: "_openChild",
|
|
304
|
-
label: ( localize(
|
|
304
|
+
label: ( localize(15853, "Open to the Side")),
|
|
305
305
|
class: ThemeIcon.asClassName(Codicon.goToFile),
|
|
306
306
|
run: async () => {
|
|
307
307
|
if (child.parent.type === ProfileResourceType.Extensions) {
|
|
@@ -504,7 +504,7 @@ let UserDataProfileElement = class UserDataProfileElement extends AbstractUserDa
|
|
|
504
504
|
const children = await this.instantiationService.createInstance(ExtensionsResourceExportTreeItem, this.profile).getChildren();
|
|
505
505
|
return (children.map(child => this.toUserDataProfileResourceChildElement(child, undefined, [{
|
|
506
506
|
id: "applyToAllProfiles",
|
|
507
|
-
label: ( localize(
|
|
507
|
+
label: ( localize(15854, "Apply Extension to all Profiles")),
|
|
508
508
|
checked: child.applicationScoped,
|
|
509
509
|
enabled: true,
|
|
510
510
|
class: "",
|
|
@@ -674,7 +674,7 @@ let NewProfileElement = class NewProfileElement extends AbstractUserDataProfileE
|
|
|
674
674
|
}
|
|
675
675
|
if (isUserDataProfile(this.copyFrom)) {
|
|
676
676
|
if (this.defaultName === this.name) {
|
|
677
|
-
this.name = this.defaultName = ( localize(
|
|
677
|
+
this.name = this.defaultName = ( localize(15855, "{0} (Copy)", this.copyFrom.name));
|
|
678
678
|
}
|
|
679
679
|
if (this.defaultIcon === this.icon) {
|
|
680
680
|
this.icon = this.defaultIcon = this.copyFrom.icon;
|
|
@@ -710,7 +710,7 @@ let NewProfileElement = class NewProfileElement extends AbstractUserDataProfileE
|
|
|
710
710
|
}
|
|
711
711
|
}
|
|
712
712
|
getNewProfileName() {
|
|
713
|
-
const name = ( localize(
|
|
713
|
+
const name = ( localize(15856, "Untitled"));
|
|
714
714
|
const nameRegEx = ( new RegExp(`${name}\\s(\\d+)`));
|
|
715
715
|
let nameIndex = 0;
|
|
716
716
|
for (const profile of this.userDataProfilesService.profiles) {
|
|
@@ -950,11 +950,11 @@ let UserDataProfilesEditorModel = class UserDataProfilesEditorModel extends Edit
|
|
|
950
950
|
}
|
|
951
951
|
createProfileElement(profile) {
|
|
952
952
|
const disposables = ( new DisposableStore());
|
|
953
|
-
const activateAction = disposables.add(( new Action("userDataProfile.activate", ( localize(
|
|
954
|
-
const copyFromProfileAction = disposables.add(( new Action("userDataProfile.copyFromProfile", ( localize(
|
|
955
|
-
const exportAction = disposables.add(( new Action("userDataProfile.export", ( localize(
|
|
956
|
-
const deleteAction = disposables.add(( new Action("userDataProfile.delete", ( localize(
|
|
957
|
-
const newWindowAction = disposables.add(( new Action("userDataProfile.newWindow", ( localize(
|
|
953
|
+
const activateAction = disposables.add(( new Action("userDataProfile.activate", ( localize(15857, "Use this Profile for Current Window")), ThemeIcon.asClassName(Codicon.check), true, () => this.userDataProfileManagementService.switchProfile(profileElement.profile))));
|
|
954
|
+
const copyFromProfileAction = disposables.add(( new Action("userDataProfile.copyFromProfile", ( localize(15858, "Duplicate...")), ThemeIcon.asClassName(Codicon.copy), true, () => this.createNewProfile(profileElement.profile))));
|
|
955
|
+
const exportAction = disposables.add(( new Action("userDataProfile.export", ( localize(15859, "Export...")), ThemeIcon.asClassName(Codicon.export), true, () => this.userDataProfileImportExportService.exportProfile(profile))));
|
|
956
|
+
const deleteAction = disposables.add(( new Action("userDataProfile.delete", ( localize(15860, "Delete")), ThemeIcon.asClassName(Codicon.trash), true, () => this.removeProfile(profileElement.profile))));
|
|
957
|
+
const newWindowAction = disposables.add(( new Action("userDataProfile.newWindow", ( localize(15861, "Open New Window with this Profile")), ThemeIcon.asClassName(Codicon.emptyWindow), true, () => this.openWindow(profileElement.profile))));
|
|
958
958
|
const primaryActions = [];
|
|
959
959
|
primaryActions.push(activateAction);
|
|
960
960
|
primaryActions.push(newWindowAction);
|
|
@@ -982,11 +982,11 @@ let UserDataProfilesEditorModel = class UserDataProfilesEditorModel extends Edit
|
|
|
982
982
|
const result = await this.dialogService.confirm({
|
|
983
983
|
type: "info",
|
|
984
984
|
message: ( localize(
|
|
985
|
-
|
|
985
|
+
15862,
|
|
986
986
|
"A new profile is already being created. Do you want to discard it and create a new one?"
|
|
987
987
|
)),
|
|
988
|
-
primaryButton: ( localize(
|
|
989
|
-
cancelButton: ( localize(
|
|
988
|
+
primaryButton: ( localize(15863, "Discard & Create")),
|
|
989
|
+
cancelButton: ( localize(15864, "Cancel"))
|
|
990
990
|
});
|
|
991
991
|
if (!result.confirmed) {
|
|
992
992
|
return;
|
|
@@ -1007,18 +1007,18 @@ let UserDataProfilesEditorModel = class UserDataProfilesEditorModel extends Edit
|
|
|
1007
1007
|
disposables.add(toDisposable(() => cancellationTokenSource.dispose(true)));
|
|
1008
1008
|
const primaryActions = [];
|
|
1009
1009
|
const secondaryActions = [];
|
|
1010
|
-
const createAction = disposables.add(( new Action("userDataProfile.create", ( localize(
|
|
1010
|
+
const createAction = disposables.add(( new Action("userDataProfile.create", ( localize(15865, "Create")), undefined, true, () => this.saveNewProfile(false, cancellationTokenSource.token))));
|
|
1011
1011
|
primaryActions.push(createAction);
|
|
1012
1012
|
if (isWeb && copyFrom instanceof URI && isProfileURL(copyFrom)) {
|
|
1013
|
-
primaryActions.push(disposables.add(( new Action("userDataProfile.createInDesktop", ( localize(
|
|
1013
|
+
primaryActions.push(disposables.add(( new Action("userDataProfile.createInDesktop", ( localize(15866, "Create in {0}", this.productService.nameLong)), undefined, true, () => this.openerService.open(copyFrom, {
|
|
1014
1014
|
openExternal: true
|
|
1015
1015
|
})))));
|
|
1016
1016
|
}
|
|
1017
|
-
const cancelAction = disposables.add(( new Action("userDataProfile.cancel", ( localize(
|
|
1017
|
+
const cancelAction = disposables.add(( new Action("userDataProfile.cancel", ( localize(15864, "Cancel")), ThemeIcon.asClassName(Codicon.trash), true, () => this.discardNewProfile())));
|
|
1018
1018
|
secondaryActions.push(cancelAction);
|
|
1019
|
-
const previewProfileAction = disposables.add(( new Action("userDataProfile.preview", ( localize(
|
|
1019
|
+
const previewProfileAction = disposables.add(( new Action("userDataProfile.preview", ( localize(15867, "Preview")), ThemeIcon.asClassName(Codicon.openPreview), true, () => this.previewNewProfile(cancellationTokenSource.token))));
|
|
1020
1020
|
secondaryActions.push(previewProfileAction);
|
|
1021
|
-
const exportAction = disposables.add(( new Action("userDataProfile.export", ( localize(
|
|
1021
|
+
const exportAction = disposables.add(( new Action("userDataProfile.export", ( localize(15859, "Export...")), ThemeIcon.asClassName(Codicon.export), isUserDataProfile(copyFrom), () => this.exportNewProfile(cancellationTokenSource.token))));
|
|
1022
1022
|
this.newProfileElement = disposables.add(this.instantiationService.createInstance(
|
|
1023
1023
|
NewProfileElement,
|
|
1024
1024
|
copyFrom,
|
|
@@ -1028,9 +1028,9 @@ let UserDataProfilesEditorModel = class UserDataProfilesEditorModel extends Edit
|
|
|
1028
1028
|
const updateCreateActionLabel = () => {
|
|
1029
1029
|
if (createAction.enabled) {
|
|
1030
1030
|
if (this.newProfileElement?.copyFrom && ( this.userDataProfilesService.profiles.some(p => !p.isInternal && p.name === this.newProfileElement?.name))) {
|
|
1031
|
-
createAction.label = ( localize(
|
|
1031
|
+
createAction.label = ( localize(15868, "Replace"));
|
|
1032
1032
|
} else {
|
|
1033
|
-
createAction.label = ( localize(
|
|
1033
|
+
createAction.label = ( localize(15865, "Create"));
|
|
1034
1034
|
}
|
|
1035
1035
|
}
|
|
1036
1036
|
};
|
|
@@ -1200,9 +1200,9 @@ let UserDataProfilesEditorModel = class UserDataProfilesEditorModel extends Edit
|
|
|
1200
1200
|
async removeProfile(profile) {
|
|
1201
1201
|
const result = await this.dialogService.confirm({
|
|
1202
1202
|
type: "info",
|
|
1203
|
-
message: ( localize(
|
|
1204
|
-
primaryButton: ( localize(
|
|
1205
|
-
cancelButton: ( localize(
|
|
1203
|
+
message: ( localize(15869, "Are you sure you want to delete the profile '{0}'?", profile.name)),
|
|
1204
|
+
primaryButton: ( localize(15860, "Delete")),
|
|
1205
|
+
cancelButton: ( localize(15864, "Cancel"))
|
|
1206
1206
|
});
|
|
1207
1207
|
if (result.confirmed) {
|
|
1208
1208
|
await this.userDataProfileManagementService.removeProfile(profile);
|
|
@@ -227,7 +227,7 @@ let ExtensionsResource = class ExtensionsResource {
|
|
|
227
227
|
return;
|
|
228
228
|
}
|
|
229
229
|
progress?.(( localize(
|
|
230
|
-
|
|
230
|
+
17507,
|
|
231
231
|
"Installing extension {0}...",
|
|
232
232
|
installExtensionInfo.extension.displayName ?? installExtensionInfo.extension.identifier.id
|
|
233
233
|
)));
|
|
@@ -322,7 +322,7 @@ class ExtensionsResourceTreeItem {
|
|
|
322
322
|
this.type = ProfileResourceType.Extensions;
|
|
323
323
|
this.handle = ProfileResourceType.Extensions;
|
|
324
324
|
this.label = {
|
|
325
|
-
label: ( localize(
|
|
325
|
+
label: ( localize(17508, "Extensions"))
|
|
326
326
|
};
|
|
327
327
|
this.collapsibleState = TreeItemCollapsibleState.Expanded;
|
|
328
328
|
this.contextValue = ProfileResourceType.Extensions;
|
|
@@ -340,7 +340,7 @@ class ExtensionsResourceTreeItem {
|
|
|
340
340
|
label: {
|
|
341
341
|
label: e.displayName || e.identifier.id
|
|
342
342
|
},
|
|
343
|
-
description: e.applicationScoped ? ( localize(
|
|
343
|
+
description: e.applicationScoped ? ( localize(17509, "All Profiles")) : undefined,
|
|
344
344
|
collapsibleState: TreeItemCollapsibleState.None,
|
|
345
345
|
checkbox: that.checkbox ? {
|
|
346
346
|
get isChecked() {
|
|
@@ -353,9 +353,9 @@ class ExtensionsResourceTreeItem {
|
|
|
353
353
|
that.excludedExtensions.add(e.identifier.id.toLowerCase());
|
|
354
354
|
}
|
|
355
355
|
},
|
|
356
|
-
tooltip: ( localize(
|
|
356
|
+
tooltip: ( localize(17510, "Select {0} Extension", e.displayName || e.identifier.id)),
|
|
357
357
|
accessibilityInformation: {
|
|
358
|
-
label: ( localize(
|
|
358
|
+
label: ( localize(17510, "Select {0} Extension", e.displayName || e.identifier.id))
|
|
359
359
|
}
|
|
360
360
|
} : undefined,
|
|
361
361
|
themeIcon: Codicon.extensions,
|
|
@@ -89,7 +89,7 @@ class GlobalStateResourceTreeItem {
|
|
|
89
89
|
this.type = ProfileResourceType.GlobalState;
|
|
90
90
|
this.handle = ProfileResourceType.GlobalState;
|
|
91
91
|
this.label = {
|
|
92
|
-
label: ( localize(
|
|
92
|
+
label: ( localize(17511, "UI State"))
|
|
93
93
|
};
|
|
94
94
|
this.collapsibleState = TreeItemCollapsibleState.Collapsed;
|
|
95
95
|
}
|
|
@@ -81,7 +81,7 @@ let KeybindingsResourceTreeItem = class KeybindingsResourceTreeItem {
|
|
|
81
81
|
this.type = ProfileResourceType.Keybindings;
|
|
82
82
|
this.handle = ProfileResourceType.Keybindings;
|
|
83
83
|
this.label = {
|
|
84
|
-
label: ( localize(
|
|
84
|
+
label: ( localize(17512, "Keyboard Shortcuts"))
|
|
85
85
|
};
|
|
86
86
|
this.collapsibleState = TreeItemCollapsibleState.Expanded;
|
|
87
87
|
}
|
|
@@ -76,7 +76,7 @@ let McpResourceTreeItem = class McpResourceTreeItem {
|
|
|
76
76
|
this.type = ProfileResourceType.Mcp;
|
|
77
77
|
this.handle = ProfileResourceType.Mcp;
|
|
78
78
|
this.label = {
|
|
79
|
-
label: ( localize(
|
|
79
|
+
label: ( localize(17513, "MCP Servers"))
|
|
80
80
|
};
|
|
81
81
|
this.collapsibleState = TreeItemCollapsibleState.Expanded;
|
|
82
82
|
}
|
|
@@ -105,7 +105,7 @@ let SettingsResourceTreeItem = class SettingsResourceTreeItem {
|
|
|
105
105
|
this.type = ProfileResourceType.Settings;
|
|
106
106
|
this.handle = ProfileResourceType.Settings;
|
|
107
107
|
this.label = {
|
|
108
|
-
label: ( localize(
|
|
108
|
+
label: ( localize(17514, "Settings"))
|
|
109
109
|
};
|
|
110
110
|
this.collapsibleState = TreeItemCollapsibleState.Expanded;
|
|
111
111
|
}
|
|
@@ -2,6 +2,7 @@ import { ResourceSet } from "@codingame/monaco-vscode-api/vscode/vs/base/common/
|
|
|
2
2
|
import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
|
|
3
3
|
import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service";
|
|
4
4
|
import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
|
|
5
|
+
import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
|
|
5
6
|
import { IUriIdentityService } from "@codingame/monaco-vscode-api/vscode/vs/platform/uriIdentity/common/uriIdentity.service";
|
|
6
7
|
import { IUserDataProfile, ProfileResourceType } from "@codingame/monaco-vscode-api/vscode/vs/platform/userDataProfile/common/userDataProfile";
|
|
7
8
|
import { ITreeItemCheckboxState, TreeItemCollapsibleState } from "@codingame/monaco-vscode-api/vscode/vs/workbench/common/views";
|
|
@@ -11,13 +12,15 @@ export declare class SnippetsResourceInitializer implements IProfileResourceInit
|
|
|
11
12
|
private readonly userDataProfileService;
|
|
12
13
|
private readonly fileService;
|
|
13
14
|
private readonly uriIdentityService;
|
|
14
|
-
|
|
15
|
+
private readonly logService;
|
|
16
|
+
constructor(userDataProfileService: IUserDataProfileService, fileService: IFileService, uriIdentityService: IUriIdentityService, logService: ILogService);
|
|
15
17
|
initialize(content: string): Promise<void>;
|
|
16
18
|
}
|
|
17
19
|
export declare class SnippetsResource implements IProfileResource {
|
|
18
20
|
private readonly fileService;
|
|
19
21
|
private readonly uriIdentityService;
|
|
20
|
-
|
|
22
|
+
private readonly logService;
|
|
23
|
+
constructor(fileService: IFileService, uriIdentityService: IUriIdentityService, logService: ILogService);
|
|
21
24
|
getContent(profile: IUserDataProfile, excluded?: ResourceSet): Promise<string>;
|
|
22
25
|
apply(content: string, profile: IUserDataProfile): Promise<void>;
|
|
23
26
|
private getSnippets;
|
|
@@ -6,31 +6,51 @@ import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
|
6
6
|
import { FileOperationError, FileOperationResult } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files';
|
|
7
7
|
import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
|
|
8
8
|
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
9
|
+
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
9
10
|
import { IUriIdentityService } from '@codingame/monaco-vscode-api/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
|
|
10
11
|
import { ProfileResourceType } from '@codingame/monaco-vscode-api/vscode/vs/platform/userDataProfile/common/userDataProfile';
|
|
11
12
|
import { API_OPEN_EDITOR_COMMAND_ID } from '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/parts/editor/editorCommands';
|
|
12
13
|
import { TreeItemCollapsibleState } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/views';
|
|
13
14
|
import { IUserDataProfileService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/userDataProfile/common/userDataProfile.service';
|
|
14
15
|
|
|
16
|
+
function toSnippetResource(extUri, snippetsHome, key) {
|
|
17
|
+
const resource = extUri.joinPath(snippetsHome, key);
|
|
18
|
+
if (!extUri.isEqualOrParent(resource, snippetsHome) || extUri.isEqual(resource, snippetsHome)) {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
return resource;
|
|
22
|
+
}
|
|
15
23
|
let SnippetsResourceInitializer = class SnippetsResourceInitializer {
|
|
16
|
-
constructor(userDataProfileService, fileService, uriIdentityService) {
|
|
24
|
+
constructor(userDataProfileService, fileService, uriIdentityService, logService) {
|
|
17
25
|
this.userDataProfileService = userDataProfileService;
|
|
18
26
|
this.fileService = fileService;
|
|
19
27
|
this.uriIdentityService = uriIdentityService;
|
|
28
|
+
this.logService = logService;
|
|
20
29
|
}
|
|
21
30
|
async initialize(content) {
|
|
22
31
|
const snippetsContent = JSON.parse(content);
|
|
23
32
|
for (const key in snippetsContent.snippets) {
|
|
24
|
-
const resource =
|
|
33
|
+
const resource = toSnippetResource(
|
|
34
|
+
this.uriIdentityService.extUri,
|
|
35
|
+
this.userDataProfileService.currentProfile.snippetsHome,
|
|
36
|
+
key
|
|
37
|
+
);
|
|
38
|
+
if (!resource) {
|
|
39
|
+
this.logService.warn(
|
|
40
|
+
`SnippetsResourceInitializer: Ignoring snippet with key '${key}' as it escapes the snippets folder.`
|
|
41
|
+
);
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
25
44
|
await this.fileService.writeFile(resource, VSBuffer.fromString(snippetsContent.snippets[key]));
|
|
26
45
|
}
|
|
27
46
|
}
|
|
28
47
|
};
|
|
29
|
-
SnippetsResourceInitializer = ( __decorate([( __param(0, IUserDataProfileService)), ( __param(1, IFileService)), ( __param(2, IUriIdentityService))], SnippetsResourceInitializer));
|
|
48
|
+
SnippetsResourceInitializer = ( __decorate([( __param(0, IUserDataProfileService)), ( __param(1, IFileService)), ( __param(2, IUriIdentityService)), ( __param(3, ILogService))], SnippetsResourceInitializer));
|
|
30
49
|
let SnippetsResource = class SnippetsResource {
|
|
31
|
-
constructor(fileService, uriIdentityService) {
|
|
50
|
+
constructor(fileService, uriIdentityService, logService) {
|
|
32
51
|
this.fileService = fileService;
|
|
33
52
|
this.uriIdentityService = uriIdentityService;
|
|
53
|
+
this.logService = logService;
|
|
34
54
|
}
|
|
35
55
|
async getContent(profile, excluded) {
|
|
36
56
|
const snippets = await this.getSnippets(profile, excluded);
|
|
@@ -41,7 +61,13 @@ let SnippetsResource = class SnippetsResource {
|
|
|
41
61
|
async apply(content, profile) {
|
|
42
62
|
const snippetsContent = JSON.parse(content);
|
|
43
63
|
for (const key in snippetsContent.snippets) {
|
|
44
|
-
const resource = this.uriIdentityService.extUri
|
|
64
|
+
const resource = toSnippetResource(this.uriIdentityService.extUri, profile.snippetsHome, key);
|
|
65
|
+
if (!resource) {
|
|
66
|
+
this.logService.warn(
|
|
67
|
+
`SnippetsResource: Ignoring snippet with key '${key}' as it escapes the snippets folder.`
|
|
68
|
+
);
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
45
71
|
await this.fileService.writeFile(resource, VSBuffer.fromString(snippetsContent.snippets[key]));
|
|
46
72
|
}
|
|
47
73
|
}
|
|
@@ -81,7 +107,7 @@ let SnippetsResource = class SnippetsResource {
|
|
|
81
107
|
return snippets;
|
|
82
108
|
}
|
|
83
109
|
};
|
|
84
|
-
SnippetsResource = ( __decorate([( __param(0, IFileService)), ( __param(1, IUriIdentityService))], SnippetsResource));
|
|
110
|
+
SnippetsResource = ( __decorate([( __param(0, IFileService)), ( __param(1, IUriIdentityService)), ( __param(2, ILogService))], SnippetsResource));
|
|
85
111
|
let SnippetsResourceTreeItem = class SnippetsResourceTreeItem {
|
|
86
112
|
constructor(profile, instantiationService, uriIdentityService) {
|
|
87
113
|
this.profile = profile;
|
|
@@ -89,7 +115,7 @@ let SnippetsResourceTreeItem = class SnippetsResourceTreeItem {
|
|
|
89
115
|
this.uriIdentityService = uriIdentityService;
|
|
90
116
|
this.type = ProfileResourceType.Snippets;
|
|
91
117
|
this.label = {
|
|
92
|
-
label: ( localize(
|
|
118
|
+
label: ( localize(17515, "Snippets"))
|
|
93
119
|
};
|
|
94
120
|
this.collapsibleState = TreeItemCollapsibleState.Collapsed;
|
|
95
121
|
this.excludedSnippets = ( new ResourceSet());
|
|
@@ -119,7 +145,7 @@ let SnippetsResourceTreeItem = class SnippetsResourceTreeItem {
|
|
|
119
145
|
},
|
|
120
146
|
accessibilityInformation: {
|
|
121
147
|
label: ( localize(
|
|
122
|
-
|
|
148
|
+
17516,
|
|
123
149
|
"Select Snippet {0}",
|
|
124
150
|
this.uriIdentityService.extUri.basename(resource)
|
|
125
151
|
))
|
|
@@ -76,7 +76,7 @@ let TasksResourceTreeItem = class TasksResourceTreeItem {
|
|
|
76
76
|
this.type = ProfileResourceType.Tasks;
|
|
77
77
|
this.handle = ProfileResourceType.Tasks;
|
|
78
78
|
this.label = {
|
|
79
|
-
label: ( localize(
|
|
79
|
+
label: ( localize(17517, "Tasks"))
|
|
80
80
|
};
|
|
81
81
|
this.collapsibleState = TreeItemCollapsibleState.Expanded;
|
|
82
82
|
}
|