Closed pysan3 closed 8 months ago
I've fixed the docs to show the correct return type, thanks for pointing out!
Since there is no asynchronous version of fs_scandir_next
, there's no way to provide an interface to it except just having nio.uv.fs_scandir_next = vim.loop.fs_scandir_next
which I don't like as it is misleading and users may think it's async.
I see. Thank you for your response.
So that means that I should pass the returned handler from nio.uv.fs_scandir
into vim.loop.fs_scandir_next
right?
If that's the case, how about returning uv_fs_t
(defined here), instead of defining a custom type name (nio.uv.FsT
(what does this mean in the first place?))?
So that means that I should pass the returned handler from nio.uv.fs_scandir into vim.loop.fs_scandir_next right?
Correct :+1:
If that's the case, how about returning uv_fs_t (defined here), instead of defining a custom type name (nio.uv.FsT
Ah I hadn't realised that those types existed, they didn't when I originally wrote the wrapper :sweat_smile: I've switched all of the type annotations to use the neodev types.
If that's the case, how about returning uv_fs_t (defined here), instead of defining a custom type name (nio.uv.FsT
Ah I hadn't realised that those types existed, they didn't when I originally wrote the wrapper 😅 I've switched all of the type annotations to use the neodev types.
Nice! Ok then please close this issue when you added those neodev types.
If that's the case, how about returning uv_fs_t (defined here), instead of defining a custom type name (nio.uv.FsT
Ah I hadn't realised that those types existed, they didn't when I originally wrote the wrapper 😅 I've switched all of the type annotations to use the neodev types.
Nice! Ok then please close this issue when you added those neodev types.
Close with https://github.com/nvim-neotest/nvim-nio/commit/48413f4460b1fe2b1efb134b0a5d13e0619bd0bd
Thanks @rcarriga !
NeoVim Version
Describe the bug The type definition says that
nio.uv.fs_scandir
returnsnio.uv.DirEntry[]
(which is correct in libc) but the lua implementation returns auv_fs_t
which is a handler that should be passed tovim.loop.fs_scandir_next
which gives the next unscanned entry in the directory.The help page of
vim.loop
states as follows.To Reproduce
Expected behavior
nio.uv.fs_scandir
.vim.loop.fs_scandir_next
.Alternatively, if
nio.uv.fs_scandir
returned anIterator<nio.uv.DirEntry>
by resolvingfs_scandir_next
internally and returning an iterator, it will be very useful and will remove much boilerplate.