mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
lsp: compute height of floating preview correctly for wrapped lines (#12380)
* take wrapping into account when computing float height * factor out size calculation * add test * accept and pass through opts.wrap_at in floating_preview * make padding configurable * slightly refactor fancy_floating_markdown to make use of make_position * padding using string.format * move trim and pad to separate function * nit Co-authored-by: Hirokazu Hata <h.hata.ai.t@gmail.com> * remove mention of backward compat * make lint happy Co-authored-by: Hirokazu Hata <h.hata.ai.t@gmail.com>
This commit is contained in:
@@ -1379,4 +1379,14 @@ describe('LSP', function()
|
||||
eq('å', exec_lua[[return vim.fn.expand('<cword>')]])
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('lsp.util._make_floating_popup_size', function()
|
||||
exec_lua [[ contents =
|
||||
{"text tαxt txtα tex",
|
||||
"text tααt tααt text",
|
||||
"text tαxt tαxt"}
|
||||
]]
|
||||
eq({19,3}, exec_lua[[ return {vim.lsp.util._make_floating_popup_size(contents)} ]])
|
||||
eq({15,5}, exec_lua[[ return {vim.lsp.util._make_floating_popup_size(contents,{width = 15, wrap_at = 14})} ]])
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user