From 40dc2d02a85175339ce70611764b0bde7b1c19f4 Mon Sep 17 00:00:00 2001 From: Yi Ming Date: Fri, 20 Feb 2026 19:33:20 +0800 Subject: fix(lsp): ensure the codelens on the first line is visible --- runtime/lua/vim/lsp/codelens.lua | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'runtime/lua/vim') diff --git a/runtime/lua/vim/lsp/codelens.lua b/runtime/lua/vim/lsp/codelens.lua index 63688b96d0..a2639f3397 100644 --- a/runtime/lua/vim/lsp/codelens.lua +++ b/runtime/lua/vim/lsp/codelens.lua @@ -259,6 +259,12 @@ function Provider:on_win(toprow, botrow) virt_lines_overflow = 'scroll', hl_mode = 'combine', }) + + -- Fix https://github.com/neovim/neovim/issues/16166 + -- Make sure the code lens on the first line is visible when updating. + if row == 0 then + vim.cmd('normal! zb') + end end self.row_version[row] = self.version end -- cgit