Skip to content

Add new command: 'Go to File in Selected Database'#4390

Open
hvitved wants to merge 2 commits intogithub:mainfrom
hvitved:go-to-file-selected-db
Open

Add new command: 'Go to File in Selected Database'#4390
hvitved wants to merge 2 commits intogithub:mainfrom
hvitved:go-to-file-selected-db

Conversation

@hvitved
Copy link
Copy Markdown
Contributor

@hvitved hvitved commented May 8, 2026

@asgerf recently introduced selection-based result filtering, which is a really great feature. However, getting to file in the source archive where you want to do the filtering currently requires running some query and then being able to interpret the result of that query to match the file where filtering is intended.

This PR adds a new command CodeQL: Go to File in Selected Database, which works like VS Code's built-in Go to File, except it does so on the source archive of the selected database.

Copilot AI review requested due to automatic review settings May 8, 2026 07:50
@hvitved hvitved requested review from a team as code owners May 8, 2026 07:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new VS Code command to quickly open a file from the source archive of the currently selected CodeQL database, enabling easier selection-based result filtering workflows.

Changes:

  • Introduces searchSourceArchiveFiles to traverse the selected database’s source archive and present files via a Quick Pick.
  • Registers a new codeQL.goToFile command and wires it into the local databases UI command set.
  • Exposes the command in package.json so it appears in the Command Palette.
Show a summary per file
File Description
extensions/ql-vscode/src/databases/source-archive-file-search.ts New Quick Pick–based file search/open implementation for source archives.
extensions/ql-vscode/src/databases/local-databases-ui.ts Adds a new command handler to launch the source-archive file search for the current DB.
extensions/ql-vscode/src/common/commands.ts Extends LocalDatabasesCommands type with the new command.
extensions/ql-vscode/package.json Contributes the new command (and makes it visible in the Command Palette).

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 4/4 changed files
  • Comments generated: 4

Comment on lines +67 to +75
const quickPick = window.createQuickPick<SourceArchiveFileQuickPickItem>();
quickPick.placeholder = "Go to File in Selected Database...";
quickPick.matchOnDescription = true;
quickPick.busy = true;
quickPick.show();

try {
const items = await collectFiles(explorerUri, sourceArchiveZipPath, "");
// Sort items by file name, then by path
Comment on lines +97 to +101
if (selected) {
const doc = await workspace.openTextDocument(selected.uri);
await window.showTextDocument(doc);
}
resolve();
Comment on lines +24 to +30
for (const [name, type] of entries) {
const childPath = prefix ? `${prefix}/${name}` : name;
const childUri = encodeSourceArchiveUri({
sourceArchiveZipPath,
pathWithinSourceArchive: `${decodeSourceArchiveUri(dirUri).pathWithinSourceArchive}/${name}`,
});

Comment thread extensions/ql-vscode/src/databases/local-databases-ui.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants