nvim: lsp: Drop unnecessary if check

This commit is contained in:
Sanchayan Maity 2023-03-04 17:02:42 +05:30
parent 00403bafaa
commit 0002d02e6c
Signed by: sanchayanmaity
GPG key ID: 6F6A0609C12038F3

View file

@ -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)