Fix fuzzy match bug

This commit is contained in:
hrsh7th
2021-08-08 17:37:02 +09:00
parent efed43377b
commit cb67fe9093
2 changed files with 3 additions and 4 deletions

View File

@@ -187,7 +187,7 @@ matcher.fuzzy = function(input, word, matches)
end end
word_offset = word_offset + 1 word_offset = word_offset + 1
end end
if input_index >= #input then if input_index > #input then
return true return true
end end
return false return false

View File

@@ -22,14 +22,13 @@ describe('matcher', function()
assert.is.truthy(matcher.match('var_', 'var_dump') >= 1) assert.is.truthy(matcher.match('var_', 'var_dump') >= 1)
assert.is.truthy(matcher.match('my_', 'my_awesome_variable') > matcher.match('my_', 'completion_matching_strategy_list')) 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('luacon', 'lua_context') > matcher.match('luacon', 'LuaContext'))
assert.is.truthy(matcher.match('call', 'calc') == 0)
end) end)
it('debug', function() it('debug', function()
assert.is.truthy(true)
matcher.debug = function(...) matcher.debug = function(...)
print(vim.inspect({ ... })) print(vim.inspect({ ... }))
end end
print('score', matcher.match('vsnipnextjump', 'vsnip-jump-next')) -- print('score', matcher.match('vsnipnextjump', 'vsnip-jump-next'))
end) end)
end) end)