Fix digits pattern

This commit is contained in:
hrsh7th 2021-08-10 19:25:04 +09:00
parent 2dbb474a7e
commit 1864f3950e
2 changed files with 3 additions and 2 deletions

View File

@ -99,7 +99,7 @@ function buffer.index_line(self, i, line)
local s, e = self:matchstrpos(buf) local s, e = self:matchstrpos(buf)
if s then if s then
local word = string.sub(buf, s, e - 1) local word = string.sub(buf, s, e - 1)
if #word > 1 and string.match(word, '%a$') then if #word > 1 and string.match(word, '[%a%d]$') then
table.insert(words, word) table.insert(words, word)
end end
end end

View File

@ -28,11 +28,12 @@ source.complete = function(self, request, callback)
end end
vim.defer_fn(vim.schedule_wrap(function() vim.defer_fn(vim.schedule_wrap(function()
local input = string.sub(request.context.cursor_before_line, request.offset)
local items = {} local items = {}
local words = {} local words = {}
for _, buf in ipairs(self:_get_buffers(request)) do for _, buf in ipairs(self:_get_buffers(request)) do
for _, word in ipairs(buf:get_words()) do for _, word in ipairs(buf:get_words()) do
if not words[word] then if not words[word] and input ~= word then
words[word] = true words[word] = true
table.insert(items, { table.insert(items, {
label = word, label = word,