Skip to content

Commit 7beced7

Browse files
committed
Fix filtering out / in recently opened list
1 parent 89d4f73 commit 7beced7

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/commands.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -157,22 +157,22 @@ export class Commands {
157157
const output: {
158158
workspaces: { folderUri: vscode.Uri; remoteAuthority: string }[]
159159
} = await vscode.commands.executeCommand("_workbench.getRecentlyOpened")
160-
const opened = output.workspaces.filter((opened) => opened.folderUri?.authority === uri.authority)
160+
const opened = output.workspaces.filter(
161+
// Filter out `/` since that's added below.
162+
(opened) => opened.folderUri?.authority === uri.authority && uri.path !== "/",
163+
)
161164
// Always add `/` as an option to open. If we don't, it can become hard
162165
// to open multiple VS Code windows.
163166
opened.splice(0, 0, {
164167
folderUri: uri,
165168
remoteAuthority: "coder",
166169
})
167170
if (opened.length > 1) {
168-
const items: vscode.QuickPickItem[] = opened
169-
// Filter out `/` since that's added above.
170-
.filter((folder) => folder.folderUri.path !== "/")
171-
.map((folder): vscode.QuickPickItem => {
172-
return {
173-
label: folder.folderUri.fsPath,
174-
}
175-
})
171+
const items: vscode.QuickPickItem[] = opened.map((folder): vscode.QuickPickItem => {
172+
return {
173+
label: folder.folderUri.fsPath,
174+
}
175+
})
176176
const item = await vscode.window.showQuickPick(items, {
177177
title: "Select a recently opened folder",
178178
})

0 commit comments

Comments
 (0)