Add option for symbol matching logic. (#1515)
The no_symbol_match makes command line completion a lot less useful. It disables any matches for file names with symbols in them. This prevents completing things like ":b foo/bar" to ":b foo/bar.txt" or ":b foo_" to ":b baz/foo_bar.txt". Add an option `disallow_symbol_nonprefix_matching` that prevents a match if it contains a symbol and isn't a prefix match. Make that option the default. Add the option to documentation and tests. Add to the examples for command line setup disabling the option.
This commit is contained in:
@@ -49,6 +49,7 @@ describe('matcher', function()
|
||||
disallow_partial_matching = false,
|
||||
disallow_prefix_unmatching = false,
|
||||
disallow_partial_fuzzy_matching = false,
|
||||
disallow_symbol_nonprefix_matching = true,
|
||||
})
|
||||
assert.is.truthy(score >= 1)
|
||||
assert.equals(matches[1].word_match_start, 5)
|
||||
@@ -58,6 +59,7 @@ describe('matcher', function()
|
||||
disallow_partial_matching = false,
|
||||
disallow_prefix_unmatching = false,
|
||||
disallow_partial_fuzzy_matching = true,
|
||||
disallow_symbol_nonprefix_matching = true,
|
||||
})
|
||||
assert.is.truthy(score == 0)
|
||||
end)
|
||||
@@ -84,6 +86,11 @@ describe('matcher', function()
|
||||
assert.is.truthy(matcher.match('bar', 'foo_bar', { disallow_prefix_unmatching = false }) >= 1)
|
||||
end)
|
||||
|
||||
it('disallow_symbol_nonprefix_matching', function()
|
||||
assert.is.truthy(matcher.match('foo_', 'b foo_bar', { disallow_symbol_nonprefix_matching = true }) == 0)
|
||||
assert.is.truthy(matcher.match('foo_', 'b foo_bar', { disallow_symbol_nonprefix_matching = false }) >= 1)
|
||||
end)
|
||||
|
||||
it('debug', function()
|
||||
matcher.debug = function(...)
|
||||
print(vim.inspect({ ... }))
|
||||
|
||||
Reference in New Issue
Block a user