Skip to content

Commit 8710b55

Browse files
author
ty-d
committed
Use the language server symbol provider
1 parent d22abf4 commit 8710b55

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/providers/DocumentLinkProvider.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as vscode from "vscode";
22
import { DocumentContentProvider } from "./DocumentContentProvider";
3-
import { ObjectScriptClassSymbolProvider } from "./ObjectScriptClassSymbolProvider";
43

54
interface StudioLink {
65
uri: vscode.Uri;
@@ -58,14 +57,11 @@ export class DocumentLinkProvider implements vscode.DocumentLinkProvider {
5857

5958
// add the offset of the method if it is a class
6059
if (link.methodname) {
61-
console.log("running class code");
62-
const symbols = await new ObjectScriptClassSymbolProvider().provideDocumentSymbols(editor.document, token);
63-
const methods = symbols[0].children;
64-
const matchingMethod = methods.find(
65-
(method) => (method.detail === "ClassMethod" || method.detail === "Method ") && method.name === link.methodname
60+
const symbols = await vscode.commands.executeCommand("vscode.executeDocumentSymbolProvider", link.uri);
61+
const method = symbols[0].children.find(
62+
(info) => (info.detail === "ClassMethod" || info.detail === "Method") && info.name === link.methodname
6663
);
67-
const methodLine = matchingMethod.range.start.line;
68-
offset += methodLine + 1;
64+
offset += method.location.range.start.line + 1;
6965
}
7066

7167
// move the cursor

0 commit comments

Comments
 (0)