mirror of
https://github.com/neovim/neovim.git
synced 2025-10-17 15:21:47 +00:00
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.
This commit is contained in:

committed by
Christian Clason

parent
8ba047e33f
commit
47aaddfa0d
@@ -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)
|
||||
|
Reference in New Issue
Block a user