aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/util.lua
diff options
context:
space:
mode:
authorVille Hakulinen <ville.hakulinen@gmail.com>2020-01-03 14:39:25 +0200
committerJustin M. Keyes <justinkz@gmail.com>2020-01-03 04:39:25 -0800
commitc241395b3dcc86cd1dd6358105d71cab524d6e50 (patch)
tree8a5d9635269494c9a789a413399ed357e8bc2e31 /runtime/lua/vim/lsp/util.lua
parent94cc8a20b42bfa6ef5a344361cd7311cb6036b56 (diff)
downloadrneovim-c241395b3dcc86cd1dd6358105d71cab524d6e50.tar.gz
rneovim-c241395b3dcc86cd1dd6358105d71cab524d6e50.tar.bz2
rneovim-c241395b3dcc86cd1dd6358105d71cab524d6e50.zip
LSP: place hover window by vertical space #11657
Make the hover window position itself vertically wherever is the most space available.
Diffstat (limited to 'runtime/lua/vim/lsp/util.lua')
-rw-r--r--runtime/lua/vim/lsp/util.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua
index 4a781359d4..0de5fdad46 100644
--- a/runtime/lua/vim/lsp/util.lua
+++ b/runtime/lua/vim/lsp/util.lua
@@ -264,11 +264,16 @@ function M.make_floating_popup_options(width, height, opts)
local anchor = ''
local row, col
- if vim.fn.winline() <= height then
+ local lines_above = vim.fn.winline() - 1
+ local lines_below = vim.fn.winheight(0) - lines_above
+
+ if lines_above < lines_below then
anchor = anchor..'N'
+ height = math.min(lines_below, height)
row = 1
else
anchor = anchor..'S'
+ height = math.min(lines_above, height)
row = 0
end