(fix) move fs watcher config to language-server #2009
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#2008
The problem seems to be becuase neovim recently added the
didChangeWatchedFiles
support. But they didn't have a watcher config on their side. This PR move the watcher config to the language server with dynamic registration. It was on the client side because it can't be set in the server as a capability.Existing clients with the config I know of are VSCode, coc-svelte, visual studio and emacs-lsp. I tested with them to see if moving to the server side would cause any problems. VSCode and coc-svelte can handle both and will not trigger twice. Visual Studio doesn't support dynamic registration this won't affect it. I didn't manage to install emacs-lsp successfully. But the Volar client in emacs does have this double registration problem, and it doesn't seem to have an existing issue, so it's probably fine.
I also added json to the watcher config. So this should fix #1613 as well. In resolveJsonModule, json file is just like ts, js files and in normal mode, We'll still cache some JSON files because TypeScript reads them through
languageServiceHost.readFile
. We can refresh those in the file watch as well.