Improve incomplete handling
This commit is contained in:
@@ -222,7 +222,7 @@ core.complete = function(self, ctx)
|
|||||||
end
|
end
|
||||||
self:set_context(ctx)
|
self:set_context(ctx)
|
||||||
|
|
||||||
for _, s in ipairs(self:get_sources({ source.SourceStatus.WAITING, source.SourceStatus.COMPLETED })) do
|
for _, s in ipairs(self:get_sources()) do
|
||||||
local callback
|
local callback
|
||||||
callback = (function(s_)
|
callback = (function(s_)
|
||||||
return function()
|
return function()
|
||||||
@@ -230,17 +230,17 @@ core.complete = function(self, ctx)
|
|||||||
if s_.incomplete and new:changed(s_.context) then
|
if s_.incomplete and new:changed(s_.context) then
|
||||||
s_:complete(new, callback)
|
s_:complete(new, callback)
|
||||||
else
|
else
|
||||||
for _, s__ in ipairs(self:get_sources({ source.SourceStatus.FETCHING })) do
|
for _, s__ in ipairs(self:get_sources({ source.SourceStatus.FETCHING })) do
|
||||||
if s_ == s__ then
|
if s_ == s__ then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
if not s__.incomplete and SOURCE_TIMEOUT > s__:get_fetching_time() then
|
if not s__.incomplete and SOURCE_TIMEOUT > s__:get_fetching_time() then
|
||||||
return
|
return
|
||||||
end
|
|
||||||
end
|
end
|
||||||
self.filter.timeout = self.view:visible() and THROTTLE_TIME or 0
|
|
||||||
self:filter()
|
|
||||||
end
|
end
|
||||||
|
self.filter.timeout = self.view:visible() and THROTTLE_TIME or 0
|
||||||
|
self:filter()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end)(s)
|
end)(s)
|
||||||
s:complete(ctx, callback)
|
s:complete(ctx, callback)
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ source.complete = function(self, ctx, callback)
|
|||||||
}
|
}
|
||||||
elseif ctx:get_reason() ~= types.cmp.ContextReason.TriggerOnly then
|
elseif ctx:get_reason() ~= types.cmp.ContextReason.TriggerOnly then
|
||||||
if self:get_keyword_length() <= (ctx.cursor.col - offset) then
|
if self:get_keyword_length() <= (ctx.cursor.col - offset) then
|
||||||
if self.incomplete and self.context.cursor.col ~= ctx.cursor.col then
|
if self.incomplete and self.context.cursor.col ~= ctx.cursor.col and self.status ~= source.SourceStatus.FETCHING then
|
||||||
completion_context = {
|
completion_context = {
|
||||||
triggerKind = types.lsp.CompletionTriggerKind.TriggerForIncompleteCompletions,
|
triggerKind = types.lsp.CompletionTriggerKind.TriggerForIncompleteCompletions,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user