Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix TS Plugin: show hover in wrapped functions #104

Merged
merged 2 commits into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions packages/typescript-plugin/src/astHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ export function getNodeIdentifier(
typechecker: TypeChecker,
ts: Tsserver,
): string {
if (nodeType === "method" && ts.isIdentifier(node)) {
return node.escapedText.toString();
}

if (nodeType === "function") {
const declaration = typechecker.getSymbolAtLocation(node).valueDeclaration;

Expand All @@ -114,11 +110,10 @@ export function getNodeIdentifier(
) {
return declaration.initializer.arguments[0].escapedText.toString();
}

// otherwise just return the identifier user is currently hovering over
if (ts.isIdentifier(node)) {
return node.escapedText.toString();
}
}
// otherwise just return the identifier user is currently hovering over
if (ts.isIdentifier(node)) {
return node.escapedText.toString();
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/typescript-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ function init(modules: { typescript: Tsserver }) {
ts,
);

// If either autometrics checker or node type is undefined return early
if (!(autometrics && nodeType)) {
// If either autometrics checker return early
if (!autometrics) {
return prior;
}

Expand Down