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
1 changed files with 5 additions and 2 deletions

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()]]
end
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()]]
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 CursorHoldI <buffer> lua vim.lsp.buf.document_highlight()]]
vim.api.nvim_command [[autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()]]
end
protocol.CompletionItemKind = {
''; -- text