mirror of
https://github.com/neovim/neovim.git
synced 2026-03-30 20:32:08 +00:00
fix(lsp): redraw codelens after request completed #38352
Problem: When code lens is enabled, `on_attach` is executed, but it does not trigger a redraw. Another event, eg, moving the cursor, is required to trigger a redraw and execute the decoration provider's `on_win`. Solution: Trigger a `redraw` after each request is completed.
This commit is contained in:
@@ -128,6 +128,8 @@ function Provider:handler(err, result, ctx)
|
||||
|
||||
state.row_lenses = row_lenses
|
||||
self.version = ctx.version
|
||||
|
||||
api.nvim__redraw({ buf = self.bufnr, valid = true, flush = false })
|
||||
end
|
||||
|
||||
---@package
|
||||
|
||||
@@ -178,12 +178,18 @@ describe('vim.lsp.codelens', function()
|
||||
screen:expect({ grid = grid_with_lenses })
|
||||
end)
|
||||
|
||||
it('clears code lenses when disabled', function()
|
||||
it('clears/shows code lenses when disabled/enabled', function()
|
||||
exec_lua(function()
|
||||
vim.lsp.codelens.enable(false)
|
||||
end)
|
||||
|
||||
screen:expect({ grid = grid_without_lenses })
|
||||
|
||||
exec_lua(function()
|
||||
vim.lsp.codelens.enable(true)
|
||||
end)
|
||||
|
||||
screen:expect({ grid = grid_with_lenses })
|
||||
end)
|
||||
|
||||
it('clears code lenses when sole client detaches', function()
|
||||
|
||||
Reference in New Issue
Block a user