add document_highlight autocmds only if lsp supports it

This commit is contained in:
2022-02-22 13:25:20 +03:00
parent 38aa85ae78
commit e71d03b9db

View File

@@ -147,11 +147,13 @@ local on_attach = function(client, bufnr)
client.resolved_capabilities.document_range_formatting = false client.resolved_capabilities.document_range_formatting = false
end end
vim.cmd([[ if client.resolved_capabilities.document_highlight then
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight() vim.cmd([[
autocmd CursorHoldI <buffer> lua vim.lsp.buf.document_highlight() autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references() autocmd CursorHoldI <buffer> lua vim.lsp.buf.document_highlight()
]]) autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
]])
end
require("lsp_signature").on_attach({ require("lsp_signature").on_attach({
bind = true, bind = true,