fix(lsp): set auto format on save - clear autocmds
This commit is contained in:
parent
f87b823625
commit
c58d5fb85a
1 changed files with 5 additions and 1 deletions
|
@ -29,10 +29,14 @@ function M.on_attach(client, bufnr)
|
||||||
filetype_pattern = '*'
|
filetype_pattern = '*'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_clear_autocmds({
|
||||||
|
group = group,
|
||||||
|
buffer = bufnr,
|
||||||
|
})
|
||||||
-- autocommand for format on save with specified filetype(s)
|
-- autocommand for format on save with specified filetype(s)
|
||||||
vim.api.nvim_create_autocmd(string.format('BufWritePre %s', filetype_pattern), {
|
vim.api.nvim_create_autocmd(string.format('BufWritePre %s', filetype_pattern), {
|
||||||
callback = function()
|
callback = function()
|
||||||
require('cosmic.utils.lsp').format()
|
require('cosmic.utils.lsp').format(bufnr)
|
||||||
end,
|
end,
|
||||||
buffer = bufnr,
|
buffer = bufnr,
|
||||||
group = group,
|
group = group,
|
||||||
|
|
Loading…
Add table
Reference in a new issue