diff --git a/init.lua b/init.lua index 9b78066..9bb99e4 100644 --- a/init.lua +++ b/init.lua @@ -161,7 +161,20 @@ end require("mappings") require("lsp") vim.cmd("set completeopt+=noselect") -vim.lsp.enable({ "lua_ls", "gh_actions_ls", "gopls", "astro", "nixd", "zls", "ruff", "tflint", "just", "ty", "templ" }) +vim.lsp.enable({ + "lua_ls", + "gh_actions_ls", + "gopls", + "astro", + "nixd", + "zls", + "ruff", + "tflint", + "just", + "ty", + "templ", + "terraformls", +}) vim.api.nvim_create_autocmd("LspAttach", { callback = function(ev) local client = vim.lsp.get_client_by_id(ev.data.client_id) diff --git a/lsp/terraformls.lua b/lsp/terraformls.lua index 4832dce..90a9cfa 100644 --- a/lsp/terraformls.lua +++ b/lsp/terraformls.lua @@ -1,7 +1,22 @@ +---@brief +--- https://github.com/hashicorp/terraform-ls + +---@type vim.lsp.Config return { - settings = { + cmd = { "terraform-ls", "serve" }, + filetypes = { "terraform", "terraform-vars" }, + root_markers = { ".terraform", ".git" }, + init_options = { terraform = { path = "/etc/profiles/per-user/ethan/bin/tofu", }, }, + capabilities = { + experimental = { + showReferencesCommandId = "client.showReferences", + }, + }, + on_attach = function(_, bufnr) + vim.lsp.codelens.enable(true, { bufnr = bufnr }) + end, }