@@ -47,22 +47,27 @@ M.performComplete = function(complete_source, complete_items_map, params)
4747 -- collect getCompleteItems function of current completion source
4848 for _ , item in ipairs (complete_source .complete_items ) do
4949 -- check isIncomplete for lsp
50+ local complete_items = complete_items_map [item ]
51+ -- special case to handle lsp isIncomplete flag
5052 if item == ' lsp' then
5153 if lsp .isIncomplete then
5254 cache_complete_items = {}
53- end
54- end
55- local complete_items = complete_items_map [item ]
56- if complete_items ~= nil then
57- if complete_items .callback == nil then
58- table.insert (callback_array , true )
59- else
6055 table.insert (callback_array , complete_items .callback )
61- -- TODO: still pass in manager here because there's external sources using it
62- -- will remove it when refactoring aysnc sources
6356 complete_items .trigger (manager , params )
57+ table.insert (items_array , complete_items .item )
58+ end
59+ else
60+ if complete_items ~= nil then
61+ if complete_items .callback == nil then
62+ table.insert (callback_array , true )
63+ else
64+ table.insert (callback_array , complete_items .callback )
65+ -- TODO: still pass in manager here because there's external sources using it
66+ -- will remove it when refactoring aysnc sources
67+ complete_items .trigger (manager , params )
68+ end
69+ table.insert (items_array , complete_items .item )
6470 end
65- table.insert (items_array , complete_items .item )
6671 end
6772 end
6873 if # cache_complete_items == 0 then
@@ -104,9 +109,15 @@ M.performComplete = function(complete_source, complete_items_map, params)
104109 util .sort_completion_items (items )
105110 end
106111 if # items ~= 0 then
112+ local matching_strategy = opt .get_option (" matching_strategy_list" )
113+ -- don't re-trigger complete when exact matching to avoid flickering
107114 -- reset insertChar and handle auto changing source
108115 cache_complete_items = items
109- vim .fn .complete (params .textMatch + 1 , items )
116+ if # matching_strategy == 1 and matching_strategy [1 ] == ' exact' then
117+ return
118+ else
119+ vim .fn .complete (params .textMatch + 1 , items )
120+ end
110121 manager .changeSource = false
111122 else
112123 cache_complete_items = {}
0 commit comments