Skip to content

Commit

Permalink
nvim: attempt to fix "no clients w/ codelens" errors
Browse files Browse the repository at this point in the history
  • Loading branch information
chris468 committed Jun 30, 2024
1 parent 6cfe6a4 commit 6a80376
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions dotfiles/private_dot_config/nvim/plugin/lsp-attach.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,12 @@ local function refresh_codelens(buf)
group = vim.api.nvim_create_augroup("Refresh codelens", { clear = true }),
buffer = buf,
callback = function()
for _, client in ipairs(vim.lsp.get_clients({ bufnr = buf })) do
if client.supports_method("textDocument/codeLens") then
vim.lsp.codelens.refresh()
return
end
local codelens_clients = vim.lsp.get_clients({
bufnr = buf,
method = "textDocument/codeLens",
})
if #codelens_clients > 0 then
vim.lsp.codelens.refresh()
end
end,
})
Expand Down

0 comments on commit 6a80376

Please sign in to comment.