Skip to content

Commit

Permalink
feat: add is_(menu|documentation|ghost_text)_visible functions
Browse files Browse the repository at this point in the history
Closes #995
  • Loading branch information
Saghen committed Jan 12, 2025
1 parent 996aba4 commit 8d29e0e
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions lua/blink/cmp/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,21 @@ end

------- Public API -------

--- Checks if the completion menu is currently visible
--- Checks if the completion menu or ghost text is visible
--- @return boolean
function cmp.is_visible()
return require('blink.cmp.completion.windows.menu').win:is_open()
or require('blink.cmp.completion.windows.ghost_text').is_open()
end
function cmp.is_visible() return cmp.is_menu_visible() or cmp.is_ghost_text_visible() end

--- Checks if the completion menu is visible
--- @return boolean
function cmp.is_menu_visible() return require('blink.cmp.completion.windows.menu').win:is_open() end

--- Checks if the ghost text is visible
--- @return boolean
function cmp.is_ghost_text_visible() return require('blink.cmp.completion.windows.ghost_text').is_open() end

--- Checks if the documentation window is visible
--- @return boolean
function cmp.is_documentation_visible() return require('blink.cmp.completion.windows.documentation').win:is_open() end

--- Show the completion window
--- @params opts? { providers?: string[], callback?: fun() }
Expand Down

0 comments on commit 8d29e0e

Please sign in to comment.