Skip to content

Commit 3f5437a

Browse files
authored
1 parent 24828a9 commit 3f5437a

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

Diff for: src/vs/platform/windows/electron-main/windowImpl.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,10 @@ export class CodeWindow extends Disposable implements ICodeWindow {
128128

129129
get openedWorkspace(): IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | undefined { return this._config?.workspace; }
130130

131-
get profile(): IUserDataProfile | undefined { return this.config ? this.userDataProfilesService.getOrSetProfileForWorkspace(this.config.workspace ?? 'empty-window', this.userDataProfilesService.profiles.find(profile => profile.id === this.config?.profiles.profile.id) ?? this.userDataProfilesService.defaultProfile) : undefined; }
131+
get profile(): IUserDataProfile | undefined {
132+
return this.config ? this.userDataProfilesService.profiles.find(profile => profile.id === this.config?.profiles.profile.id) ??
133+
this.userDataProfilesService.getOrSetProfileForWorkspace(this.config.workspace ?? 'empty-window', this.userDataProfilesService.defaultProfile) : undefined;
134+
}
132135

133136
get remoteAuthority(): string | undefined { return this._config?.remoteAuthority; }
134137

Diff for: src/vs/platform/windows/electron-main/windowsMainService.ts

+12-10
Original file line numberDiff line numberDiff line change
@@ -1317,6 +1317,14 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
13171317
private async openInBrowserWindow(options: IOpenBrowserWindowOptions): Promise<ICodeWindow> {
13181318
const windowConfig = this.configurationService.getValue<IWindowSettings | undefined>('window');
13191319

1320+
let window: ICodeWindow | undefined;
1321+
if (!options.forceNewWindow && !options.forceNewTabbedWindow) {
1322+
window = options.windowToUse || this.getLastActiveWindow();
1323+
if (window) {
1324+
window.focus();
1325+
}
1326+
}
1327+
13201328
// Build up the window configuration from provided options, config and environment
13211329
const configuration: INativeWindowConfiguration = {
13221330

@@ -1342,7 +1350,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
13421350

13431351
profiles: {
13441352
all: this.userDataProfilesMainService.profiles,
1345-
profile: await this.resolveProfileForBrowserWindow(options)
1353+
profile: window?.isExtensionDevelopmentHost && window?.profile ? window.profile : await this.resolveProfileForBrowserWindow(options)
13461354
},
13471355

13481356
homeDir: this.environmentMainService.userHome.fsPath,
@@ -1375,14 +1383,6 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
13751383
continueOn: this.environmentMainService.continueOn,
13761384
};
13771385

1378-
let window: ICodeWindow | undefined;
1379-
if (!options.forceNewWindow && !options.forceNewTabbedWindow) {
1380-
window = options.windowToUse || this.getLastActiveWindow();
1381-
if (window) {
1382-
window.focus();
1383-
}
1384-
}
1385-
13861386
// New window
13871387
if (!window) {
13881388
const state = this.windowsStateHandler.getNewWindowState(configuration);
@@ -1512,7 +1512,9 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
15121512
}
15131513
}
15141514
if (profile) {
1515-
this.userDataProfilesMainService.setProfileForWorkspaceSync(options.workspace ?? 'empty-window', profile);
1515+
if (!options.cli?.extensionDevelopmentPath) {
1516+
this.userDataProfilesMainService.setProfileForWorkspaceSync(options.workspace ?? 'empty-window', profile);
1517+
}
15161518
} else {
15171519
profile = this.userDataProfilesMainService.getOrSetProfileForWorkspace(options.workspace ?? 'empty-window', (options.windowToUse ?? this.getLastActiveWindow())?.profile ?? this.userDataProfilesMainService.defaultProfile);
15181520
}

0 commit comments

Comments
 (0)