* WIP * WIP * Fix #226 * Insert text * Emulate vim native * テキトウ * Tekito * Move scrollbar impl * aaa * Ignore unexpected event * fix * fix scroll * Refactor (conflict...) * Fix bug * Positive integer * Refactor a bit * Fix for pumheight=0 * fx * Improve matching highlight * Improve colorscheme handling * fmt * Add cmp.visible * Fix pum pos * ABBR_MARGIN * Fix cel calculation * up * refactor * fix * a * a * compat * Remove current completion state * Fix ghost text * Add feature toggle * highlight customization * Update * Add breaking change announcement * Add README.md * Remove unused function * extmark ephemeral ghost text * Support native comp * Fix docs pos * a * Remove if native menu visible * theme async * Improvement idea: option to disables insert on select item (#240) * use ghost text instead of insertion on prev/next item * add disables_insert_on_selection option * move disable_insert_on_select option as argumet on * update README * use an enum behavior to disable insert on select * Adopt contribution * Preselect * Improve * Change configuration option * a * Improve * Improve * Implement proper <C-e> behavior to native/custom * Support <C-c> maybe * Improve docs view * Improve * Avoid syntax leak * TODO: refactor * Fix * Revert win pos * fmt * ghost text remaining * Don't use italic by default * bottom * dedup by label * Ignore events * up * Hacky native view partial support * up * perf * improve * more cache * fmt * Fix format option * fmt * recheck * Fix * Improve * Improve * compat * implement redraw * improve * up * fmt/lint * immediate ghost text * source timeout * up * Support multibyte * disable highlight * up * improve * fmt * fmt * fix * fix * up * up * Use screenpos * Add undojoin check * Fix height * matcher bug * Fix dot-repeat * Remove undojoin * macro * Support dot-repeat * MacroSafe * Default item count is 200 * fmt Co-authored-by: Eric Puentes <eric.puentes@mercadolibre.com.co>
44 lines
2.0 KiB
Lua
44 lines
2.0 KiB
Lua
local spec = require('cmp.utils.spec')
|
|
|
|
local matcher = require('cmp.matcher')
|
|
|
|
describe('matcher', function()
|
|
before_each(spec.before)
|
|
|
|
it('match', function()
|
|
assert.is.truthy(matcher.match('', 'a') >= 1)
|
|
assert.is.truthy(matcher.match('a', 'a') >= 1)
|
|
assert.is.truthy(matcher.match('ab', 'a') == 0)
|
|
assert.is.truthy(matcher.match('ab', 'ab') > matcher.match('ab', 'a_b'))
|
|
assert.is.truthy(matcher.match('ab', 'a_b_c') > matcher.match('ac', 'a_b_c'))
|
|
|
|
assert.is.truthy(matcher.match('bora', 'border-radius') >= 1)
|
|
assert.is.truthy(matcher.match('woroff', 'word_offset') >= 1)
|
|
assert.is.truthy(matcher.match('call', 'call') > matcher.match('call', 'condition_all'))
|
|
assert.is.truthy(matcher.match('Buffer', 'Buffer') > matcher.match('Buffer', 'buffer'))
|
|
assert.is.truthy(matcher.match('fmodify', 'fnamemodify') >= 1)
|
|
assert.is.truthy(matcher.match('candlesingle', 'candle#accept#single') >= 1)
|
|
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('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)
|
|
assert.is.truthy(matcher.match('usela', 'useLayoutEffect') > matcher.match('usela', 'useDataLayer'))
|
|
assert.is.truthy(matcher.match('true', 'v:true', { 'true' }) == matcher.match('true', 'true'))
|
|
assert.is.truthy(matcher.match('g', 'get', { 'get' }) > matcher.match('g', 'dein#get', { 'dein#get' }))
|
|
end)
|
|
|
|
it('debug', function()
|
|
matcher.debug = function(...)
|
|
print(vim.inspect({ ... }))
|
|
end
|
|
-- print(vim.inspect({
|
|
-- a = matcher.match('true', 'v:true', { 'true' }),
|
|
-- b = matcher.match('true', 'true'),
|
|
-- }))
|
|
end)
|
|
end)
|