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

Terraform extentions IntelliSense running very slow #1544

Closed
1 task
emnedre opened this issue Jul 21, 2023 · 5 comments
Closed
1 task

Terraform extentions IntelliSense running very slow #1544

emnedre opened this issue Jul 21, 2023 · 5 comments
Labels
bug Something isn't working performance Gotta go fast

Comments

@emnedre
Copy link

emnedre commented Jul 21, 2023

Extension Version

v2.27.0

VS Code Version

Version: 1.80.1
Commit: 74f6148eb9ea00507ec113ec51c489d6ffb4b771
Date: 2023-07-12T17:20:23.298Z (1 wk ago)
Electron: 22.3.14
ElectronBuildId: 21893604
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Darwin x64 22.5.0

Operating System

macOS Ventura 13.4 (22F66)

Terraform Version

Terraform v1.5.3 on darwin_amd64

Steps to Reproduce

I am experiencing significant performance issues with the Terraform extension in Visual Studio Code (VS Code). Specifically, the IntelliSense feature, which provides code suggestions, is running very slowly and causing delays in my workflow. On the other hand, the Python extension, which I also have installed, works as expected, providing quick and responsive suggestions.

Steps to Reproduce:

  1. Open Visual Studio Code.
  2. Create or open a Terraform file (e.g., .tf or .tfvars).
  3. Begin typing Terraform code to trigger the IntelliSense feature.

Expected Behavior

IntelliSense should start automatically and display suggestions immediately after I start typing, just like the Python extension does.

Actual Behavior

Instead of immediate suggestions, there is a considerable delay of approximately 5 seconds or more before IntelliSense displays any Terraform suggestions.

Terraform Configuration

No response

Project Structure

No response

Gist

No response

Anything Else?

I have the Python extension installed as well, and it operates smoothly without any noticeable delays.
My VS Code workspace does not contain an excessive number of files or folders that could be causing the slowdown.
The slowness issue persists even when I disable other extensions, leaving only the Terraform extension enabled.
I have deleted the installation, and extions folder as described in the VS code documentation, but still the issue persist.

Workarounds

No response

References

No response

Help Wanted

  • I'm interested in contributing a fix myself

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
@emnedre emnedre added the bug Something isn't working label Jul 21, 2023
@andreyvital
Copy link

andreyvital commented Aug 5, 2023

Very slow for me too. The gap between a save and a format is huge. Taking a couple of secs!

Any thoughts?

@jpogran jpogran added the performance Gotta go fast label Aug 15, 2023
@jpogran
Copy link
Contributor

jpogran commented Aug 18, 2023

We know this has been a frustrating experience and appreciate your understanding while we gathered feedback and examples to diagnose this issue. We've created #1557 as a central place to see updates on what we are doing to address performance issues in terraform-ls in both the short and long term and pinned it to the repo. We'll be adding more detail there as we implement fixes. As we work on this we'll be recording the content and then closing the individual issues so that everyone has one place to look at instead of searching for individual tickets for updates.

@seanamos
Copy link

What I've noticed is that the first save (and format) is quite quick. This seems to kick off something in the Terraform language server which causes it to consume a lot of CPU for quite some time. A second attempt to save while the language server is still consuming CPU will cause VSCode to hang, waiting for formatting.

If I watch the terraform-ls process and wait for it to stop consuming CPU, a save and format operation completes near immediately. Of course, this kicks the terraform-ls process into CPU spin mode again.

This seems to primarily occur in the root module which references quite a few other local modules. The modules themselves are much less affected.

@jpogran
Copy link
Contributor

jpogran commented Sep 13, 2023

We've released 2.27.2 which contains two fixes (hashicorp/terraform-ls#1369, hashicorp/terraform-ls#1372) in our continuing efforts to address this issue.

With the fix, we should be back to terraform-ls v0.29.2 levels of CPU usage while maintaining the memory improvements of v0.29.3.

If you have the time, please give it a try and let us know how it works for you. Please open a new issue rather than replying here, as this issue has gotten so many replies with different experiences it is hard to process.

I am going to close this as we're using #1557 as a central tracking issue, so subscribe to that to see continued updates.

@jpogran jpogran closed this as completed Sep 13, 2023
@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 Oct 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working performance Gotta go fast
Projects
None yet
Development

No branches or pull requests

4 participants