summaryrefslogtreecommitdiff
path: root/lua/telescope/entry_manager.lua
diff options
context:
space:
mode:
authorTJ DeVries <devries.timothyj@gmail.com>2021-08-20 11:11:24 -0400
committerGitHub <noreply@github.com>2021-08-20 11:11:24 -0400
commita97af306c4e9c9a6fa7c886c0ffe3079822c5203 (patch)
treef5e2b50a767e93618d0d8fdddb8a964c90633c8a /lua/telescope/entry_manager.lua
parentd6d28dbe324de9826a579155076873888169ba0f (diff)
feat(performance): Major performance improvements using async v2 from @oberblastmeister (#987)
* start: Working w/ async jobs * short circuit to using bad finder if you pass writer.
Diffstat (limited to 'lua/telescope/entry_manager.lua')
-rw-r--r--lua/telescope/entry_manager.lua15
1 files changed, 10 insertions, 5 deletions
diff --git a/lua/telescope/entry_manager.lua b/lua/telescope/entry_manager.lua
index ff8b9ba..5055171 100644
--- a/lua/telescope/entry_manager.lua
+++ b/lua/telescope/entry_manager.lua
@@ -155,7 +155,10 @@ function EntryManager:add_entry(picker, score, entry)
info.looped = info.looped + 1
if container[2] > score then
- -- print("Inserting: ", picker, index, node, new_container)
+ return self:_insert_container_before(picker, index, node, new_container)
+ end
+
+ if score < 1 and container[2] == score and #entry.ordinal < #container[1].ordinal then
return self:_insert_container_before(picker, index, node, new_container)
end
@@ -174,11 +177,13 @@ function EntryManager:add_entry(picker, score, entry)
end
function EntryManager:iter()
- return coroutine.wrap(function()
- for val in self.linked_states:iter() do
- coroutine.yield(val[1])
+ local iterator = self.linked_states:iter()
+ return function()
+ local val = iterator()
+ if val then
+ return val[1]
end
- end)
+ end
end
return EntryManager