graphql / graphql/graphiql

[graphql-vscode] Language server does not update schema cache if `graphql-config.load.rootDir` does not contain schema file

Open
#2,767 2 comments 0 reactions 0 assignees View on GitHub
lsp-server
Dominant language
TypeScript
Stars
16.9k
Forks
1.9k
Avg merge
22h 45m
Merged PRs (30d)
70

Description

## Description
Whenever `graphql-config.load.rootDir` does not contain the schema file, the language server does not pick up schema file changes.

Example setting:
```json
{
"graphql-config.load.rootDir": "configs"
}
```

Example fs:
```
.
├── .vscode
│ └── settings.json
├── configs
│ └── .graphqlrc.yml
├── README.md
├── schema.graphql
└── src
├── mutation.graphql
└── query.graphql
```

### Note
The above example is just to demonstrate the bug, realistically we have something such as:

```
.
├── frontend
│ ├── .graphqlrc.yml
│ └── operations
└── server
├── .graphqlrc.yml
├── operations
├── resolvers
└── schema.graphql
```

And since we cannot have multiple projects until #2616 we take the loss and just let the extension language server parse operations in the `frontend` folder.

## Reproduction
https://github.com/benatshippabo/graphql-vscode-bug

## Suggestion
Haven't looked at the code yet, but maybe we can just put a watcher on the schema file.

cf: https://discord.com/channels/625400653321076807/863688262181453845/1020491480634249317

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.