Terraform.tmLanguage icon indicating copy to clipboard operation
Terraform.tmLanguage copied to clipboard

Format configuration files upon saving

Open techsun opened this issue 3 years ago • 3 comments

Would you consider adding an option to format configuration files upon saving a file?

For reference https://www.terraform.io/docs/cli/commands/fmt.html or https://github.com/terraform-linters/tflint

For further reference, this project does this: https://github.com/tmichel/sublime-terraform

techsun avatar Jun 06 '21 18:06 techsun

It should be easy enough to back port from the fork. Open a PR?

hermitmaster avatar Jun 06 '21 19:06 hermitmaster

FYI This is available in the language server, which can be used alongside this plugin: https://github.com/hashicorp/terraform-ls

See https://github.com/sublimelsp/LSP and https://github.com/hashicorp/terraform-ls/blob/main/docs/USAGE.md#sublime-text-2

You may also need to configure the auto-formatting on-save via lsp_format_on_save: true https://github.com/sublimelsp/LSP/blob/f5952e6fb660163c3110aa435baf15c2d0adb93c/LSP.sublime-settings#L11

radeksimko avatar Jun 16 '21 20:06 radeksimko

Also Terrafmt

This plugin will automatically run terraform fmt on any Terraform file before saving.

molomby avatar Sep 08 '21 02:09 molomby