diff --git a/src/commands.ts b/src/commands.ts index 0b82d558..3d29fd0f 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -158,6 +158,12 @@ export class Commands { // when opening a workspace unless explicitly specified. const remoteAuthority = `ssh-remote+${Remote.Prefix}${workspaceOwner}--${workspaceName}` + let newWindow = true + // Open in the existing window if no workspaces are open. + if (!vscode.workspace.workspaceFolders?.length) { + newWindow = false + } + const output: { workspaces: { folderUri: vscode.Uri; remoteAuthority: string }[] } = await vscode.commands.executeCommand("_workbench.getRecentlyOpened") @@ -192,11 +198,16 @@ export class Commands { authority: remoteAuthority, path: selected.folderUri.path, }), + // Open this in a new window! + newWindow, ) return } // This opens the workspace without an active folder opened. - await vscode.commands.executeCommand("vscode.newWindow", { remoteAuthority: remoteAuthority, reuseWindow: true }) + await vscode.commands.executeCommand("vscode.newWindow", { + remoteAuthority: remoteAuthority, + reuseWindow: !newWindow, + }) } }