Skip to content

Commit 254efed

Browse files
committed
feat(ext): support reverse linking, aka find usages
1 parent d60a550 commit 254efed

File tree

5 files changed

+13
-5
lines changed

5 files changed

+13
-5
lines changed

vscode-ext/lo.vsix

213 Bytes
Binary file not shown.

vscode-ext/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vscode-ext/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"author": "glebbash",
66
"publisher": "glebbash",
77
"license": "MIT",
8-
"version": "0.0.65",
8+
"version": "0.0.67",
99
"engines": {
1010
"vscode": "^1.88.0"
1111
},

vscode-ext/src/analysis.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,17 @@ export class FileAnalysisCollection
5151
position: vscode.Position,
5252
_token: vscode.CancellationToken
5353
): vscode.ProviderResult<vscode.LocationLink[] | vscode.Definition> {
54+
const outRefs = [];
55+
5456
const links =
5557
this.analysisPerUri.get(document.uri.toString(true))?.links ?? [];
5658
for (const ref of links) {
5759
if (ref.originSelectionRange!.contains(position)) {
58-
return [ref];
60+
outRefs.push(ref);
5961
}
6062
}
6163

62-
return null;
64+
return outRefs.length === 0 ? null : outRefs;
6365
}
6466

6567
showMessages() {

vscode-ext/src/extension.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ export async function activate(context: vscode.ExtensionContext) {
9696
targetUri: analysisPerIndex.get(targetIndex)!.uri,
9797
targetRange: targetRange,
9898
});
99+
100+
analysisPerIndex.get(targetIndex)!.links.push({
101+
originSelectionRange: targetRange,
102+
targetUri: fileDiagnostic.uri,
103+
targetRange: sourceRange,
104+
});
99105
}
100106

101107
if (d.hover) {

0 commit comments

Comments
 (0)