Skip to content

Commit

Permalink
feat(coc#pum#has_item_selected)
Browse files Browse the repository at this point in the history
This commit add a function to check if there is a item selected in
completion list.

Solve neoclide#5063.
  • Loading branch information
Kaiser-Yang committed Jun 28, 2024
1 parent bdfd169 commit ea3b23f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions autoload/coc/pum.vim
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ if s:is_vim
endif
endif

function! coc#pum#has_item_selected() abort
if s:pum_winid == -1
return 0
endif
return s:pum_index != -1
endfunction

function! coc#pum#visible() abort
if s:pum_winid == -1
return 0
Expand Down
5 changes: 5 additions & 0 deletions doc/coc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2171,6 +2171,11 @@ coc#pum#visible() *coc#pum#visible()*
Check if customized popupmenu is visible like |pumvisible()| does.
Return 1 when popup menu is visible.

coc#pum#has_item_selected() *coc#pum#has_item_selected*

Check if there is a completion item selected in the popup menu.
Return 1 when there has been a completion item selected.

coc#pum#next({insert}) *coc#pum#next()*

Select next item of customized popupmenu, insert word when {insert} is
Expand Down

0 comments on commit ea3b23f

Please sign in to comment.