Skip to content

Commit 0fc23d2

Browse files
committed
fix: avoid overlapping signature window with popupmenu
Thanks @soifou!
1 parent fe44a7d commit 0fc23d2

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lua/blink/cmp/signature/trigger.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function trigger.activate()
8080
end
8181
end,
8282
on_insert_leave = function() trigger.hide() end,
83-
on_complete_changed = function() end,
83+
on_complete_changed = function() require('blink.cmp.signature.window').update_position() end,
8484
})
8585

8686
if config.show_on_accept then

lua/blink/cmp/signature/window.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,14 @@ function signature.update_position()
130130
direction_priority = menu_win_is_up and { 's' } or { 'n' }
131131
end
132132

133+
-- same for popupmenu, we want to place the signature window on the opposite side
134+
local popupmenu_pos = vim.fn.pum_getpos()
135+
if popupmenu_pos.row ~= nil then
136+
local cursor_screen_row = vim.fn.winline()
137+
local popupmenu_is_up = popupmenu_pos.row - cursor_screen_row < 0
138+
direction_priority = popupmenu_is_up and { 's' } or { 'n' }
139+
end
140+
133141
local pos = win:get_vertical_direction_and_height(direction_priority, config.max_height)
134142

135143
-- couldn't find anywhere to place the window

0 commit comments

Comments
 (0)