Add new command: 'Go to File in Selected Database'#4390
Open
hvitved wants to merge 2 commits intogithub:mainfrom
Open
Add new command: 'Go to File in Selected Database'#4390hvitved wants to merge 2 commits intogithub:mainfrom
hvitved wants to merge 2 commits intogithub:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
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
searchSourceArchiveFilesto traverse the selected database’s source archive and present files via a Quick Pick. - Registers a new
codeQL.goToFilecommand and wires it into the local databases UI command set. - Exposes the command in
package.jsonso 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}`, | ||
| }); | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@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-inGo to File, except it does so on the source archive of the selected database.