JetBrains / js-graphql-intellij-plugin

GraphQL language support for WebStorm, IntelliJ IDEA and other IDEs based on the IntelliJ Platform.
https://jimkyndemeyer.github.io/js-graphql-intellij-plugin/
MIT License
879 stars 97 forks source link

Find variable usages in the referenced fragments #552

Open dwesty17 opened 2 years ago

dwesty17 commented 2 years ago

Describe the bug

When a fragment isn't colocated with the query that uses it any variables used by the query are reported as unused in the parent query.

To Reproduce See screenshots below.

Expected behavior Error shouldn't be reported as variable is being used by fragment.

Screenshots

Screen Shot 2021-12-08 at 11 06 13 PM Screen Shot 2021-12-08 at 11 06 25 PM

Version and Environment Details Operation system: MacOS Monterey IDE name and version: PhpStorm 2021.2.3 Plugin version: 3.0.0

yura3d commented 2 years ago

The same issue is for queries inside JS/TS files:

image

The fragment is exported from separate file:

image

I don't know is it difficult to deal with language-specific imports/exports, but some other tools like graphql-code-generator respects this syntax.