nvim: lsp: Minor clean up of autocmd callbacks
This commit is contained in:
parent
108403ca3d
commit
b398542a94
1 changed files with 12 additions and 20 deletions
|
@ -152,35 +152,27 @@ local on_attach = function(client, bufnr)
|
|||
if client.server_capabilities.codeLensProvider then
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "<Leader>l", "<cmd>lua vim.lsp.codelens.run()<CR>", opts)
|
||||
vim.api.nvim_create_autocmd({"CursorHold", "CursorHoldI", "InsertLeave"}, {
|
||||
group = lsp_augroup_id,
|
||||
buffer = bufnr,
|
||||
callback = function ()
|
||||
vim.lsp.codelens.refresh()
|
||||
end,
|
||||
group = lsp_augroup_id,
|
||||
buffer = bufnr,
|
||||
callback = vim.lsp.codelens.refresh,
|
||||
})
|
||||
vim.api.nvim_create_autocmd({"CursorHold", "CursorHoldI"}, {
|
||||
group = lsp_augroup_id,
|
||||
buffer = bufnr,
|
||||
callback = function ()
|
||||
lightbulb.update_lightbulb()
|
||||
end,
|
||||
group = lsp_augroup_id,
|
||||
buffer = bufnr,
|
||||
callback = lightbulb.update_lightbulb,
|
||||
})
|
||||
end
|
||||
|
||||
if client.server_capabilities.documentHighlightProvider then
|
||||
vim.api.nvim_create_autocmd("CursorHold", {
|
||||
group = lsp_augroup_id,
|
||||
buffer = bufnr,
|
||||
callback = function ()
|
||||
vim.lsp.buf.document_highlight()
|
||||
end,
|
||||
group = lsp_augroup_id,
|
||||
buffer = bufnr,
|
||||
callback = vim.lsp.buf.document_highlight,
|
||||
})
|
||||
vim.api.nvim_create_autocmd("CursorMoved", {
|
||||
group = lsp_augroup_id,
|
||||
buffer = bufnr,
|
||||
callback = function ()
|
||||
vim.lsp.buf.clear_references()
|
||||
end,
|
||||
group = lsp_augroup_id,
|
||||
buffer = bufnr,
|
||||
callback = vim.lsp.buf.clear_references,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue