Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace internal watcher with LSP's DidChangeWatchedFilesRegistrationOptions #867

Closed
1 of 4 tasks
Tracked by #724
radeksimko opened this issue Apr 11, 2022 · 1 comment · Fixed by #953
Closed
1 of 4 tasks
Tracked by #724

Replace internal watcher with LSP's DidChangeWatchedFilesRegistrationOptions #867

radeksimko opened this issue Apr 11, 2022 · 1 comment · Fixed by #953

Comments

@radeksimko
Copy link
Member

radeksimko commented Apr 11, 2022

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:

Servers are allowed to run their own file system watching mechanism and not rely on clients to provide file system events. However this is not recommended due to the following reasons:

  • to our experience getting file system watching on disk right is challenging, especially if it needs to be supported across multiple OSes.
  • file system watching is not for free especially if the implementation uses some sort of polling and keeps a file system tree in memory to compare time stamps (as for example some node modules do)
  • a client usually starts more than one server. If every server runs its own file system watching it can become a CPU or memory problem.
  • in general there are more server than client implementations. So this problem is better solved on the client side.

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:

Proposal

Related

hashicorp/vscode-terraform#405

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant