feat(extras): added conform.nvim extra you can use instead of null-ls/none-ls

This commit is contained in:
Folke Lemaitre 2023-09-29 13:37:00 +02:00
parent 6b05ed7dcd
commit f61a243d1a
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
6 changed files with 115 additions and 0 deletions

View file

@ -5,6 +5,11 @@ local M = {}
---@type PluginLspOpts
M.opts = nil
-- Allow plugins to set a custom formatter for a buffer.
-- See the conform extra for an example.
---@type fun(bufnr:number):boolean
M.custom_format = nil
function M.enabled()
return M.opts.autoformat
end
@ -30,6 +35,10 @@ function M.format(opts)
return
end
if M.custom_format and M.custom_format(buf) then
return
end
local formatters = M.get_formatters(buf)
local client_ids = vim.tbl_map(function(client)
return client.id