aboutsummaryrefslogtreecommitdiff
path: root/test/functional/plugin/lsp/utils_spec.lua
diff options
context:
space:
mode:
authorRobert Muir <rmuir@apache.org>2025-03-04 13:36:57 -0500
committerGitHub <noreply@github.com>2025-03-04 18:36:57 +0000
commit7d5866d471746ca68981e57884eaaeb8dea57f81 (patch)
treef7fb6cbd004699e6f1fdf6cf5d2f70c46d62544e /test/functional/plugin/lsp/utils_spec.lua
parentfb842dfc224d2c40b70648b0ee789304e43ade6c (diff)
downloadrneovim-7d5866d471746ca68981e57884eaaeb8dea57f81.tar.gz
rneovim-7d5866d471746ca68981e57884eaaeb8dea57f81.tar.bz2
rneovim-7d5866d471746ca68981e57884eaaeb8dea57f81.zip
fix(lsp): open_floating_preview() ignores max_height (#32716)
Problem: After 47aaddfa the max_height option is no longer respected. Hover documentation and Signature help windows take up the entire text height. Solution: Compare to window's current height and only modify the height if it would reduce the height, not enlarge it.
Diffstat (limited to 'test/functional/plugin/lsp/utils_spec.lua')
-rw-r--r--test/functional/plugin/lsp/utils_spec.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/functional/plugin/lsp/utils_spec.lua b/test/functional/plugin/lsp/utils_spec.lua
index ccefc3cb99..75cc69bed4 100644
--- a/test/functional/plugin/lsp/utils_spec.lua
+++ b/test/functional/plugin/lsp/utils_spec.lua
@@ -383,4 +383,28 @@ describe('vim.lsp.util', function()
|
]])
end)
+
+ it('open_floating_preview height does not exceed max_height', function()
+ local screen = Screen.new()
+ exec_lua([[
+ vim.lsp.util.open_floating_preview(vim.fn.range(1, 10), 'markdown', {
+ border = 'single',
+ width = 5,
+ max_height = 5,
+ focus = false,
+ })
+ ]])
+ screen:expect([[
+ ^ |
+ ┌─────┐{1: }|
+ │{4:1 }│{1: }|
+ │{4:2 }│{1: }|
+ │{4:3 }│{1: }|
+ │{4:4 }│{1: }|
+ │{4:5 }│{1: }|
+ └─────┘{1: }|
+ {1:~ }|*5
+ |
+ ]])
+ end)
end)