fixup: prevent errors if lsp clients are not yet ready

pull/429/head
weirdgiraffe 3 months ago
parent 3dde86916c
commit 6706aafee0
No known key found for this signature in database
GPG Key ID: 1F15F3CEAD2926CA

@ -4,6 +4,10 @@ local codelens = require('vim.lsp.codelens')
-- runs callback if gopls supports codelens
local function with_gopls_codelens(callback)
-- prevent errors from codelens if lsp is not ready
if not vim.lsp.buf.server_ready() then
return
end
for _, gopls in pairs(vim.lsp.get_active_clients({ name = 'gopls', bufnr = 0 })) do
if gopls:supports_method('textDocument/codeLens') then
callback()

Loading…
Cancel
Save