nvim: lsp: Drop unnecessary if check
This commit is contained in:
parent
00403bafaa
commit
0002d02e6c
1 changed files with 23 additions and 25 deletions
|
@ -160,32 +160,30 @@ local on_attach = function(client, bufnr)
|
|||
-- Opt out of semantic highlighting
|
||||
client.server_capabilities.semanticTokensProvider = nil
|
||||
|
||||
if client.server_capabilities.codeLensProvider or client.server_capabilities.documentHighlightProvider then
|
||||
if client.server_capabilities.codeLensProvider then
|
||||
vim.api.nvim_create_autocmd({"CursorHold", "CursorHoldI", "InsertLeave"}, {
|
||||
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 = lightbulb.update_lightbulb,
|
||||
})
|
||||
end
|
||||
if client.server_capabilities.codeLensProvider then
|
||||
vim.api.nvim_create_autocmd({"CursorHold", "CursorHoldI", "InsertLeave"}, {
|
||||
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 = lightbulb.update_lightbulb,
|
||||
})
|
||||
end
|
||||
|
||||
if client.server_capabilities.documentHighlightProvider then
|
||||
vim.api.nvim_create_autocmd("CursorHold", {
|
||||
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 = vim.lsp.buf.clear_references,
|
||||
})
|
||||
end
|
||||
if client.server_capabilities.documentHighlightProvider then
|
||||
vim.api.nvim_create_autocmd("CursorHold", {
|
||||
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 = vim.lsp.buf.clear_references,
|
||||
})
|
||||
end
|
||||
|
||||
inlay_hint.on_attach(client, bufnr)
|
||||
|
|
Loading…
Reference in a new issue