Skip to content

"Add Database Source to Workspace" does not preserve loaded database #4356

@Marcono1234

Description

@Marcono1234

Describe the bug
When using the "Add Database Source to Workspace" action and the current folder is re-opened as VS Code workspace, the opened database is not preserved; the list of databases is empty afterwards.

Version
Extension:

CodeQL extension version: 1.17.7 
CodeQL CLI version: 2.25.1 
Platform: win32 x64

VS Code:

Version: 1.113.0 (user setup)
Commit: cfbea10c5ffb233ea9177d34726e6056e89913dc
Date: 2026-03-24T15:07:18+01:00
Electron: 39.8.3
ElectronBuildId: 13620978
Chromium: 142.0.7444.265
Node.js: 22.22.1
V8: 14.2.231.22-electron.0
OS: Windows_NT x64 10.0.26200

To reproduce

  1. Open a regular folder in VS Code
  2. Load a CodeQL database (folder-based)
  3. Right-click the database and select "Add Database Source to Workspace"
    ℹ️ As expected: The VS Code window is reloaded as workspace
    ℹ️ As expected: The database source was added
    ❌ Bug: The CodeQL database added in step 2 is not listed anymore as database, you have to manually re-add it

Expected behavior
After using "Add Database Source to Workspace" the database is still loaded

Additional context
The current behavior can be quite confusing. For example, I wanted to browse the AST of a database source file, so I loaded the database, selected "Add Database Source to Workspace", opened the source file and tried to open CodeQL's AST viewer. But it failed, saying that it could not find the database for the source.
Only then I noticed that the list of databases was empty (as mentioned in the description above).

Metadata

Metadata

Assignees

No one assigned

    Labels

    VSCodebugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions