mirror of
https://github.com/neovim/neovim.git
synced 2025-12-24 07:09:05 +00:00
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:
committed by
Justin M. Keyes
parent
94cc8a20b4
commit
c241395b3d
@@ -264,11 +264,16 @@ function M.make_floating_popup_options(width, height, opts)
|
|||||||
local anchor = ''
|
local anchor = ''
|
||||||
local row, col
|
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'
|
anchor = anchor..'N'
|
||||||
|
height = math.min(lines_below, height)
|
||||||
row = 1
|
row = 1
|
||||||
else
|
else
|
||||||
anchor = anchor..'S'
|
anchor = anchor..'S'
|
||||||
|
height = math.min(lines_above, height)
|
||||||
row = 0
|
row = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user