Skip to content

Commit

Permalink
Add cmp.visible
Browse files Browse the repository at this point in the history
  • Loading branch information
hrsh7th committed Sep 21, 2021
1 parent 91ee62b commit bf7930f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lua/cmp/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ cmp.complete = function()
return true
end

---Return view is visible or not.
cmp.visible = function()
return cmp.core.view:visible()
end

---Close current completion
cmp.close = function()
if cmp.core.view:visible() then
Expand Down
3 changes: 3 additions & 0 deletions lua/cmp/matcher_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ describe('matcher', function()
assert.is.truthy(matcher.match('my_', 'my_awesome_variable') > matcher.match('my_', 'completion_matching_strategy_list'))
assert.is.truthy(matcher.match('luacon', 'lua_context') > matcher.match('luacon', 'LuaContext'))
assert.is.truthy(matcher.match('call', 'calc') == 0)

assert.is.truthy(matcher.match('vi', 'void#') >= 1)
assert.is.truthy(matcher.match('vo', 'void#') >= 1)
end)

it('debug', function()
Expand Down

0 comments on commit bf7930f

Please sign in to comment.