Description
Describe the bug
I've got a workspace open with a clone of github.com/codeql cpp\ql\src
open as folder, and a DB loaded from archive. I'm writing some test queries in the root of that folder, and running them. Works OK.
However, when using View AST
while browsing to a file from the archive, which was added to my workspace by right clicking on the db, it errors out. The file is definitely inside the archive, it was opened via clicking a .getLocation() result, but there is no difference if it's opened from the file explorer tree view.
This error is below. Note that the DB as built does not contain a qlpack.yml, and the vscode-codeql finds cpp\ql\src\qlpack.yml
from the official repo just fine - verified it reads the file in procmon both when run query & view ast occur.
Error: Could not find qlpack file for dbscheme c:/Users/a/AppData/Roaming/Code/User/workspaceStorage/9a13bc4239c686fd988f4b27b7bc608d/GitHub.vscode-codeql/mybuild-codeql-db/mybuild-codeql-db/db-cpp/semmlecode.cpp.dbscheme
at findDbschemePack (c:\Users\a\.vscode\extensions\github.vscode-codeql-1.7.4\out\helpers.js:248:11)
at Object.getQlPackForDbscheme (c:\Users\a\.vscode\extensions\github.vscode-codeql-1.7.4\out\helpers.js:277:26)
at qlpackOfDatabase (c:\Users\a\.vscode\extensions\github.vscode-codeql-1.7.4\out\contextual\queryResolver.js:15:12)
at TemplatePrintAstProvider.getAst (c:\Users\a\.vscode\extensions\github.vscode-codeql-1.7.4\out\contextual\templateProvider.js:109:25)
at CachedOperation.get (c:\Users\a\.vscode\extensions\github.vscode-codeql-1.7.4\out\helpers.js:330:28)
at TemplatePrintAstProvider.provideAst (c:\Users\a\.vscode\extensions\github.vscode-codeql-1.7.4\out\contextual\templateProvider.js:91:15)
at ctx.subscriptions.push.cancellable (c:\Users\a\.vscode\extensions\github.vscode-codeql-1.7.4\out\extension.js:712:21)
Version
The CodeQL and VS Code version in which the bug occurs.
CodeQL CLI (version 2.11.2)
VSCode 1.69.2
To reproduce
- Build a CPP DB using the codeql cli
- Open-as-folder the
cpp\ql\src
folder of the official repo to write new queries into. - Open a file from the DB, then click view AST.
- Receive error
Expected behavior
View AST works when Run Query works
I suspect this might be due to my workspace setup... but I'm not sure what the intended way to work is when you want all queries from the official repo, as well as supplementing it with your own queries. Maybe I missed a doc describing the precise workspace/open-folders setup needed?