LSP: place hover window by vertical space #11657

Make the hover window position itself vertically wherever is the most
space available.
This commit is contained in:
Ville Hakulinen
2020-01-03 14:39:25 +02:00
committed by Justin M. Keyes
parent 94cc8a20b4
commit c241395b3d

View File

@@ -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