summaryrefslogtreecommitdiff
path: root/ftplugin/tf.lua
blob: a328f7c225507ec5a4fd2952600f8980e09ef6e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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

require("lspconfig").terraformls.setup {
  cmd = { DATA_PATH .. "/lspinstall/terraform/terraform-ls", "serve" },
  on_attach = require("lsp").common_on_attach,
  filetypes = { "tf", "terraform", "hcl" },
}