2021-07-15 00:50:07 +02:00
|
|
|
local M = {}
|
|
|
|
|
|
|
|
M.config = function()
|
2021-07-15 03:14:25 +02:00
|
|
|
O.lang.terraform = {
|
|
|
|
formatter = {
|
|
|
|
exe = "terraform",
|
|
|
|
args = { "fmt" },
|
|
|
|
stdin = false,
|
|
|
|
},
|
|
|
|
}
|
2021-07-15 00:50:07 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
M.format = function()
|
|
|
|
O.formatters.filetype["hcl"] = {
|
|
|
|
function()
|
|
|
|
return {
|
|
|
|
exe = O.lang.terraform.formatter.exe,
|
|
|
|
args = O.lang.terraform.formatter.args,
|
2021-07-17 08:32:17 +02:00
|
|
|
stdin = O.lang.terraform.formatter.stdin,
|
2021-07-15 17:18:36 +02:00
|
|
|
tempfile_prefix = ".formatter",
|
2021-07-15 00:50:07 +02:00
|
|
|
}
|
|
|
|
end,
|
|
|
|
}
|
|
|
|
O.formatters.filetype["tf"] = O.formatters.filetype["hcl"]
|
|
|
|
|
|
|
|
require("formatter.config").set_defaults {
|
|
|
|
logging = false,
|
|
|
|
filetype = O.formatters.filetype,
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
M.lint = function()
|
|
|
|
-- TODO: implement linters (if applicable)
|
|
|
|
return "No linters configured!"
|
|
|
|
end
|
|
|
|
|
|
|
|
M.lsp = function()
|
|
|
|
if require("lv-utils").check_lsp_client_active "terraformls" then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
require("lspconfig").terraformls.setup {
|
|
|
|
cmd = { DATA_PATH .. "/lspinstall/terraform/terraform-ls", "serve" },
|
|
|
|
on_attach = require("lsp").common_on_attach,
|
|
|
|
filetypes = { "tf", "terraform", "hcl" },
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
M.dap = function()
|
|
|
|
-- TODO: implement dap
|
|
|
|
return "No DAP configured!"
|
|
|
|
end
|
|
|
|
|
|
|
|
return M
|