mirror of
https://github.com/CompeyDev/my-nvim-setup.git
synced 2024-12-12 12:50:37 +00:00
apply formatting on save to all files
This commit is contained in:
parent
7f5fbbf08b
commit
987eabdb07
1 changed files with 13 additions and 13 deletions
|
@ -69,19 +69,19 @@ return {
|
|||
temp_dir = nil,
|
||||
update_in_insert = false,
|
||||
-- formatting on save
|
||||
--on_attach = function(client, bufnr)
|
||||
-- if client.supports_method("textDocument/formatting") then
|
||||
-- vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||
-- vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
-- group = augroup,
|
||||
-- buffer = bufnr,
|
||||
-- callback = function()
|
||||
-- vim.lsp.buf.format({ bufnr = bufnr })
|
||||
-- end,
|
||||
-- })
|
||||
-- end
|
||||
--end,
|
||||
} -- end of setup
|
||||
on_attach = function(client, bufnr)
|
||||
if client.supports_method "textDocument/formatting" then
|
||||
vim.api.nvim_clear_autocmds { group = augroup, buffer = bufnr }
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format { bufnr = bufnr }
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue