From c57969580d63fafe9edc8589e66cb5e08387d4d2 Mon Sep 17 00:00:00 2001 From: hrsh7th Date: Tue, 19 Oct 2021 14:38:10 +0900 Subject: [PATCH] Fix #374 --- lua/cmp/matcher_spec.lua | 1 + lua/cmp/utils/char.lua | 3 +++ 2 files changed, 4 insertions(+) diff --git a/lua/cmp/matcher_spec.lua b/lua/cmp/matcher_spec.lua index 65ac89c..1f8b0d1 100644 --- a/lua/cmp/matcher_spec.lua +++ b/lua/cmp/matcher_spec.lua @@ -29,6 +29,7 @@ describe('matcher', function() 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' })) + assert.is.truthy(matcher.match('2', '[[2021') >= 1) end) it('debug', function() diff --git a/lua/cmp/utils/char.lua b/lua/cmp/utils/char.lua index fa85fdd..12a1809 100644 --- a/lua/cmp/utils/char.lua +++ b/lua/cmp/utils/char.lua @@ -82,6 +82,9 @@ char.is_semantic_index = function(text, index) if not char.is_alpha(prev) and char.is_alpha(curr) then return true end + if not char.is_digit(prev) and char.is_digit(curr) then + return true + end return false end