Skip to content

Commit

Permalink
Make extension respect the window.openFoldersInNewWindow setting. Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
aeschli committed Nov 30, 2019
1 parent 8839651 commit 3295e51
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
Expand Up @@ -99,6 +99,7 @@ export class ElectronMainService implements IElectronMainService {
cli: this.environmentService.args,
forceNewWindow: options.forceNewWindow,
forceReuseWindow: options.forceReuseWindow,
preferNewWindow: options.preferNewWindow,
diffMode: options.diffMode,
addMode: options.addMode,
gotoLineMode: options.gotoLineMode,
Expand Down
1 change: 1 addition & 0 deletions src/vs/platform/windows/common/windows.ts
Expand Up @@ -25,6 +25,7 @@ export interface IBaseOpenWindowsOptions {

export interface IOpenWindowOptions extends IBaseOpenWindowsOptions {
forceNewWindow?: boolean;
preferNewWindow?: boolean;

noRecentEntry?: boolean;
}
Expand Down
9 changes: 2 additions & 7 deletions src/vs/workbench/api/node/extHostCLIServer.ts
Expand Up @@ -101,9 +101,6 @@ export class CLIServer {
for (const s of folderURIs) {
try {
urisToOpen.push({ folderUri: URI.parse(s) });
if (!addMode && !forceReuseWindow) {
forceNewWindow = true;
}
} catch (e) {
// ignore
}
Expand All @@ -114,9 +111,6 @@ export class CLIServer {
try {
if (hasWorkspaceFileExtension(s)) {
urisToOpen.push({ workspaceUri: URI.parse(s) });
if (!forceReuseWindow) {
forceNewWindow = true;
}
} else {
urisToOpen.push({ fileUri: URI.parse(s) });
}
Expand All @@ -127,7 +121,8 @@ export class CLIServer {
}
if (urisToOpen.length) {
const waitMarkerFileURI = waitMarkerFilePath ? URI.file(waitMarkerFilePath) : undefined;
const windowOpenArgs: INativeOpenWindowOptions = { forceNewWindow, diffMode, addMode, gotoLineMode, forceReuseWindow, waitMarkerFileURI };
const preferNewWindow = !forceReuseWindow && !waitMarkerFileURI && !addMode;
const windowOpenArgs: INativeOpenWindowOptions = { forceNewWindow, diffMode, addMode, gotoLineMode, forceReuseWindow, preferNewWindow, waitMarkerFileURI };
this._commands.executeCommand('_files.windowOpen', urisToOpen, windowOpenArgs);
}
res.writeHead(200);
Expand Down
Expand Up @@ -146,7 +146,7 @@ export class BrowserHostService extends Disposable implements IHostService {
const windowConfig = this.configurationService.getValue<IWindowSettings>('window');
const openFolderInNewWindowConfig = windowConfig?.openFoldersInNewWindow || 'default' /* default */;

let openFolderInNewWindow = !!options.forceNewWindow && !options.forceReuseWindow;
let openFolderInNewWindow = (options.preferNewWindow || !!options.forceNewWindow) && !options.forceReuseWindow;
if (!options.forceNewWindow && !options.forceReuseWindow && (openFolderInNewWindowConfig === 'on' || openFolderInNewWindowConfig === 'off')) {
openFolderInNewWindow = (openFolderInNewWindowConfig === 'on');
}
Expand Down

0 comments on commit 3295e51

Please sign in to comment.