Skip to content

Commit

Permalink
Add ddu#ui#get_items()
Browse files Browse the repository at this point in the history
  • Loading branch information
Shougo committed Jun 20, 2023
1 parent 53f1d5e commit a795aaf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
18 changes: 12 additions & 6 deletions autoload/ddu/ui.vim
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,26 @@ function ddu#ui#multi_actions(actions) abort
endfor
endfunction

function ddu#ui#get_item() abort
call ddu#ui_sync_action(get(b:, 'ddu_ui_name', ''), 'getItem', {})
function ddu#ui#get_item(name=get(b:, 'ddu_ui_name', '')) abort
call ddu#ui_sync_action(a:name, 'getItem', {})
return b:->get('ddu_ui_item', {})
endfunction

function ddu#ui#get_selected_items() abort
call ddu#ui_sync_action(get(b:, 'ddu_ui_name', ''), 'getSelectedItems', {})
function ddu#ui#get_items(name=get(b:, 'ddu_ui_name', '')) abort
call ddu#ui_sync_action(a:name, 'getItems', {})
return b:->get('ddu_ui_items', {})
endfunction

function ddu#ui#get_selected_items(name=get(b:, 'ddu_ui_name', '')) abort
call ddu#ui_sync_action(a:name, 'getSelectedItems', {})
return b:->get('ddu_ui_selected_items', [])
endfunction

function ddu#ui#visible(name, tabnr = tabpagenr()) abort
function ddu#ui#visible(
\ name=get(b:, 'ddu_ui_name', ''), tabnr = tabpagenr()) abort
return ddu#_request('uiVisible', [a:name, a:tabnr])
endfunction

function ddu#ui#winid(name) abort
function ddu#ui#winid(name=get(b:, 'ddu_ui_name', '')) abort
return ddu#_request('uiWinid', [a:name])
endfunction
6 changes: 6 additions & 0 deletions doc/ddu.txt
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,12 @@ ddu#ui#get_item()
buffer UI.
NOTE: current UI must support "getItem" action.

*ddu#ui#get_items()*
ddu#ui#get_items()
Return the current items as |Dictionary| from current buffer
UI.
NOTE: current UI must support "getItems" action.

*ddu#ui#get_selected_items()*
ddu#ui#get_selected_items()
Return the selected items as |List| of |Dictionary| from
Expand Down

0 comments on commit a795aaf

Please sign in to comment.