diff --git a/lua/cmp/init.lua b/lua/cmp/init.lua index 8d7d69d7d..62cfd468a 100644 --- a/lua/cmp/init.lua +++ b/lua/cmp/init.lua @@ -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 diff --git a/lua/cmp/matcher_spec.lua b/lua/cmp/matcher_spec.lua index 8bc5e15e8..cef81c070 100644 --- a/lua/cmp/matcher_spec.lua +++ b/lua/cmp/matcher_spec.lua @@ -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()