-
Notifications
You must be signed in to change notification settings - Fork 469
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
language-server: Don't break on bad arguments #1523
base: master
Are you sure you want to change the base?
language-server: Don't break on bad arguments #1523
Conversation
When dealing with directives without arguments specified, such as when using Relay - the argument from typeinfo can be null/undefined. This change simply avoids throwing errors when hovering these arguments - and instead provides no help on hover. I couldn't find any tests for the language server regarding these parts, but I tried my best testing it in a local project.
@kastermester: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Meteor Contributor Agreement here: https://contribute.meteor.com/ |
I'm not quite sure why the tests are breaking - as far as I can see my PR did not change anything related to these failures. |
Hey @kastermester! Thanks for the PR :) Can you drop me a link to a repo where I can reproduce and test these changes? Or at least a snippet of a schema/operation combo that I can use? |
I will try to find time to put up a repo with a reproduce. But in short it happens when using this package: https://github.com/relay-tools/vscode-apollo-relay Because it tries to teach the apollo tooling some Relay-isms, when hovering over arguments for directives that do not have documentation/types associated with them, this happens. In Relay this happens when hovering over arguments to ie. |
So ie. create a directive like this: directive @arguments on FRAGMENT_SPREAD And apply it to a fragment spread adding arguments to it. |
Hi @kastermester , thanks for pointing this out! This seems like something that should generally be done based on the null-handling in the other cases, rather than something specific to Relay's provider, unless I'm misinterpreting? |
Precisely. All null values should ideally be handled. I’m not entirely sure which other situations there are though. |
@kastermester this change seems pretty safe to me; seems to be porting a pattern that's elsewhere to a code path that seems to have missed it, which can cause a poor VS Code experience. Seems like the CHANGELOG is out of date, but that's a quick fix-up. @JakeDawkins, do you have any qualms against merging this? |
When dealing with directives without arguments specified,
such as when using Relay - the argument from typeinfo can be
null/undefined.
This change simply avoids throwing errors when hovering these
arguments - and instead provides no help on hover.
I couldn't find any tests for the language server regarding these
parts, but I tried my best testing it in a local project.
TODO: