@@ -47,22 +47,27 @@ M.performComplete = function(complete_source, complete_items_map, params)
47
47
-- collect getCompleteItems function of current completion source
48
48
for _ , item in ipairs (complete_source .complete_items ) do
49
49
-- check isIncomplete for lsp
50
+ local complete_items = complete_items_map [item ]
51
+ -- special case to handle lsp isIncomplete flag
50
52
if item == ' lsp' then
51
53
if lsp .isIncomplete then
52
54
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
60
55
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
63
56
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 )
64
70
end
65
- table.insert (items_array , complete_items .item )
66
71
end
67
72
end
68
73
if # cache_complete_items == 0 then
@@ -104,9 +109,15 @@ M.performComplete = function(complete_source, complete_items_map, params)
104
109
util .sort_completion_items (items )
105
110
end
106
111
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
107
114
-- reset insertChar and handle auto changing source
108
115
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
110
121
manager .changeSource = false
111
122
else
112
123
cache_complete_items = {}
0 commit comments