Skip to content

Commit

Permalink
fix(offset-y): Adding in fix for the offset being too high
Browse files Browse the repository at this point in the history
- Fixes offet height when in lower half of window
  • Loading branch information
Adam Figgins committed Feb 26, 2023
1 parent 0292319 commit d26a950
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lua/lsp-overloads/models/signature.lua
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,11 @@ function Signature:create_signature_popup()
local _, height = vim.lsp.util._make_floating_popup_size(self.signature_content.contents, self.config)

local lines_above = vim.fn.winline() - 1
if lines_above > height then
local is_lower_win_half = lines_above > math.floor(vim.fn.winheight(0) / 2)

-- If the cursor is in the lower half of the window,
-- the standard functionality will already offset the popup to be above the cursor, so we don't neeed to do it again.
if lines_above > height and not is_lower_win_half then
self.config.offset_y = -height - 3 -- -3 brings the bottom of the popup above the current line
end
end
Expand Down

0 comments on commit d26a950

Please sign in to comment.