From c692e848e973f92203721e1296f17e809115160f Mon Sep 17 00:00:00 2001 From: Yi Ming Date: Mon, 6 Apr 2026 04:54:27 +0800 Subject: [PATCH] fix(lsp): do not respond to codelens refresh if a request is already scheduled (#38801) (cherry picked from commit 909fc0b9921883da4a8fe46024b3b7509068953f) --- runtime/lua/vim/lsp/codelens.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/runtime/lua/vim/lsp/codelens.lua b/runtime/lua/vim/lsp/codelens.lua index 66d7a0cab4..f84aa748f9 100644 --- a/runtime/lua/vim/lsp/codelens.lua +++ b/runtime/lua/vim/lsp/codelens.lua @@ -484,10 +484,13 @@ function M.on_refresh(err, _, ctx) for bufnr, provider in pairs(Provider.active) do for client_id in pairs(provider.client_state) do if client_id == ctx.client_id then - provider:request(client_id, function() - provider.row_version = {} - vim.api.nvim__redraw({ buf = bufnr, valid = true, flush = false }) - end) + -- Do nothing if a request is already scheduled. + if not provider.timer then + provider:request(client_id, function() + provider.row_version = {} + vim.api.nvim__redraw({ buf = bufnr, valid = true, flush = false }) + end) + end end end end