-
-
Notifications
You must be signed in to change notification settings - Fork 921
[WIP] async pickers take 2 using libuv uv_idle_t #457
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
03ff368 to
c0a2292
Compare
more stuff removed accidental menu stuff added wip cancel stray character
|
Have you checked out |
|
This is so cool! It also introduce a weird sorting animation which I really like 😆 |
|
I thought hey if @elianiva says its cool i give it a try. Home dir And tbh i think we might wanna do something completely different for Edit: Just to clarify that script below ran on current master. local finders = require('telescope.finders')
local make_entry = require('telescope.make_entry')
local pickers = require('telescope.pickers')
local conf = require('telescope.config').values
local scan = require'plenary.scandir'
local files = scan.scan_dir('/home/conni', { hidden = true })
local opts = {}
pickers.new(opts, {
prompt_title = 'Files',
finder = finders.new_table {
results = files,
entry_maker = make_entry.gen_from_file(opts),
},
sorter = conf.generic_sorter(opts),
previewer = conf.file_previewer(opts),
}):find() |
|
When I wrote this pr I wasn't thinking about raw speed. The fact that raw speed improves at all is great. I was more focused on the preemptibility. On master |
|
Oh then i miss understood you :) yes this PR improves on that GJ :D Edit: This can also easily be seen with my proof of concept. 😆 I should have done more testing |
|
I also added a new feature. Since the coroutines can preempt so easily, I have made it so it stops working on the previous prompt when the prompt changes. |
| end | ||
| exe:add(co.create(function(results) | ||
| for _, v in ipairs(results) do | ||
| process_result(v) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing we can do is also check the result of process_result or similar to determine if we should stop the execution.
| previewer = conf.file_previewer(opts), | ||
| }):find() | ||
| end | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can put stuff like this in scratch/ if you want.
|
A plenary pr has superceded this one to be able to have better abstractions for async, then we can focus on using them for telescope |
|
async pickers 3 and then asycn await stuff done now :) |
note: This is a big work in progress. This is my second take to make telescope fully async. This time I am using coroutines and a coroutine scheduler that uses
uv_idle_t.uv_idle_truns something once on each iteration for the libuv event loop. This means we can kind of imitate threads and things will be fully async. It is kind of like telescope has it's own event loop. This is not usable yet as the highlighting doesn't work but otherwise there is great performance, this finally fixes the blocking on find files in my home directory! To fix the highlighting issue we can have a separate 'thread' running that only does highlights, so it doesn't flicker and will highlight correctly. Also, this still doesn't solve the problem of blocking ongrep_stringin my home directory. I think I have found that the bottleneck is theon_stdoutfunction. The picker will lag when opening because of the sheer amount of entries andon_stdoutcalls. I am not sure how to address that as this pr is only for the lagging while typing, not the lagging when adding all the entries when opening the picker.