Description
Language Server Version
0.36.4+Homebrew
Terraform Version
Terraform v1.7.0 on darwin_arm64, via tfenv
Client Version
VSCode 1.97.1 w/ hashicorp.terraform 2.34.3
Behavior
After a while of having my terraform directories open in VSCode I'll notice that the terraform-ls process is consistently using >600% CPU.
When this happens and I save a .tf file in VSCode, the Getting code actions from 'HashiCorp Terraform'
notification spins for ~20 seconds and until another Saving 'modules_generated.tf': Running Code Actions and Formatters...
notification pops up. Both remain spinning for another 7 or 8 minutes. Even after the notifications have disappeared, the file still isn't saved so running terraform commands in my terminal wont pick up the changes I've made.

Steps to Reproduce
Unfortunately I don't have specific instructions. It happens after I've had various VSCode workspaces open for hours.
Most of my VSCode workspaces contain a single terraform root module though they are subdirectories of a larger monorepo with thousands of terraform root and shared modules.
Here is a screenshot from Activity Monitor showing the sustained CPU usage:
In addition to the logs gist below, I also uploaded base64-encoded profile dumps:
- memory: https://gist.github.com/rifelpet/b1c817ab13c1a069d1675c2bf2747b65
- cpu (large): https://gist.github.com/rifelpet/4c4c129e46a2904aba808d7e903b8a01
Let me know if you have trouble loading those and I can email them to a hashicorp address.
Terraform Configuration
Project Structure
Gist
https://gist.github.com/rifelpet/a20827b2345aac0fe06ab0a7fabac2e4
References
No response
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment