-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Enable goto def in LSP to goto the actual schema definition #4434
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!! Thank you for working on this.
@bigfootjon has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@bigfootjon merged this pull request in 3b96b01. |
With v2.1.0 of the VSCode extension now published (thanks @alex-statsig ), I have an example repo showing this feature working with Grats: captbaritone/grats-relay-example@64a5ed4 It's a bit of a bummer that I need a separate script. I wonder if it would be nicer to allow the config option to be a bash command, rathe than just a path to an executable. But in that world, it's a bit unclear how the project and entity name get passed (if it were just one thing stdin would be fine) Maybe you could pass the LSP an option like: relay lsp --locateCommand="pnpm run grats locate %entity" Or something? |
Another thought on this - it would be great to have a separate "locateCommand" setting for "Go to implementations" I used this setting to allow easier navigation to our backend resolvers (which is amazing), but now theres no easy way to get to the schema (currently manually defined, ideally will be code-first eventually). Perhaps another way to support that would be to allow returning two locations, or more conveniently an option to still include the schema.graphql definition that relay finds rather than replacing it. |
I basically just took @captbaritone 's POC and made it configurable based on our conversation on Threads
This should be reasonably generalized to support different use-cases, but I'm open to rewriting all of this.
Test plan:
In a private project, I configured the new option and overrode the relay binary location:
I manually installed the
relay-2.1.0.vsix
file in my VSCode and reloadedI opened a file with a Relay GraphQL query in it and ctrl-clicked (goto def on my machine) and it went to the correct file!