Skip to content

Make async_scan scan each opened directory asynchronously #240

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

Merged
merged 1 commit into from
Apr 7, 2022

Conversation

mauriciopoppe
Copy link
Contributor

This is an implementation of the comment in #236 (comment), pasting the algorithm for future reference:

local function async_scan(context, callback /* new */)
  for every path in context.paths_to_load
    async_scan(path) ->
        scan.scan_dir_async(parent) -> 
        wait for on_exit callback ->  increase counter and call `callback` when all the paths in context_paths are done

@cseickel
Copy link
Contributor

cseickel commented Apr 5, 2022

Oh cool, you completely dropped plenary's scan_dir from this. I'll give this a try and merge it if there are no problems. I do have a lot of other things up in the air though so this might sit a bit, now that we know this is not the primary slowdown.

@mauriciopoppe mauriciopoppe force-pushed the async-filesystem-scan branch from d184d8a to 5de6130 Compare April 7, 2022 01:53
Previously it was done with a chain (e.g. after the last directory
was scanned another async scan instruction would be issued), instead
all the directories to be scanned are sent to vim.loop.fs_scandir at
the same time, we only continue after all of them complete.
@mauriciopoppe mauriciopoppe force-pushed the async-filesystem-scan branch from 5de6130 to c3f2053 Compare April 7, 2022 02:09
@cseickel
Copy link
Contributor

cseickel commented Apr 7, 2022

Looks good, thanks!

@cseickel cseickel merged commit fcfb55c into nvim-neo-tree:main Apr 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants