mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
test(lsp): add a test for refreshing hints after being requested
This commit is contained in:
@@ -7,6 +7,7 @@ local eq = t.eq
|
|||||||
local dedent = t.dedent
|
local dedent = t.dedent
|
||||||
local exec_lua = n.exec_lua
|
local exec_lua = n.exec_lua
|
||||||
local insert = n.insert
|
local insert = n.insert
|
||||||
|
local feed = n.feed
|
||||||
local api = n.api
|
local api = n.api
|
||||||
|
|
||||||
local clear_notrace = t_lsp.clear_notrace
|
local clear_notrace = t_lsp.clear_notrace
|
||||||
@@ -369,6 +370,27 @@ test text
|
|||||||
screen:expect({ grid = grid_without_inlay_hints, unchanged = true })
|
screen:expect({ grid = grid_without_inlay_hints, unchanged = true })
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('refreshes hints on request', function()
|
||||||
|
exec_lua([[vim.lsp.inlay_hint.enable(true, { bufnr = bufnr })]])
|
||||||
|
screen:expect({ grid = grid_with_inlay_hints })
|
||||||
|
feed('kibefore <Esc>')
|
||||||
|
screen:expect([[
|
||||||
|
before^ {1:01234}test text |
|
||||||
|
|*2
|
||||||
|
]])
|
||||||
|
exec_lua(function()
|
||||||
|
vim.lsp.inlay_hint.on_refresh(
|
||||||
|
nil,
|
||||||
|
nil,
|
||||||
|
{ method = 'workspace/inlayHint/refresh', client_id = client_id }
|
||||||
|
)
|
||||||
|
end)
|
||||||
|
screen:expect([[
|
||||||
|
{1:01234}before^ test text |
|
||||||
|
|*2
|
||||||
|
]])
|
||||||
|
end)
|
||||||
|
|
||||||
after_each(function()
|
after_each(function()
|
||||||
api.nvim_exec_autocmds('VimLeavePre', { modeline = false })
|
api.nvim_exec_autocmds('VimLeavePre', { modeline = false })
|
||||||
end)
|
end)
|
||||||
|
|||||||
Reference in New Issue
Block a user