diff options
author | christianchiarulli <[email protected]> | 2021-07-13 20:31:49 -0400 |
---|---|---|
committer | christianchiarulli <[email protected]> | 2021-07-13 20:31:49 -0400 |
commit | ef44a4f3c67617cf079cc3afbc901f675d380217 (patch) | |
tree | aa0602a54c0e28ecba999b51b9bd0ff7629ca5dc | |
parent | 73cf3258d74cf2c7871db37d6825b23587fffe20 (diff) |
terraform formatter
-rw-r--r-- | ftplugin/tf.lua | 16 | ||||
-rw-r--r-- | lua/default-config.lua | 8 |
2 files changed, 23 insertions, 1 deletions
diff --git a/ftplugin/tf.lua b/ftplugin/tf.lua index 7291cbd8..a328f7c2 100644 --- a/ftplugin/tf.lua +++ b/ftplugin/tf.lua @@ -1,3 +1,19 @@ +O.formatters.filetype["hcl"] = { + function() + return { + exe = O.lang.terraform.formatter.exe, + args = O.lang.terraform.formatter.args, + stdin = not (O.lang.terraform.formatter.stdin ~= nil), + } + end, +} +O.formatters.filetype["tf"] = O.formatters.filetype["hcl"] + +require("formatter.config").set_defaults { + logging = false, + filetype = O.formatters.filetype, +} + if require("lv-utils").check_lsp_client_active "terraformls" then return end diff --git a/lua/default-config.lua b/lua/default-config.lua index df17d0af..fff921b9 100644 --- a/lua/default-config.lua +++ b/lua/default-config.lua @@ -259,7 +259,13 @@ O = { "typescriptreact", }, }, - terraform = {}, + terraform = { + formatter = { + exe = "terraform", + args = { "fmt" }, + stdin = false, + }, + }, tsserver = { -- @usage can be 'eslint' or 'eslint_d' linter = "", |