Ask questionsterraform fmt on save not actually occurring
If have Format on Save enabled, and on saving a .tf file, the output shows it running
terraform fmt on the file:
2019-03-29 15:15:41:274 [INFO ] formatting-provider: running 'terraform fmt' on 'c:\Users\user\project-dir\main.tf' 2019-03-29 15:15:41:275 [INFO ] runner: Running terraform cwd='C:\Users\user\AppData\Local\Programs\Microsoft VS Code' path='terraform' (version: 0.11.11) args=[fmt, -] 2019-03-29 15:15:42:492 [INFO ] file-system-watcher: Indexed file:///c%3A/Users/user/project-dir/main.tf 2019-03-29 15:15:44:340 [INFO ] runner: Running terraform succeeded.
However, the formatting is not applied and file remains unchanged.
terraform fmt on the file via the console has the expected formatting effect on the file.
This issue was also mentioned by @IronFarm in https://github.com/mauve/vscode-terraform/issues/62#issuecomment-426944230
Answer questions udondan
Can't figure it out... I just replaced the
- now with
document.fileName. Certainly not the way to do it and sometimes causes issues with vsc complaining the file it wants to save is newer than what it got. Better though than not formatting the code.
BTW, manually formatting the code works. It's only the format on save that doesn't do anything, event though the function is triggered and debugging output looks as if it worked.
PS: How do i have version 1.4.0 installed when the latest release here is 1.3.12?