Skip to content

Commit 226eb40

Browse files
authored
import empty profile without showing preview (microsoft#167388)
1 parent 3df8cad commit 226eb40

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

src/vs/workbench/services/userDataProfile/browser/userDataProfileImportExportService.ts

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -244,22 +244,25 @@ export class UserDataProfileImportExportService extends Disposable implements IU
244244
const userDataProfileImportState = disposables.add(this.instantiationService.createInstance(UserDataProfileImportState, profileTemplate));
245245

246246
const title = localize('import profile preview', "Import");
247-
let importProfile = await this.selectProfileResources(
248-
userDataProfileImportState,
249-
localize('import title', "{0}: {1} ({2})", PROFILES_CATEGORY.value, title, profileTemplate.name),
250-
localize('import description', "Chose what to import")
251-
);
252247

253-
if (importProfile === undefined) {
254-
return;
255-
}
248+
if (!userDataProfileImportState.isEmpty()) {
249+
let importProfile = await this.selectProfileResources(
250+
userDataProfileImportState,
251+
localize('import title', "{0}: {1} ({2})", PROFILES_CATEGORY.value, title, profileTemplate.name),
252+
localize('import description', "Chose what to import")
253+
);
256254

257-
if (!importProfile) {
258-
importProfile = await this.showProfilePreviewView(`workbench.views.profiles.import.preview`, title, userDataProfileImportState);
259-
}
255+
if (importProfile === undefined) {
256+
return;
257+
}
260258

261-
if (!importProfile) {
262-
return;
259+
if (!importProfile) {
260+
importProfile = await this.showProfilePreviewView(`workbench.views.profiles.import.preview`, title, userDataProfileImportState);
261+
}
262+
263+
if (!importProfile) {
264+
return;
265+
}
263266
}
264267

265268
profileTemplate = await userDataProfileImportState.getProfileTemplateToImport();
@@ -942,6 +945,10 @@ class UserDataProfileImportState extends UserDataProfileImportExportState {
942945
return roots;
943946
}
944947

948+
isEmpty(): boolean {
949+
return !(this.profile.settings || this.profile.keybindings || this.profile.tasks || this.profile.snippets || this.profile.globalState || this.profile.extensions);
950+
}
951+
945952
async getProfileTemplateToImport(): Promise<IUserDataProfileTemplate> {
946953
return this.getProfileTemplate(this.profile.name, this.profile.shortName);
947954
}

0 commit comments

Comments
 (0)