diff options
author | Luuk van Baal <luukvbaal@gmail.com> | 2025-02-24 09:20:55 +0100 |
---|---|---|
committer | Christian Clason <ch.clason+github@icloud.com> | 2025-02-25 14:26:58 +0100 |
commit | 47aaddfa0dda27d290e83bda3359577d257a7c56 (patch) | |
tree | 81a0f6fa57f25a58cc6795e06b0bad9ab78f4b85 /test/functional/plugin/lsp/utils_spec.lua | |
parent | 8ba047e33fe3a10765c593c810d54b5e3bb906e9 (diff) | |
download | rneovim-47aaddfa0dda27d290e83bda3359577d257a7c56.tar.gz rneovim-47aaddfa0dda27d290e83bda3359577d257a7c56.tar.bz2 rneovim-47aaddfa0dda27d290e83bda3359577d257a7c56.zip |
fix(lsp): resize hover window for concealed lines
Problem: Height of a (markdown) `vim.lsp.util.open_floating_preview()`
window can be reduced to account for concealed lines (after #31324).
Solution: Set the window height to the text height of the preview window.
Set 'concealcursor' to avoid unconcealing the cursorline when
entering the hover window.
Diffstat (limited to 'test/functional/plugin/lsp/utils_spec.lua')
-rw-r--r-- | test/functional/plugin/lsp/utils_spec.lua | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/functional/plugin/lsp/utils_spec.lua b/test/functional/plugin/lsp/utils_spec.lua index 1e3e759e0b..96d15820d4 100644 --- a/test/functional/plugin/lsp/utils_spec.lua +++ b/test/functional/plugin/lsp/utils_spec.lua @@ -329,4 +329,32 @@ describe('vim.lsp.util', function() | ]]) end) + + it('open_floating_preview height reduced for concealed lines', function() + local screen = Screen.new() + screen:add_extra_attr_ids({ + [100] = { + background = Screen.colors.LightMagenta, + foreground = Screen.colors.Brown, + bold = true, + }, + [101] = { background = Screen.colors.LightMagenta, foreground = Screen.colors.Blue }, + [102] = { background = Screen.colors.LightMagenta, foreground = Screen.colors.DarkCyan }, + }) + exec_lua([[ + vim.g.syntax_on = false + vim.lsp.util.open_floating_preview({ '```lua', 'local foo', '```' }, 'markdown', { + border = 'single', + focus = false, + }) + ]]) + screen:expect([[ + ^ | + ┌─────────┐{1: }| + │{100:local}{101: }{102:foo}│{1: }| + └─────────┘{1: }| + {1:~ }|*9 + | + ]]) + end) end) |