Skip to content

Commit 151e4cb

Browse files
committed
Make "Open Referenced File" command functional on open .qlref
1 parent b3a51d7 commit 151e4cb

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

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?.path || window.activeTextEditor?.document.uri.fsPath;
501+
if (qs !== undefined && path) {
500502
if (await cliServer.cliConstraints.supportsResolveQlref()) {
501-
const resolved = await cliServer.resolveQlref(selectedQuery.path);
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)