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

Exclude files in .terraform from watching #405

Closed
radeksimko opened this issue Jun 22, 2020 · 2 comments
Closed

Exclude files in .terraform from watching #405

radeksimko opened this issue Jun 22, 2020 · 2 comments
Labels
enhancement New feature or request technical-debt

Comments

@radeksimko
Copy link
Member

radeksimko commented Jun 22, 2020

I'm not sure which part of the extension exactly decides which files to watch and send as part of didChangeWatchedFiles, but I noticed that it's attempting to report files in the Terraform cache to the server:
https://gist.github.com/radeksimko/12e7d68005a95b87c2b4fd813354f888

I believe that .terraform should be excluded from these events (from being watched), because:

  • Editing cached modules is not a practice we should be encouraging, so the server does not intend to support editing these files
  • Even if there is some server logic which relies on .terraform contents, the server will likely always prefer watching and interpreting it directly from the disk, because it cannot rely on every server to watch hidden directories for essential functions. (some LSP plugins leave this as user-configurable, which leaves a lot of room for error)
  • It can generate a lot of requests when terraform init runs

This is somewhat related to hashicorp/terraform-ls#137
The server doesn't support workspace/didChangeWatchedFiles yet and so it can generate more errors than expected as a result of the above.


We may consider offloading watching to the client by dynamic registration of paths per https://microsoft.github.io/language-server-protocol/specification#workspace_didChangeWatchedFiles but I think that .terraform should be excluded by default.


Related: hashicorp/terraform-ls#867

@radeksimko radeksimko added the enhancement New feature or request label Jun 22, 2020
jpogran added a commit that referenced this issue Jan 5, 2022
This adds the `.terraform` cache directory to the file watcher exclude list by default. A user can override this by configuring `files.watcherExclude` in their user or workspace settings file.

Closes #405
@radeksimko
Copy link
Member Author

The extension actually doesn't currently send any watched (closed) files to the server, it may have in the past, but this is no longer relevant.

@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 May 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request technical-debt
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant