terraform.lua 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. local M = {}
  2. M.config = function()
  3. -- TODO: implement config for language
  4. return "No config available!"
  5. end
  6. M.format = function()
  7. O.formatters.filetype["hcl"] = {
  8. function()
  9. return {
  10. exe = O.lang.terraform.formatter.exe,
  11. args = O.lang.terraform.formatter.args,
  12. stdin = not (O.lang.terraform.formatter.stdin ~= nil),
  13. }
  14. end,
  15. }
  16. O.formatters.filetype["tf"] = O.formatters.filetype["hcl"]
  17. require("formatter.config").set_defaults {
  18. logging = false,
  19. filetype = O.formatters.filetype,
  20. }
  21. end
  22. M.lint = function()
  23. -- TODO: implement linters (if applicable)
  24. return "No linters configured!"
  25. end
  26. M.lsp = function()
  27. if require("lv-utils").check_lsp_client_active "terraformls" then
  28. return
  29. end
  30. require("lspconfig").terraformls.setup {
  31. cmd = { DATA_PATH .. "/lspinstall/terraform/terraform-ls", "serve" },
  32. on_attach = require("lsp").common_on_attach,
  33. filetypes = { "tf", "terraform", "hcl" },
  34. }
  35. end
  36. M.dap = function()
  37. -- TODO: implement dap
  38. return "No DAP configured!"
  39. end
  40. return M