github / vscode-codeql

An extension for Visual Studio Code that adds rich language support for CodeQL

Home Page:https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-codeql

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Creating skeleton query pack shows spurious CodeQL compilation errors

Marcono1234 opened this issue · comments

Describe the bug
When creating a skeleton query pack using the extension it creates an example query (example.ql) and opens it automatically.
However, it directly reports compilation errors there about unresolved modules. These errors seem to be spurious though, compiling the query works fine.

This is quite problematic because creating the example query is probably the first thing new users do, and it can be quite confusing if they directly run into (spurious) errors then.

Whether this error occurs seems to depend on the state of %userprofile%/.codeql (on Windows; possibly similar on Linux).

Version

CodeQL extension version: 1.11.0 
CodeQL CLI version: 2.15.5 
Platform: win32 x64

VS Code:

Version: 1.85.1 (user setup)
Commit: 0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2
Date: 2023-12-13T09:49:37.021Z
Electron: 25.9.7
ElectronBuildId: 25551756
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Windows_NT x64 10.0.19045

To reproduce

  1. Close VS Code
  2. Delete %userprofile%/.codeql (on Windows)
    (to be safe verify first that it does not contain anything valuable)
  3. Open an empty folder with VS Code
  4. In the CodeQL tab under "Queries" click "Create one to get started", or alternatively run the command "> CodeQL: Create Query"
  5. Select "Java" as language
  6. Wait until the extension automatically opens the example.ql file
    ❌ Bug: The extension shows multiple compilation errors
    Compilation errors screenshot
  7. Try to run the query
    ✔️ Compilation succeeds, as expected

Expected behavior
The extension should not show spurious compilation errors

Additional context
Besides that I really like this functionality of creating a skeleton pack; this seems to make it really easy to get started (though I had been using the extension before, so maybe a real new user might experience this differently).

Thanks for the issue and the reproduction steps, @Marcono1234! I've raised this internally too, so we'll take a look and get back to you ✨

Thanks! It seems a similar error also occurs for the "CodeQL: Install Pack Dependencies" command; after performing the command the extension still shows spurious "Could not resolve module" compilation errors. Maybe that is the same underlying issue?