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

Format-on-Save Stopped Working? #687

Closed
davaba86 opened this issue Jul 15, 2021 · 8 comments
Closed

Format-on-Save Stopped Working? #687

davaba86 opened this issue Jul 15, 2021 · 8 comments

Comments

@davaba86
Copy link

davaba86 commented Jul 15, 2021

Hi,

Recently my format-on-save stopped working and I've checked the docs however nothing new that I can see that I need to adjust in case of an update.

Here's my tf-related config.

"[terraform]": {
  "editor.formatOnSave": true,
  "editor.tabSize": 4,
},

VSCode TF Version: v2.13.0

Anyone else having these issues or might know what I can adjust?

@politician
Copy link

Yes I have the same issue!

@politician
Copy link

Actually after running more tests, I realize that even formatting won't work if you "Add a folder to workspace" in VS Code. So in my case it was a duplicate of #685

@radeksimko
Copy link
Member

As @politician mentioned there is some likelihood this was caused by the bug which was fixed in #688

I just released that bug fix as part of v2.13.1. Can you try upgrading to that version and confirm it resolved the mentioned issues? If not I am happy to reopen and investigate. Thanks.

@davaba86
Copy link
Author

Cheers, glad to hear a fix is on its way on the case you pointed to! :)

@radeksimko
Copy link
Member

That new release should already be available in VS Code Marketplace (you may need to restart VS Code for it to show) - let me know if that resolved the issues.

Screenshot 2021-07-16 at 10 03 35

@davaba86
Copy link
Author

Yeah, I just updated and it works like a charm! :)

I did however had to force it since for some reason another extension (prettier) was taking over.

"[terraform]": {
  "editor.defaultFormatter": "hashicorp.terraform",
  "editor.formatOnSave": true,
  "editor.tabSize": 2,
},

@radeksimko
Copy link
Member

Thank you for that extra context @david-abarca - this is helpful!

Unfortunately it's not the first time that I see a weird bug being caused by conflicts between multiple extensions claiming terraform language. I raised #693 and also created #692

btw. that third line (tabSize) you have there has no effect because Terraform itself (terraform fmt) is quite opinionated in how it does formatting and doesn't allow for indentation style to be any different than prescribed (two spaces).

@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 Aug 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants