feat(codelens): handle workspace/codeLens/refresh
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
local Row = require("lsp.codelens.row")
|
||||
local Session = require("lsp.codelens.session")
|
||||
local log = require("log")
|
||||
|
||||
local GROUP = vim.api.nvim_create_augroup("ow.lsp.codelens", { clear = true })
|
||||
|
||||
@@ -48,6 +49,28 @@ end
|
||||
function M.setup(opts)
|
||||
Row.configure(opts or {})
|
||||
|
||||
local method = vim.lsp.protocol.Methods.workspace_codeLens_refresh
|
||||
vim.lsp.handlers[method] = function(err, _, ctx)
|
||||
if err then
|
||||
log.warning(
|
||||
"client %d: error on %s: %s",
|
||||
ctx.client_id,
|
||||
method,
|
||||
err.message
|
||||
)
|
||||
end
|
||||
for buf, session in pairs(session_by_buf) do
|
||||
if
|
||||
session.enabled
|
||||
and #vim.lsp.get_clients({ bufnr = buf, id = ctx.client_id })
|
||||
> 0
|
||||
then
|
||||
session:refresh()
|
||||
end
|
||||
end
|
||||
return vim.NIL
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufEnter", "LspAttach" }, {
|
||||
group = GROUP,
|
||||
callback = function(ev)
|
||||
|
||||
Reference in New Issue
Block a user