Vscode-terraform: Fmt on save not working with vscode 1.11.1

Created on 12 Apr 2017  路  9Comments  路  Source: hashicorp/vscode-terraform

Hi,

Thanks for the good work on this extension.
Since the last update of vscode, the fmt on save doesn't work anymore. I have update to 0.0.7 and added "terraform.formatOnSave": true to my use settings.

My coworker has the same problem.

Laurent.

Most helpful comment

I just released a version which also handles .hcl files, if I got this correctly the only thing missing from the Terraform plugin was that, I will close this bug now.

Thanks for reporting!

All 9 comments

I'm seeing the same thing with 0.0.7 using Code 1.11.1

Sorry for the breakage, however this is a bit weird as it works on vscode 1.11.1 with 0.0.7 for me.

My terraform settings are:

terraform.formatOnSave: true,
terraform.formatVarsOnSave: null,
terraform.path: /Users/mauve/.bin/terraform

It works for both .tfvars and .tf files for me.

Can you please post your settings? Is it broken for all terraform files or for just .tf or .tfvars?

Huh! Looks like terraform.formatOnSave got changed to "false"?! It's been working for months :\

It's working now that I changed the setting.. but I wonder how/why it got swapped?

Edit: to be more clear - I was relying on the defaults and had no local setting overrides.

My user settings are

    "terraform.path": "/usr/local/bin/terraform",
    "terraform.formatOnSave": true,
    "terraform.formatVarsOnSave": true,

and I still can't format on save. :(

VsCode 1.11.1
vscode-terraform 0.0.8
terraform v0.8.8

EDIT: I discovered my problem. There seems to be some sort of conflict with this plugin: https://marketplace.visualstudio.com/items?itemName=wholroyd.HCL

This plugin provides syntax highlighting for all HCL files, including terraform files. These were working together previous to the release of 0.0.7. @mauve , would it be possible to maintain that harmony? I don't like having to disable the HCL plugin so formatOnSave will work. :(

the default configuration for formatOnSave used to be true but I changed it to false for 0.0.6 that might have caused some confusion.

@andrewmeissner do you only need the other plugin because it also handles .hcl files? I haven't seen files with the .hcl ending before so I can just add it.

17

I confirm @andrewmeissner answer, vscode-terraform and wholroyd.HCL can't work together anymore. It was working before.

I don't remember why I have wholroyd.HCL installed. I have disabled it and I am fine.

I just released a version which also handles .hcl files, if I got this correctly the only thing missing from the Terraform plugin was that, I will close this bug now.

Thanks for reporting!

@andrewmeissner workaround here https://github.com/mauve/vscode-terraform/issues/18#issuecomment-293820721

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fcatacut picture fcatacut  路  5Comments

mdschweda picture mdschweda  路  3Comments

chrisgallivan picture chrisgallivan  路  4Comments

kagarlickij picture kagarlickij  路  5Comments

vazkarvishal picture vazkarvishal  路  5Comments