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

Provide built-in type definitions for Apollo framework #490

Open raarts opened 3 years ago

raarts commented 3 years ago

Describe the bug Getting the above error, which was unexpected since the Release Notes state: Fixed displaying Apollo @client fields as errors.

To Reproduce https://github.com:raarts/graphql-plugin-error (See DarkMode.tsx)

Expected behavior No error.

Version and Environment Details Operation system: MacOS 11.5.2 Big Sur IDE name and version: WebStorm 2021.2.1 Build #WS-212.5080.54 Plugin version: 3.0.0 (fresh install)

Additional context Only using local fields so far.

vepanimas commented 3 years ago

Hi! You can define a client directive somewhere in the .graphql file in your project (or in the schema file specified in your .graphqlconfig) like directive @client on FIELD and it will work. We don't provide directives for frameworks except for Relay and built-in ones yet, framework detection and providing type definitions are in the roadmap.

If we talk about what is written in the release notes, it was meant that the presence of such a directive prevents marking a corresponding field as unresolved (before / after on the screenshot).

apollo-client-fields

This is how it looks when a directive is defined:

apollo-client-ok
raarts commented 3 years ago

Works. Thanks!

vepanimas commented 3 years ago

Great! I'll reopen it to track any further progress on that.