issue #90 remove lsp codelens check

pull/119/head
ray-x 2 years ago
parent 49b311aff2
commit 4b1eea8b90

@ -35,11 +35,6 @@ function M.refresh()
if _GO_NVIM_CFG.lsp_codelens == false then
return
end
if not utils.check_capabilities("code_lens") then
-- _GO_NVIM_CFG.lsp_codelens = false
log("code lens not supported by your gopls")
return
end
vim.lsp.codelens.refresh()
end

@ -5,7 +5,6 @@ local diagnostic_map = function(bufnr)
local opts = { noremap = true, silent = true }
api.nvim_buf_set_keymap(bufnr, "n", "]O", ":lua vim.lsp.diagnostic.set_loclist()<CR>", opts)
end
local on_attach = function(client, bufnr)
local function buf_set_keymap(...)
vim.api.nvim_buf_set_keymap(bufnr, ...)
@ -24,6 +23,10 @@ local on_attach = function(client, bufnr)
client.resolved_capabilities.document_formatting = false
end
codelens_enabled = client.resolved_capabilities["code_lens"]
if not codelens_enabled and _GO_NVIM_CFG.lsp_codelens then
vim.notify("failed to enable codelens", vim.lsp.log_levels.WARN)
end
if _GO_NVIM_CFG.lsp_keymaps == true then
buf_set_keymap("n", "gD", ":lua vim.lsp.buf.formatting()<CR>", opts)
buf_set_keymap("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", opts)

@ -357,6 +357,7 @@ function util.load_plugin(name, modulename)
return plugin
end
-- deprecated
function util.check_capabilities(feature, client_id)
local clients = vim.lsp.buf_get_clients(client_id or 0)

Loading…
Cancel
Save