Add kulala formatter

This commit is contained in:
Fábio André Damas 2025-07-16 19:16:58 +00:00
parent 7d6b6604ea
commit 7b8e973be5
2 changed files with 23 additions and 2 deletions

View file

@ -0,0 +1,5 @@
return {
"mistweaverco/kulala.nvim",
ft = { "http", "rest" },
opts = {}
}

View file

@ -63,7 +63,11 @@ return {
for _, v in ipairs(vim.api.nvim_get_runtime_file('lua/lsp/*', true)) do
local name = vim.fn.fnamemodify(v, ':t:r')
local cfg = require("lsp/" .. name)
lspconfig[name].setup(vim.tbl_deep_extend("force", cfg, { capabilities }))
if lspconfig[name].setup ~= nil then
lspconfig[name].setup(vim.tbl_deep_extend("force", cfg, { capabilities }))
else
vim.notify("LSP server " .. name .. " does not have a setup function", vim.log.levels.ERROR)
end
end
end
},
@ -75,7 +79,7 @@ return {
"lua-language-server", "vtsls", "ruff", "mypy", "black",
"pyright", "emmet-language-server", "tailwindcss-language-server",
"eslint-lsp", "lemminx", "gopls", "prettierd", "dotenv-linter",
"editorconfig-checker", "rust-analyzer", "taplo",
"editorconfig-checker", "rust-analyzer", "taplo", "kulala-fmt",
"json-lsp", "harper-ls", "proselint", "alex"
}
},
@ -97,12 +101,24 @@ return {
config = function()
local null_ls = require("null-ls")
local kulala_fmt = {
method = null_ls.methods.FORMATTING,
filetypes = { "http" },
generator = null_ls.formatter({
command = "kulala-fmt",
args = { "format", "--stdin" },
to_stdin = true,
}),
}
null_ls.setup({
on_attach = function(client, bufnr)
format_on_save(client, bufnr)
end,
sources = {
null_ls.builtins.formatting.prettierd,
kulala_fmt,
null_ls.builtins.diagnostics.dotenv_linter,
null_ls.builtins.diagnostics.editorconfig_checker,