mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-20 02:08:47 +00:00
consider icon during profile import/export (#193963)
This commit is contained in:
committed by
GitHub
parent
2b40a69b3b
commit
1f56ec49bf
@@ -82,7 +82,6 @@ import { KeyCode } from 'vs/base/common/keyCodes';
|
||||
|
||||
interface IUserDataProfileTemplate {
|
||||
readonly name: string;
|
||||
readonly shortName?: string;
|
||||
readonly icon?: string;
|
||||
readonly settings?: string;
|
||||
readonly keybindings?: string;
|
||||
@@ -97,7 +96,6 @@ function isUserDataProfileTemplate(thing: unknown): thing is IUserDataProfileTem
|
||||
|
||||
return !!(candidate && typeof candidate === 'object'
|
||||
&& (candidate.name && typeof candidate.name === 'string')
|
||||
&& (isUndefined(candidate.shortName) || typeof candidate.shortName === 'string')
|
||||
&& (isUndefined(candidate.icon) || typeof candidate.icon === 'string')
|
||||
&& (isUndefined(candidate.settings) || typeof candidate.settings === 'string')
|
||||
&& (isUndefined(candidate.globalState) || typeof candidate.globalState === 'string')
|
||||
@@ -567,7 +565,7 @@ export class UserDataProfileImportExportService extends Disposable implements IU
|
||||
private async createFromProfile(profile: IUserDataProfile, name: string, options?: IUserDataProfileOptions): Promise<void> {
|
||||
const userDataProfilesExportState = this.instantiationService.createInstance(UserDataProfileExportState, profile);
|
||||
try {
|
||||
const profileTemplate = await userDataProfilesExportState.getProfileTemplate(name, undefined);
|
||||
const profileTemplate = await userDataProfilesExportState.getProfileTemplate(name, options?.icon);
|
||||
await this.progressService.withProgress({
|
||||
location: ProgressLocation.Notification,
|
||||
delay: 500,
|
||||
@@ -915,7 +913,7 @@ export class UserDataProfileImportExportService extends Disposable implements IU
|
||||
const profile = this.userDataProfilesService.profiles.find(p => p.name === profileName);
|
||||
if (profile) {
|
||||
if (temp) {
|
||||
return this.userDataProfilesService.createNamedProfile(`${profileName} ${this.getProfileNameIndex(profileName)}`, { ...options, shortName: profileTemplate.shortName, transient: temp });
|
||||
return this.userDataProfilesService.createNamedProfile(`${profileName} ${this.getProfileNameIndex(profileName)}`, { ...options, transient: temp });
|
||||
}
|
||||
|
||||
enum ImportProfileChoice {
|
||||
@@ -966,7 +964,7 @@ export class UserDataProfileImportExportService extends Disposable implements IU
|
||||
}
|
||||
return this.userDataProfilesService.createNamedProfile(name);
|
||||
} else {
|
||||
return this.userDataProfilesService.createNamedProfile(profileName, { ...options, shortName: profileTemplate.shortName, transient: temp });
|
||||
return this.userDataProfilesService.createNamedProfile(profileName, { ...options, transient: temp });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1284,7 +1282,7 @@ abstract class UserDataProfileImportExportState extends Disposable implements IT
|
||||
return this.roots.some(root => this.isSelected(root));
|
||||
}
|
||||
|
||||
async getProfileTemplate(name: string, shortName: string | undefined): Promise<IUserDataProfileTemplate> {
|
||||
async getProfileTemplate(name: string, icon: string | undefined): Promise<IUserDataProfileTemplate> {
|
||||
const roots = await this.getRoots();
|
||||
let settings: string | undefined;
|
||||
let keybindings: string | undefined;
|
||||
@@ -1313,7 +1311,7 @@ abstract class UserDataProfileImportExportState extends Disposable implements IT
|
||||
|
||||
return {
|
||||
name,
|
||||
shortName,
|
||||
icon,
|
||||
settings,
|
||||
keybindings,
|
||||
tasks,
|
||||
@@ -1442,7 +1440,7 @@ class UserDataProfileExportState extends UserDataProfileImportExportState {
|
||||
}
|
||||
}
|
||||
|
||||
return super.getProfileTemplate(name, this.profile.shortName);
|
||||
return super.getProfileTemplate(name, this.profile.icon);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1530,7 +1528,7 @@ class UserDataProfileImportState extends UserDataProfileImportExportState {
|
||||
}
|
||||
|
||||
async getProfileTemplateToImport(): Promise<IUserDataProfileTemplate> {
|
||||
return this.getProfileTemplate(this.profile.name, this.profile.shortName);
|
||||
return this.getProfileTemplate(this.profile.name, this.profile.icon);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user