Use getOnDiskWorkspaceFolders to fetch folders

This commit is contained in:
Elena Tanasoiu
2023-04-13 14:44:06 +00:00
parent b83d54f285
commit 14d8593d58
2 changed files with 4 additions and 5 deletions

View File

@@ -799,14 +799,13 @@ export async function* walkDirectory(
*/
export function getFirstWorkspaceFolder() {
const workspaceFolders = workspace.workspaceFolders;
const workspaceFolders = getOnDiskWorkspaceFolders();
if (!workspaceFolders || workspaceFolders.length === 0) {
throw new Error("No workspace folders found");
}
const firstFolder = workspaceFolders[0];
const firstFolderFsPath = firstFolder.uri.fsPath;
const firstFolderFsPath = workspaceFolders[0];
// For the vscode-codeql-starter repo, the first folder will be a ql pack
// so we need to get the parent folder

View File

@@ -83,11 +83,11 @@ describe("SkeletonQueryWizard", () => {
jest.spyOn(workspace, "workspaceFolders", "get").mockReturnValue([
{
name: `codespaces-codeql`,
uri: { fsPath: storagePath },
uri: { fsPath: storagePath, scheme: "file" },
},
{
name: "/second/folder/path",
uri: { fsPath: storagePath },
uri: { fsPath: storagePath, scheme: "file" },
},
] as WorkspaceFolder[]);