0

I installed this GraphQL: Language Feature Support extension in VS Code, it's seems to be functioning, but it's missing some stuff, in the schema, it's not highlighting the errors, and it's shows the the autocomplete only when the schema is fully valid, otherwise, nothing will work.

For the documents, the errors and autocomplete works fine as long as the schema is valid.

How can I validate and autocomplete the schema?

1
  • Do you have problems with the schema definition file itself or with the query documents or both? Commented Oct 2 at 16:47

1 Answer 1

0

You have two options:

1. Point the extension to a working schema (preferred)

Create a .graphqlrc.yml (or .graphqlrc.json) in the root of your project and tell it how to load the schema, e.g.:

schema: "schema.graphql"
documents: "src/**/*.graphql"

Or if you’re using introspection:

schema:
  - "http://localhost:4000/graphql"
documents: "src/**/*.graphql"

2. Use graphql-config + graphql-language-service

The extension expects a project with graphql-config.

npm install --save-dev graphql graphql-config

Then add a config (example for SDL file):

{
  "schema": "./schema.graphql",
  "documents": "src/**/*.graphql"
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.