Skip to content

Commit 1b9da61

Browse files
authored
1 parent 7ed4cdc commit 1b9da61

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements
139139
this._register(this.registerSwitchProfileAction());
140140

141141
this.registerOpenProfileSubMenu();
142+
this.registerNewWindowWithProfileAction();
142143
this.registerProfilesActions();
143144
this._register(this.userDataProfilesService.onDidChangeProfiles(() => this.registerProfilesActions()));
144145

@@ -235,6 +236,39 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements
235236
});
236237
}
237238

239+
private registerNewWindowWithProfileAction(): IDisposable {
240+
return registerAction2(class NewWindowWithProfileAction extends Action2 {
241+
constructor() {
242+
super({
243+
id: `workbench.profiles.actions.newWindowWithProfile`,
244+
title: localize2('newWindowWithProfile', "New Window with Profile..."),
245+
category: PROFILES_CATEGORY,
246+
precondition: HAS_PROFILES_CONTEXT,
247+
f1: true,
248+
});
249+
}
250+
async run(accessor: ServicesAccessor) {
251+
const quickInputService = accessor.get(IQuickInputService);
252+
const userDataProfilesService = accessor.get(IUserDataProfilesService);
253+
const hostService = accessor.get(IHostService);
254+
255+
const pick = await quickInputService.pick(
256+
userDataProfilesService.profiles.map(profile => ({
257+
label: profile.name,
258+
profile
259+
})),
260+
{
261+
title: localize('new window with profile', "New Window with Profile"),
262+
placeHolder: localize('pick profile', "Select Profile"),
263+
canPickMany: false
264+
});
265+
if (pick) {
266+
return hostService.openWindow({ remoteAuthority: null, forceProfile: pick.profile.name });
267+
}
268+
}
269+
});
270+
}
271+
238272
private registerNewWindowAction(profile: IUserDataProfile): IDisposable {
239273
const disposables = new DisposableStore();
240274

0 commit comments

Comments
 (0)