Before the code was formatting properly, but the new extension did not register the formatter?
Same thing here. Format on save does not work anymore in 2.0.2.
I would also request that the vscode extension introduces a formatter that is not dependant on the language server. This will enable users who do not have, or have not initialized terraform on their local machine a means of formatting tf files without running into language server related problems.
This seems to work again with the new version of the language server installed as per https://github.com/hashicorp/vscode-terraform/issues/417#issuecomment-650228463
Just upgraded the terraform language server to 0.5.1 and it works again! ;)
Thanks for the report, as suggested this issue was addressed in 0.5.1.
Just to clarify auto-formatting may need to be configured in VS Code and it is configured via VS Code settings, not extension settings anymore: https://code.visualstudio.com/docs/getstarted/settings#_language-specific-editor-settings
e.g.
"[terraform]": {
"editor.formatOnSave": true
}
The extension will then auto-format on save via the language server.
The language server gets installed automatically and allows us to deal with version and other language differences and complexities in a single place. This is a sustainable model where we can avoid maintaining duplicate logic between VS Code, many other IDE extensions _and_ the language server. As a result the language server will be the only supported way to do formatting in the foreseeable future. If you run into issues with the language server please do report them, so we can address them.
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 context necessary to investigate further.