vscode-graphql icon indicating copy to clipboard operation
vscode-graphql copied to clipboard

Support #import declarations

Open stephen opened this issue 7 years ago • 3 comments

Support fragment importing strategies when checking validity of queries, i.e. for argument usage.

screen shot 2018-01-17 at 11 31 51 am

stephen avatar Jan 13 '18 04:01 stephen

Note that the go-to-def will (in)correctly resolve graphql fragments that are not #imported explicitly.

stephen avatar Jan 17 '18 19:01 stephen

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

lostplan avatar Jan 24 '18 14:01 lostplan

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.

stephen avatar Jan 24 '18 17:01 stephen