graphiql: getting unknown fragment lint error

Actual Behavior

we are using Relay and after the recent updates(starting from version 0.3.23), all the fragments are getting flagged as unknown fragment.

Expected Behavior

Steps to Reproduce the Problem Or Description

Specifications

  • GraphQL for VSCode Extension Version: > 0.3.23
  • VSCode Version: Version: 1.61.0 (Universal)
  • OS Name: Mac OS
  • OS Version: Big sur 11.6.1
  • graphql config filename and format example:

Logs Of TS Server || GraphQL Language Service

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 8
  • Comments: 29 (18 by maintainers)

Most upvoted comments

Just tested it out again a few more times since I wasn’t 100% sure it wasn’t some weird anomaly. I can confirm that the following happens (in my case at least):

  1. Open query document for editing (myQuery.graphql), see LSP report unknown fragment errors.
  2. Open document that defines fragments (myFragments.graphql) in same instance of editor+lsp.
  3. Insert newline, delete newline, and then save myFragments.graphql.
  4. Switch back to myQuery.graphql, insert newline, delete newline, and then save myQuery.graphql.
  5. Watch errors instantly disappear and completions are now available for fragment types.

I’m using this

{ 
  "schema": "./graphql-schema.json",
  "documents": "src/**/*.{graphql,js,ts,jsx,tsx}"
 }

For anyone stumbling on this issue, removing ignoreNoDocuments: true from the graphql.config.js / codegen.ts file solved the issue for me.

@esquevin exciting to hear!

I think I might just document this as a breaking change then. I think this will be the more graphql-config way to do this, and help us reduce unnecessary resource churn by parsing catch-all blobs of files.

Thank for your efforts anyway =) Meanwhile I’ve configured documents and don’t have issues anymore

I will look into this one after work tonight, sorry y’all!

I’m surprised it worked without documents configured!