aboutsummaryrefslogtreecommitdiff
path: root/test/functional/plugin/lsp_spec.lua
diff options
context:
space:
mode:
authorChristian Clason <christian.clason@uni-due.de>2020-06-04 20:23:03 +0200
committerGitHub <noreply@github.com>2020-06-04 14:23:03 -0400
commitb7f3f11049c6847a2b0c4bbd89e8339036e00da6 (patch)
tree3fafc3d82b4c9e86f0918dcce136b34f208b1894 /test/functional/plugin/lsp_spec.lua
parent6f4f38cd54693ca99c887756e6179cc0775377d0 (diff)
downloadrneovim-b7f3f11049c6847a2b0c4bbd89e8339036e00da6.tar.gz
rneovim-b7f3f11049c6847a2b0c4bbd89e8339036e00da6.tar.bz2
rneovim-b7f3f11049c6847a2b0c4bbd89e8339036e00da6.zip
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>
Diffstat (limited to 'test/functional/plugin/lsp_spec.lua')
-rw-r--r--test/functional/plugin/lsp_spec.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua
index 479741d717..ae436360c3 100644
--- a/test/functional/plugin/lsp_spec.lua
+++ b/test/functional/plugin/lsp_spec.lua
@@ -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)