import { popup_menu } from "https://deno.land/x/denops_std@v6.3.0/function/vim/mod.ts";
Show the {what} near the cursor, handle selecting one of the items with cursorkeys, and close it an item is selected with Space or Enter. {what} should have multiple lines to make this useful. This works like:
call popup_create({what}, #{
\ pos: 'center',
\ zindex: 200,
\ drag: 1,
\ wrap: 0,
\ border: [],
\ cursorline: 1,
\ padding: [0,1,0,1],
\ filter: 'popup_filter_menu',
\ mapping: 0,
\ })
The current line is highlighted with a match using "PopupSelected", or "PmenuSel" if that is not defined.
Use {options} to change the properties. Should at least set "callback" to a function that handles the selected item. Example:
func ColorSelected(id, result)
" use a:result
endfunc
call popup_menu(['red', 'green', 'blue'], #{
\ callback: 'ColorSelected',
\ })
Can also be used as a method
:
GetChoices()->popup_menu({})