fix(lsp): auto format use sync
This commit is contained in:
parent
b7c05ecab7
commit
9366f6072c
2 changed files with 8 additions and 7 deletions
|
@ -1,6 +1,7 @@
|
|||
-- Override Cosmic configuration options
|
||||
|
||||
--[[
|
||||
|
||||
local config = {}
|
||||
|
||||
config.statusline = {
|
||||
|
@ -10,7 +11,7 @@ config.statusline = {
|
|||
config.lsp = {
|
||||
|
||||
-- true/false or table of filetypes {'.ts', '.js',}
|
||||
format_on_save = false,
|
||||
format_on_save = true,
|
||||
|
||||
servers = {
|
||||
|
||||
|
@ -20,18 +21,18 @@ config.lsp = {
|
|||
-- enable non-default servers (todo: support for custom server configs)
|
||||
rust_analyzer = true,
|
||||
|
||||
tsserver = {
|
||||
tsserver = {
|
||||
-- disable formatting
|
||||
format = false,
|
||||
}
|
||||
},
|
||||
|
||||
efm = {
|
||||
-- specifc to efm, e.g. 'eslint', 'prettier', 'stylua'
|
||||
disable_formatters = {},
|
||||
disable_formatters = {'eslint'},
|
||||
},
|
||||
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
return config
|
||||
|
||||
]]
|
||||
|
|
|
@ -25,7 +25,7 @@ function M.on_attach(client, bufnr)
|
|||
else
|
||||
format_filetypes = '*'
|
||||
end
|
||||
vim.cmd(string.format('autocmd BufWritePre %s lua vim.lsp.buf.formatting()', format_filetypes))
|
||||
vim.cmd(string.format('autocmd BufWritePre %s lua vim.lsp.buf.formatting_sync(nil, 1000)', format_filetypes))
|
||||
end
|
||||
else
|
||||
client.resolved_capabilities.document_formatting = false
|
||||
|
|
Loading…
Add table
Reference in a new issue