8000 Adjust usage by JoviDeCroock · Pull Request #368 · 0no-co/GraphQLSP · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Adjust usage #368

8000
New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 29, 2025
Merged

Adjust usage #368

merged 2 commits into from
Jun 29, 2025

Conversation

JoviDeCroock
Copy link
Member

No description provided.

Copy link
changeset-bot bot commented Jun 27, 2025

⚠️ No Changeset found

Latest commit: a79208c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR


const parent = node.parent;
const parent = declaration;
if (ts.isVariableDeclaration(parent)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm not mistaken, this is now redundant with getValueOfValueDeclaration. Unless we have extra logic for the discovered node (which shouldn't be called parent any longer but just declaration / valueDeclaration here, we can just use getValueOfValueDeclaration and do further operations separately, basically on:

  • valueDeclarationNode
  • valueNode

As long as tests pass, we can adjust this manually in a future PR
This change will cover more edge cases though once adjusted as per the above


const def = definitions && definitions[0];
if (!def) return;
const typeChecker = info.languageService.getProgram()?.getTypeChecker();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awkwardly repeated now across the codebase. We can manually refactor our helper functions to just accept the typeChecker directly now afaict

Comment on lines +62 to +65
if (!checker) return null;

const definitions = info.languageService.getDefinitionAtPosition(
element.getSourceFile().fileName,
element.getStart()
);
const value = getValueOfIdentifier(input, checker);
if (!value) return null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: redundant null conversions, which can be avoided if we adjust signatures here

identifier = typeQuery.exprName;
} else if (ts.isQualifiedName(typeQuery.exprName)) {
// For qualified names like 'module.identifier', get the right-most identifier
identifier = typeQuery.exprName.right;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This seems a bit suspect. I don't remember fully what the intention here is, but I assume it's type casts? We may not be covering all edge cases here, if we do, this qualifies for making a helper and adding some comments

@JoviDeCroock JoviDeCroock merged commit ccea0b7 into refactor/pure-goto-definition Jun 29, 2025
1 check passed
@JoviDeCroock JoviDeCroock deleted the add-usage branch June 29, 2025 13:25
JoviDeCroock added a commit that referenced this pull request Jun 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0