Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consider icon during profile import/export #193963

Merged
merged 1 commit into from
Sep 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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')
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 });
}
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -1313,7 +1311,7 @@ abstract class UserDataProfileImportExportState extends Disposable implements IT

return {
name,
shortName,
icon,
settings,
keybindings,
tasks,
Expand Down Expand Up @@ -1442,7 +1440,7 @@ class UserDataProfileExportState extends UserDataProfileImportExportState {
}
}

return super.getProfileTemplate(name, this.profile.shortName);
return super.getProfileTemplate(name, this.profile.icon);
}

}
Expand Down Expand Up @@ -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);
}

}
Expand Down