Today I Learned

Configure graphql syntax highlight in IntelliJ IDE's

To enable syntax highlight in graphql query/mutation definition in IntelliJ IDE’s follow few steps.

Initially gql query is displayed as regular string. Imgur

Step 1

In editor preferences > plugins > marketplace find JS GraphQL plugin Imgur

Step 2

Then you need to configure .graphqlconfig by selecting: new > GraphQL Configuration File in project root file Imgur schemaPath property should point to schema.graphql file in your project

Step 3

If you configure the application correctly you should see the schema discovered and “No errors found” Imgur

End result

Now you should see syntax highlight, suggestions and validation based on graphql schema. Imgur

Additional info

If you have problems with the setup checkout the plugin documentation