Skip to content

Commit f5845a7

Browse files
authored
fix: open workspaces in new windows (#52)
1 parent 4ab70e5 commit f5845a7

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/commands.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,12 @@ export class Commands {
158158
// when opening a workspace unless explicitly specified.
159159
const remoteAuthority = `ssh-remote+${Remote.Prefix}${workspaceOwner}--${workspaceName}`
160160

161+
let newWindow = true
162+
// Open in the existing window if no workspaces are open.
163+
if (!vscode.workspace.workspaceFolders?.length) {
164+
newWindow = false
165+
}
166+
161167
const output: {
162168
workspaces: { folderUri: vscode.Uri; remoteAuthority: string }[]
163169
} = await vscode.commands.executeCommand("_workbench.getRecentlyOpened")
@@ -192,11 +198,16 @@ export class Commands {
192198
authority: remoteAuthority,
193199
path: selected.folderUri.path,
194200
}),
201+
// Open this in a new window!
202+
newWindow,
195203
)
196204
return
197205
}
198206

199207
// This opens the workspace without an active folder opened.
200-
await vscode.commands.executeCommand("vscode.newWindow", { remoteAuthority: remoteAuthority, reuseWindow: true })
208+
await vscode.commands.executeCommand("vscode.newWindow", {
209+
remoteAuthority: remoteAuthority,
210+
reuseWindow: !newWindow,
211+
})
201212
}
202213
}

0 commit comments

Comments
 (0)