feat(view): add api get_selected_index (#1986)

This commit is contained in:
NAKAI Tsuyoshi
2024-07-16 01:29:25 +09:00
committed by GitHub
parent 7e348da6e5
commit e1757aea61
5 changed files with 36 additions and 5 deletions

View File

@@ -88,6 +88,12 @@ cmp.visible = cmp.sync(function()
return cmp.core.view:visible() or vim.fn.pumvisible() == 1
end)
---Get what number candidates are currently selected.
---If not selected, nil is returned.
cmp.get_selected_index = cmp.sync(function()
return cmp.core.view:get_selected_index()
end)
---Get current selected entry or nil
cmp.get_selected_entry = cmp.sync(function()
return cmp.core.view:get_selected_entry()