nvim: lsp: Enable nvim-lightbulb only if code lens is available

This commit is contained in:
Sanchayan Maity 2021-12-10 18:43:34 +05:30
parent 0d0480a6b2
commit 1891eef80a

View file

@ -135,6 +135,7 @@ local on_attach = function(client, bufnr)
if client.resolved_capabilities.code_lens then
vim.api.nvim_buf_set_keymap(bufnr, "n", "<Leader>l", "<cmd>lua vim.lsp.codelens.run()<CR>", opts)
vim.api.nvim_command [[autocmd CursorHold,CursorHoldI,InsertLeave <buffer> lua vim.lsp.codelens.refresh()]]
vim.api.nvim_command [[autocmd CursorHold,CursorHoldI <buffer> lua require'nvim-lightbulb'.update_lightbulb()]]
end
if client.resolved_capabilities.document_highlight then
@ -170,8 +171,6 @@ local on_attach = function(client, bufnr)
''; -- operator
''; -- type parameter
}
vim.cmd [[autocmd CursorHold,CursorHoldI <buffer> lua require'nvim-lightbulb'.update_lightbulb()]]
end
local capabilities = vim.lsp.protocol.make_client_capabilities()