nvim: lsp: Enable document highlight only when supported

This commit is contained in:
Sanchayan Maity 2021-12-10 13:28:14 +05:30
parent 5716ca88af
commit b41584d996

View file

@ -114,8 +114,11 @@ local on_attach = function(client, bufnr)
vim.api.nvim_command [[autocmd CursorHold,CursorHoldI,InsertLeave <buffer> lua vim.lsp.codelens.refresh()]] vim.api.nvim_command [[autocmd CursorHold,CursorHoldI,InsertLeave <buffer> lua vim.lsp.codelens.refresh()]]
end end
if client.resolved_capabilities.document_highlight then
vim.api.nvim_command [[autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()]] vim.api.nvim_command [[autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()]]
vim.api.nvim_command [[autocmd CursorMoved,InsertEnter <buffer> lua vim.lsp.buf.clear_references()]] vim.api.nvim_command [[autocmd CursorHoldI <buffer> lua vim.lsp.buf.document_highlight()]]
vim.api.nvim_command [[autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()]]
end
protocol.CompletionItemKind = { protocol.CompletionItemKind = {
''; -- text ''; -- text