Skip to content
This repository was archived by the owner on Oct 13, 2021. It is now read-only.

Commit 567174c

Browse files
committed
fix: completion doesn't get triggered according to the newest keyword(#74)
1 parent ca5e534 commit 567174c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lua/completion/complete.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,12 @@ M.performComplete = function(complete_source, complete_items_map, manager, bufnr
4848
end
4949

5050
local timer = vim.loop.new_timer()
51+
manager.insertChar = false
5152
timer:start(20, 50, vim.schedule_wrap(function()
53+
if manager.insertChar == true and not timer:is_closing() then
54+
timer:stop()
55+
timer:close()
56+
end
5257
-- only perform complete when callback_array are all true
5358
if checkCallback(callback_array) == true and timer:is_closing() == false then
5459
if api.nvim_get_mode()['mode'] == 'i' or api.nvim_get_mode()['mode'] == 'ic' then
@@ -62,7 +67,6 @@ M.performComplete = function(complete_source, complete_items_map, manager, bufnr
6267
if #items ~= 0 then
6368
-- reset insertChar and handle auto changing source
6469
vim.fn.complete(textMatch+1, items)
65-
manager.insertChar = false
6670
manager.changeSource = false
6771
else
6872
manager.changeSource = true

0 commit comments

Comments
 (0)