feat: clean up provider defaults
This commit is contained in:
parent
475361c480
commit
8000535b37
2 changed files with 9 additions and 16 deletions
|
@ -34,7 +34,15 @@ function M.on_attach(client, bufnr)
|
||||||
})
|
})
|
||||||
vim.api.nvim_create_autocmd('BufWritePre', {
|
vim.api.nvim_create_autocmd('BufWritePre', {
|
||||||
callback = function()
|
callback = function()
|
||||||
lsp_utils.format_on_save(client, bufnr)
|
if not lsp_utils.format_on_save_disabled then
|
||||||
|
vim.lsp.buf.format({
|
||||||
|
timeout_ms = user_config.lsp.format_timeout,
|
||||||
|
bufnr = bufnr,
|
||||||
|
filter = function()
|
||||||
|
return lsp_utils.can_format_on_save(client)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
buffer = bufnr,
|
buffer = bufnr,
|
||||||
group = M.augroup,
|
group = M.augroup,
|
||||||
|
|
|
@ -40,21 +40,6 @@ function M.buf_format(bufnr, timeout)
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- format current buffer w/user settings
|
|
||||||
function M.format_on_save(client, bufnr)
|
|
||||||
if M.format_on_save_disabled then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.lsp.buf.format({
|
|
||||||
timeout_ms = user_config.lsp.format_timeout,
|
|
||||||
bufnr = bufnr or vim.api.nvim_get_current_buf(),
|
|
||||||
filter = function()
|
|
||||||
return M.can_format_on_save(client)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.buf_get_active_client_names(bufnr)
|
function M.buf_get_active_client_names(bufnr)
|
||||||
local active_clients = vim.lsp.get_clients({
|
local active_clients = vim.lsp.get_clients({
|
||||||
bufnr = bufnr or vim.api.nvim_get_current_buf(),
|
bufnr = bufnr or vim.api.nvim_get_current_buf(),
|
||||||
|
|
Loading…
Add table
Reference in a new issue