apollographql / apollographql/apollo-tooling

Reload languageServer on `localSchemaFile` change.

Open
#1,685 3 comments 5 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3k
Forks
460
PR merge metrics
No merged PRs in 30d

Description

For now, I'm using monorepo with server and client. And when my watch scripts regenerate schema file I need to manually reload `Apollo: Reload Schema` (`apollographql/reloadService`).

It will be nice if vs-code plugin reloads automatically with new `localSchemaFile` data.

Need to extend somehow the following code:
https://github.com/apollographql/apollo-tooling/blob/master/packages/apollo-language-server/src/server.ts#L133

### But for now I found a workaround
You need to install [File Watcher](https://marketplace.visualstudio.com/items?itemName=AppulateInc.filewatcher) extension and add the following config to : `.vscode/settings.json`:
```js
{
"filewatcher.commands": [
{
"match": "\\.graphql*",
"isAsync": true,
"cmd": "touch ${workspaceRoot}/apps/client/apollo.config.js",
"event": "onFileChange"
}
]
}
```

`touch` command will refresh `apollo.config.js` and Apollo for VSCode will catch these changes and reload the schema file.

Contributor guide

Open the contributing guide

Research direction

Start with packages/apollo-language-server/src/server.ts around line 133 and trace how changes to apollo.config.js reach the VS Code plugin's reloadService. Reproduce the monorepo case by regenerating the localSchemaFile, then verify that the language server reloads automatically without the File Watcher workaround or manual Apollo: Reload Schema command.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.