feat(ui): use builtin completion popupmenu with ext_cmdline (#31269)

Problem:  UIs implementing ext_cmdline/message must also implement
          ext_popupmenu in order to get cmdline completion with
          wildoptions+=pum.
Solution: Allow marking a window as the ext_cmdline window through
          nvim_open_win(), including prompt offset. Anchor the cmdline-
          completion popupmenu to this window.
This commit is contained in:
luukvbaal
2025-04-29 15:55:00 +02:00
committed by GitHub
parent 9bbbeb60e3
commit 08c484f2ca
11 changed files with 159 additions and 43 deletions

View File

@@ -1771,8 +1771,7 @@ function vim.api.nvim_open_term(buffer, opts) end
--- - `row=0` and `col=0` if `anchor` is "SW" or "SE"
--- (thus like a tooltip near the buffer text).
--- - row: Row position in units of "screen cell height", may be fractional.
--- - col: Column position in units of "screen cell width", may be
--- fractional.
--- - col: Column position in units of screen cell width, may be fractional.
--- - focusable: Enable focus by user actions (wincmds, mouse events).
--- Defaults to true. Non-focusable windows can be entered by
--- `nvim_set_current_win()`, or, when the `mouse` field is set to true,
@@ -1852,6 +1851,8 @@ function vim.api.nvim_open_term(buffer, opts) end
--- focused on it.
--- - vertical: Split vertically `:vertical`.
--- - split: Split direction: "left", "right", "above", "below".
--- - _cmdline_offset: (EXPERIMENTAL) When provided, anchor the `cmdline-completion`
--- popupmenu to this window, with an offset in screen cell width.
--- @return integer # |window-ID|, or 0 on error
function vim.api.nvim_open_win(buffer, enter, config) end