fix(nvim): lsp formatting

This commit is contained in:
Barrett Ruth 2026-02-16 14:33:44 -05:00
parent f99900d196
commit 24b6fdb455
Signed by: barrett
GPG key ID: A6C96C9349D2FC81

View file

@ -80,12 +80,15 @@ function M.on_attach(client, bufnr)
end end
function M.format(opts) function M.format(opts)
local ok, guard = pcall(require, 'guard') local ok, ft_handler = pcall(require, 'guard.filetype')
if ok then if ok then
guard.fmt() local conf = ft_handler[vim.bo.filetype]
else if conf and conf.formatter and #conf.formatter > 0 then
vim.lsp.buf.format(opts or { async = true }) require('guard').fmt()
return
end
end end
vim.lsp.buf.format(opts or { async = true })
end end
return M return M