feat(lang): add opentofu support

This commit is contained in:
Harm-Jan Blok 2025-12-24 11:06:06 +01:00
parent c64a61734f
commit fa05865a31
No known key found for this signature in database
GPG key ID: B79D024441664284

View file

@ -0,0 +1,57 @@
vim.filetype.add({
extension = {
tofu = "opentofu",
},
})
return {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "terraform", "hcl" })
vim.treesitter.language.register("opentofu", "hcl")
end,
},
{
"neovim/nvim-lspconfig",
opts = {
servers = {
tofu_ls = {},
},
},
},
{
"mason-org/mason.nvim",
opts = { ensure_installed = { "tofu-ls" } },
},
{
"nvimtools/none-ls.nvim",
optional = true,
opts = function(_, opts)
local null_ls = require("null-ls")
opts.sources = vim.list_extend(opts.sources or {}, {
null_ls.builtins.formatting.opentofu_fmt,
null_ls.builtins.diagnostics.opentofu_validate,
})
end,
},
{
"mfussenegger/nvim-lint",
optional = true,
opts = {
linters_by_ft = {
opentofu = { "tofu" },
},
},
},
{
"stevearc/conform.nvim",
optional = true,
opts = {
formatters_by_ft = {
opentofu = { "tofu_fmt" },
},
},
},
}