fix(efm): cleaner formatting conditionals
This commit is contained in:
parent
3265d8233a
commit
1d90b8deb5
1 changed files with 6 additions and 9 deletions
|
@ -8,19 +8,16 @@ function M.on_attach(client, bufnr)
|
||||||
-- Enable completion triggered by <c-x><c-o>
|
-- Enable completion triggered by <c-x><c-o>
|
||||||
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||||
|
|
||||||
require('cosmic.lsp.mappings')
|
local formatting_servers = { 'efm', 'eslint' }
|
||||||
|
if vim.tbl_contains(formatting_servers, client.name) then
|
||||||
-- So that the only client with format capabilities is efm
|
client.resolved_capabilities.document_formatting = true
|
||||||
if client.name ~= 'efm' then
|
client.resolved_capabilities.document_range_formatting = true
|
||||||
|
else
|
||||||
client.resolved_capabilities.document_formatting = false
|
client.resolved_capabilities.document_formatting = false
|
||||||
client.resolved_capabilities.document_range_formatting = false
|
client.resolved_capabilities.document_range_formatting = false
|
||||||
end
|
end
|
||||||
|
|
||||||
-- need to set eslint formatting manually
|
require('cosmic.lsp.mappings')
|
||||||
if client.name == 'eslint' then
|
|
||||||
client.resolved_capabilities.document_formatting = true
|
|
||||||
client.resolved_capabilities.document_range_formatting = true
|
|
||||||
end
|
|
||||||
|
|
||||||
require('lsp_signature').on_attach({
|
require('lsp_signature').on_attach({
|
||||||
bind = true, -- This is mandatory, otherwise border config won't get registered.
|
bind = true, -- This is mandatory, otherwise border config won't get registered.
|
||||||
|
|
Loading…
Add table
Reference in a new issue