Some fragments show red underlines in VSCode that disappear after editing/re-saving file containing fragment
- Dominant language
- TypeScript
- Stars
- 16.9k
- Forks
- 1.9k
- Avg merge
- 22h 45m
- Merged PRs (30d)
- 70
Description
Hi there! We have a graphql config file like this:
```yaml
schema: "../backend/src/graphql_server/**/*.graphql"
documents: "./src/graphql/**/*.graphql"
extensions:
codegen:
overwrite: true
config:
noNamespaces: true
strict: true
scalars:
Date: string
DateTime: string
withHooks: true
withComponent: false
withHOC: false
reactApolloVersion: 2
generates:
src/generated/graphql/graphql.tsx:
plugins:
- "typescript"
- "typescript-operations"
- "typescript-react-apollo"
- "fragment-matcher"
```
We have many fragments defined in documents path(s). There are a (large) handful of fragments that seem to not be initially recognized, when that fragment is referenced in another document graphql file. For example, let's say I have a file containing this fragment:
```graphql
fragment A {
...B
}
```
If B is defined in the same file, this works, but if B is defined in another file, it may get a red underline. Mousing over it shows the error `Unknown fragment "B". GraphQL: Validation`.
However, I've found that if I go to the file containing B, delete a character from the fragment's name, add it back, save, go back to the file containing fragment A, remove and re-add the reference to fragment B (in fragment A), the previously unknown fragment B shows up in intellisense, and the red underline disappears. This change does not stick if I reload the window (assuming this is restarting the graphql language server).
The only thing I can tell for sure is that this doesn't impact referencing a fragment in the same file. I haven't been able to figure out some other pattern that would allow me to come up with a standalone, sharable reproduction project.
### Versions
VSCode: 1.62.3
GraphQL Extension: 0.3.26
Contributor guide
Assessment
This issue has not been assessed yet.