Skip to content

Commit 14d8593

Browse files
committed
Use getOnDiskWorkspaceFolders to fetch folders
1 parent b83d54f commit 14d8593

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

extensions/ql-vscode/src/helpers.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -799,14 +799,13 @@ export async function* walkDirectory(
799799
*/
800800

801801
export function getFirstWorkspaceFolder() {
802-
const workspaceFolders = workspace.workspaceFolders;
802+
const workspaceFolders = getOnDiskWorkspaceFolders();
803803

804804
if (!workspaceFolders || workspaceFolders.length === 0) {
805805
throw new Error("No workspace folders found");
806806
}
807807

808-
const firstFolder = workspaceFolders[0];
809-
const firstFolderFsPath = firstFolder.uri.fsPath;
808+
const firstFolderFsPath = workspaceFolders[0];
810809

811810
// For the vscode-codeql-starter repo, the first folder will be a ql pack
812811
// so we need to get the parent folder

extensions/ql-vscode/test/vscode-tests/cli-integration/skeleton-query-wizard.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ describe("SkeletonQueryWizard", () => {
8383
jest.spyOn(workspace, "workspaceFolders", "get").mockReturnValue([
8484
{
8585
name: `codespaces-codeql`,
86-
uri: { fsPath: storagePath },
86+
uri: { fsPath: storagePath, scheme: "file" },
8787
},
8888
{
8989
name: "/second/folder/path",
90-
uri: { fsPath: storagePath },
90+
uri: { fsPath: storagePath, scheme: "file" },
9191
},
9292
] as WorkspaceFolder[]);
9393

0 commit comments

Comments
 (0)