mirror of
https://github.com/neovim/neovim.git
synced 2026-04-22 23:35:32 +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
|
state.row_lenses = row_lenses
|
||||||
self.version = ctx.version
|
self.version = ctx.version
|
||||||
|
|
||||||
|
api.nvim__redraw({ buf = self.bufnr, valid = true, flush = false })
|
||||||
end
|
end
|
||||||
|
|
||||||
---@package
|
---@package
|
||||||
|
|||||||
@@ -178,12 +178,18 @@ describe('vim.lsp.codelens', function()
|
|||||||
screen:expect({ grid = grid_with_lenses })
|
screen:expect({ grid = grid_with_lenses })
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('clears code lenses when disabled', function()
|
it('clears/shows code lenses when disabled/enabled', function()
|
||||||
exec_lua(function()
|
exec_lua(function()
|
||||||
vim.lsp.codelens.enable(false)
|
vim.lsp.codelens.enable(false)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
screen:expect({ grid = grid_without_lenses })
|
screen:expect({ grid = grid_without_lenses })
|
||||||
|
|
||||||
|
exec_lua(function()
|
||||||
|
vim.lsp.codelens.enable(true)
|
||||||
|
end)
|
||||||
|
|
||||||
|
screen:expect({ grid = grid_with_lenses })
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('clears code lenses when sole client detaches', function()
|
it('clears code lenses when sole client detaches', function()
|
||||||
|
|||||||
Reference in New Issue
Block a user