aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYi Ming <ofseed@foxmail.com>2025-03-13 11:36:49 +0800
committerYi Ming <ofseed@foxmail.com>2025-03-17 14:44:55 +0800
commit96e5b61be1b18159804f6d7209601f98d16f7a7d (patch)
treeebda270f61aa80b863b37d8c1a2ab1b7d2789553
parent648b7f610162c268af18d286b69a97c5fba6836d (diff)
downloadrneovim-96e5b61be1b18159804f6d7209601f98d16f7a7d.tar.gz
rneovim-96e5b61be1b18159804f6d7209601f98d16f7a7d.tar.bz2
rneovim-96e5b61be1b18159804f6d7209601f98d16f7a7d.zip
test(lsp): add a test for refreshing hints after being requested
-rw-r--r--test/functional/plugin/lsp/inlay_hint_spec.lua22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/functional/plugin/lsp/inlay_hint_spec.lua b/test/functional/plugin/lsp/inlay_hint_spec.lua
index eefcf825b8..e410a54c31 100644
--- a/test/functional/plugin/lsp/inlay_hint_spec.lua
+++ b/test/functional/plugin/lsp/inlay_hint_spec.lua
@@ -7,6 +7,7 @@ local eq = t.eq
local dedent = t.dedent
local exec_lua = n.exec_lua
local insert = n.insert
+local feed = n.feed
local api = n.api
local clear_notrace = t_lsp.clear_notrace
@@ -369,6 +370,27 @@ test text
screen:expect({ grid = grid_without_inlay_hints, unchanged = true })
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()
api.nvim_exec_autocmds('VimLeavePre', { modeline = false })
end)