@@ -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