vscode-graphql
vscode-graphql copied to clipboard
Support #import declarations
Support fragment importing strategies when checking validity of queries, i.e. for argument usage.
Note that the go-to-def will (in)correctly resolve graphql fragments that are not #imported explicitly.
Out of interest, which tool are you using to support #import syntax?
While there is no official import syntax it would be useful if alternate definition resolutions were configurable (in .graphqlconfig?). Wouldn't want to break existing uses (e.g. right now I'm using the Bucket o' Fragments™ approach without explicit imports, roughly similar to how facebook does it).
Hopefully one day there will be enough appetite to settle on an official import pattern... https://github.com/facebook/graphql/issues/343
We use a webpack loader (https://github.com/stephen/graphql-loader#import-statements-in-graphql-files) that uses these comments to import fragments.
I don't have a strong opinion about whether or not this is a good idea yet, but it was a simple way to add support for queries in a different .graphql file.