Improve scoring
This commit is contained in:
@@ -135,8 +135,8 @@ matcher.match = function(input, word, words)
|
|||||||
end
|
end
|
||||||
idx = idx + 1
|
idx = idx + 1
|
||||||
if s > 0 then
|
if s > 0 then
|
||||||
|
s = s * (m.strict_match and 1.2 or 1)
|
||||||
score = score + (s * (1 + math.max(0, matcher.WORD_BOUNDALY_ORDER_FACTOR - (m.index - boundary_fixer)) / matcher.WORD_BOUNDALY_ORDER_FACTOR))
|
score = score + (s * (1 + math.max(0, matcher.WORD_BOUNDALY_ORDER_FACTOR - (m.index - boundary_fixer)) / matcher.WORD_BOUNDALY_ORDER_FACTOR))
|
||||||
score = score + (m.strict_match and 0.1 or 0)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ describe('matcher', function()
|
|||||||
assert.is.truthy(matcher.match('conso', 'console') > matcher.match('conso', 'ConstantSourceNode'))
|
assert.is.truthy(matcher.match('conso', 'console') > matcher.match('conso', 'ConstantSourceNode'))
|
||||||
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'))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('debug', function()
|
it('debug', function()
|
||||||
|
|||||||
Reference in New Issue
Block a user