I am yet to come up with the minimal repro steps, for now just documenting the issue:
image.png (view on web)When completion item is too long, popup info window appears on the left being too narrow.
There is enough space to make it wide enough to present additional information.
9.1.1868
debian13,bash
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
@girishji fyi, not sure if you did anything related.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
repro steps:
smallpopup.vim
vim9script
set complete=Fg:Popup
set completeopt=popup
set autocomplete
def g:Popup(findstart: number, base: string): any
if findstart > 0
var prefix = getline('.')->strpart(0, col('.') - 1)->matchstr('\S\+$')
if prefix->empty()
return -2
endif
return col('.') - prefix->len() - 1
endif
var items = [
{ word: 'apple aaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbb cccccccccccccccccccc dddddddddddddddddddd eeeeeeeeeeeeeeee fffffffffffffffffffffffffffffff gggggggggggggggggggggggggg hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh jjjjjjjjjjjjjjjjjjjjj', kind: 'F', info: 'A fruit' },
{ word: 'banana', kind: 'F', info: "Another fruit description with a bit of text.\nShould fit into popup window.\n" },
{ word: 'carrot', kind: 'V', info: 'A vegetable' },
{ word: 'date', kind: 'F', info: 'A sweet fruit' },
{ word: 'eggplant', kind: 'V', info: 'A purple vegetable' },
]
return items->matchfuzzy(base, {key: "word"})
enddef
vim --clean -S smallpopup.vim +"normal 20o"
i<tab><tab>b<C-n>
https://asciinema.org/a/gmnFm5WHhO37zatfRkPQKm8my
additionally if you don't provide enough space on the left, there would be no popup at all:
https://asciinema.org/a/NHRQ95h0IDDlfE0g0ANUJIYQ0
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
I didn’t make any fundamental changes to the positioning logic of the info window — only adjusted the dimensions to account for the border. You can take a look at pum_position_info_popup()
in popupmenu.c
to see if the positioning logic can be improved. I might not be able to dig into this myself for a few days until I get some time.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
In your screenshot, do you expect the info window to sit above the cursor, while menu is below the cursor? That is the only way we can make info window wider.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
In your screenshot, do you expect the info window to sit above the cursor, while menu is below the cursor? That is the only way we can make info window wider.
Indeed, there is a space above that could be used for that. Not sure if in some cases it could be displayed below.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
In your screenshot, do you expect the info window to sit above the cursor, while menu is below the cursor? That is the only way we can make info window wider.
Indeed, there is a space above that could be used for that. Not sure if in some cases it could be displayed below.
I don't know if other people will complain. We do not know the width needed for info window from popupmenu.c (rendering happens in popupwin.c). So you may end up with small info window above cursor. Can you check how other editors/IDEs handle this situation?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Hm, I was thinking I remember it worked in emacs back in a day, resurrecting it, I am not able to even get the help preview for the candidates with corfu/company modes:
image.png (view on web)—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
I don't know if other people will complain. We do not know the width needed for info window from popupmenu.c (rendering happens in popupwin.c).
I didn't mean to change current layout algorithm completely, I was thinking about if resulting popup window couldn't be showed (not enough horizontal space) or too narrow, it could be repositioned either above or below completion candidates depending on available space.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Or maybe preview could be allowed to overlap popup completion when there is not enough space with possibly an option?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
There’s quite a lot of content in your info window. You could use 'preview' window instead of info popup. It might be worth improving the 'preview' window behavior — for example, automatically choosing whether to display the top or bottom half, or making it easier to dismiss (currently, Ctrl+C
doesn’t close the preview window).
At the moment, the info popup works best when displaying a limited amount of information. Showing it above the cursor only really makes sense when there’s a large amount of content to display. However, since the position is decided before the contents are known — and some LSPs only send the info after an item is selected in the menu — this can lead to awkward positioning.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
I see, let’s close it then.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Closed #18606 as completed.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.