Replace internal watcher with LSP's DidChangeWatchedFilesRegistrationOptions
#867
Labels
Milestone
DidChangeWatchedFilesRegistrationOptions
#867
Background
Currently the LS implements its own watcher to catch any changes in what are typically non-user-editable, but important metadata (under
.terraform/
). Knowing when this metadata changes is important so that the server can re-load installed modules or provider schemas from there.This became less "critical" feature in 0.16.0 after #454 where we started pre-building schemas of ~200 official+partner providers. However, there is still some amount of users who rely on schemas sourced locally.
The LSP says the following about server-side file watching:
Previously LSP however didn't provide any way for server to tell the client what files it wants to receive changes for. This generally makes sense for editable files (such as
*.tf
or*.tfvars
), but it doesn't work for the files described above. i.e. we shouldn't expect clients to have list of file patterns additional to*.tf
and*.tfvars
.Since LSP
3.15
there's a way to do this:dynamicRegistration: true
inDidChangeWatchedFilesClientCapabilities
as part ofinitialize
requestinitialize
requestDidChangeWatchedFilesRegistrationOptions
by sendingclient/registerCapability
with appropriateglobPattern
perterraform-ls/internal/terraform/datadir/paths.go
Lines 10 to 21 in f49cd99
workspace/didChangeWatchedFiles
notificationsProposal
Related
hashicorp/vscode-terraform#405
The text was updated successfully, but these errors were encountered: