nvim: continue to support LSP config of <0.8.0
This commit is contained in:
parent
c0052e9c9f
commit
c123a35457
|
@ -24,10 +24,26 @@ local on_attach = function(client, bufnr)
|
|||
end, 'List workspace folders', bufnr)
|
||||
map('n', '<Leader>lr', vim.lsp.buf.rename, 'Rename symbol', bufnr)
|
||||
map('n', '<Leader>la', vim.lsp.buf.code_action, 'Code action', bufnr)
|
||||
map('n', '<Leader>lf', vim.lsp.buf.format, 'Format buffer', bufnr)
|
||||
if vim.fn.has('nvim-0.8.0') == 1 then
|
||||
map('n', '<Leader>lf', vim.lsp.buf.format, 'Format buffer', bufnr)
|
||||
else
|
||||
map('n', '<Leader>lf', vim.lsp.buf.formatting, 'Format buffer', bufnr)
|
||||
end
|
||||
|
||||
|
||||
-- highlight symbol under cursor
|
||||
if client.server_capabilities.documentHighlightProvider then
|
||||
local has_highlight = false
|
||||
if vim.fn.has('nvim-0.8.0') == 1 then
|
||||
if client.server_capabilities.documentHighlightProvider then
|
||||
has_highlight = true
|
||||
end
|
||||
else
|
||||
if client.resolved_capabilities.document_highlight then
|
||||
has_highlight = true
|
||||
end
|
||||
end
|
||||
|
||||
if has_highlight then
|
||||
vim.api.nvim_create_augroup('config_lsp', { clear = false })
|
||||
vim.api.nvim_clear_autocmds({
|
||||
buffer = bufnr,
|
||||
|
|
Loading…
Reference in New Issue