Skip to content

Commit

Permalink
feat: add function to check if menu is open
Browse files Browse the repository at this point in the history
  • Loading branch information
max397574 committed Jun 8, 2024
1 parent 41691b3 commit 78800f1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/menu.norg
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ version: 1.1.1
---@field open_win fun(self: neocomplete.menu): nil
@end

** Is open
#tangle
@code lua
--- Opens window for the menu
---@field is_open fun(self: neocomplete.menu): boolean
@end

** Select next
#tangle
Expand Down
4 changes: 4 additions & 0 deletions lua/neocomplete/menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -277,4 +277,8 @@ function Menu:confirm()
self:close()
end

function Menu:is_open()
return self.winnr ~= nil
end

return Menu
1 change: 1 addition & 0 deletions lua/neocomplete/types/menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
---@field draw fun(self: neocomplete.menu): nil
--- Opens window for the menu
---@field open_win fun(self: neocomplete.menu): nil
---@field is_open fun(self: neocomplete.menu): boolean
--- Select next entry in menu
---@field select_next fun(self: neocomplete.menu, count: integer): nil
--- Select previous entry in menu
Expand Down

0 comments on commit 78800f1

Please sign in to comment.