Skip to content

Commit

Permalink
Merge pull request #43 from lukas-reineke/bug/implement-chunk-size
Browse files Browse the repository at this point in the history
  • Loading branch information
lukas-reineke authored Sep 5, 2022
2 parents 1a7f797 + 5116afe commit 5563196
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lua/cmp-rg/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ source.complete = function(self, request, callback)
end
local seen = {}
local items = {}
local chunk_size = 5

local function on_event(_, data, event)
if event == "stdout" then
Expand Down Expand Up @@ -120,7 +121,10 @@ source.complete = function(self, request, callback)
end
end
end
callback { items = items, isIncomplete = true }
if #items - chunk_size >= chunk_size then
chunk_size = chunk_size * 2
callback { items = items, isIncomplete = true }
end
end

if event == "stderr" and request.option.debug then
Expand Down

0 comments on commit 5563196

Please sign in to comment.