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

Slow on Save #1109

Closed
2 tasks done
leventyalcin opened this issue May 17, 2022 · 3 comments
Closed
2 tasks done

Slow on Save #1109

leventyalcin opened this issue May 17, 2022 · 3 comments
Labels
bug Something isn't working waiting-response

Comments

@leventyalcin
Copy link

Versions

This bug is reproducible in:

  • the latest version of the extension (below)
  • the latest version of the language server (below)

Extension

hashicorp.terraform@2.22.0

Language Server

{"name":"terraform-ls","version":"0.27.0"}}

VS Code

Version: 1.67.1 (Universal)
Commit: da15b6fd3ef856477bf6f4fb29ba1b7af717770d
Date: 2022-05-06T12:37:16.526Z
Electron: 17.4.1
Chromium: 98.0.4758.141
Node.js: 16.13.0
V8: 9.8.177.13-electron.0
OS: Darwin x64 21.4.0

Operating System

MacOS Monterey 12.3.1

Terraform Version

Terraform v1.0.8
on darwin_amd64

Steps To Reproduce

  1. Set the editor Format on Save terraform
  2. Make a change on file
  3. Save

Expected Behavior

Format the file and save immediately.

Actual Behavior

Every single time the following popup appears and saving files takes 15s to 30s every single save.
CCA0ABE7-6D0D-410C-A3FC-CA147ED644BA

Additional context

settings.json

{
    "editor.formatOnSave": true,
    "[terraform]": {
        "editor.defaultFormatter": "hashicorp.terraform",
        "editor.formatOnSave": false,
        "editor.codeActionsOnSave": {
            "source.formatAll.terraform": true
        },
    },
    "[terraform-vars]": {
        "editor.defaultFormatter": "hashicorp.terraform",
        "editor.formatOnSave": false,
        "editor.codeActionsOnSave": {
            "source.formatAll.terraform": true
        },
    },
    "files.trimTrailingWhitespace": true
}

I've removed all the extensions and reinstalled Hashicorp Terraform only but didn't help at all. These are the extension I currently have.

❯ code --list-extensions --show-versions
hashicorp.terraform@2.22.0
jetmartin.bats@0.1.9
mads-hartmann.bash-ide-vscode@1.13.0
@leventyalcin leventyalcin added the bug Something isn't working label May 17, 2022
@radeksimko
Copy link
Member

Hi @leventyalcin

  1. Can you share some more details about your Terraform installation? Specifically how did you install it? Do you use tfenv? There's a known issue upstream which causes all commands to be delayed, see terraform executions delayed by ~ 1 second tfutils/tfenv#196
  2. Can you reproduce this with the same Terraform version downloaded from our Homebrew tap or directly from here?
  3. Can you share the log from Output > HashiCorp Terraform? We're interested in any lines around textDocument/formatting requests and responses (and especially the requests and responses themselves).
  4. Can you try formatting the same document yourself via cat file.tf | terraform fmt - and check how long that takes?

@leventyalcin
Copy link
Author

I thought I searched enough but couldn't come across tfenv issue apparently.
Standalone installation solved the problem for me.
For the future, I'll be following tfenv issue.

Thanks very much,
L.

@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 Jun 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working waiting-response
Projects
None yet
Development

No branches or pull requests

2 participants