Skip to content

Commit 848869e

Browse files
mgsiumshati-patel
authored andcommitted
Make "Open Referenced File" command functional on open .qlref
1 parent 31dc11e commit 848869e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

extensions/ql-vscode/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- Fix a bug with importing large databases. Databases over 4GB can now be imported directly from LGTM or from a zip file. This functionality is only available when using CodeQL CLI version 2.6.0 or later. [#971](https://github.com/github/vscode-codeql/pull/971)
88
- Replace certain control codes (`U+0000` - `U+001F`) with their corresponding control labels (`U+2400` - `U+241F`) in the results view. [#963](https://github.com/github/vscode-codeql/pull/963)
99
- Allow case-insensitive project slugs for GitHub repositories when adding a CodeQL database from LGTM. [#978](https://github.com/github/vscode-codeql/pull/961)
10+
- Make "Open Referenced File" command accessible from the active editor menu. [#989](https://github.com/github/vscode-codeql/pull/989)
1011

1112
## 1.5.6 - 07 October 2021
1213

extensions/ql-vscode/src/extension.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,9 +496,11 @@ async function activateWithInstalledDistribution(
496496
async function openReferencedFile(
497497
selectedQuery: Uri
498498
): Promise<void> {
499-
if (qs !== undefined) {
499+
// If no file is selected, the path of the file in the editor is selected
500+
const path = selectedQuery?.fsPath || window.activeTextEditor?.document.uri.fsPath;
501+
if (qs !== undefined && path) {
500502
if (await cliServer.cliConstraints.supportsResolveQlref()) {
501-
const resolved = await cliServer.resolveQlref(selectedQuery.fsPath);
503+
const resolved = await cliServer.resolveQlref(path);
502504
const uri = Uri.file(resolved.resolvedPath);
503505
await window.showTextDocument(uri, { preview: false });
504506
} else {

0 commit comments

Comments
 (0)