plenary.nvim
plenary.nvim copied to clipboard
wip: Standardizing pathlib
What should we do about async vs sync path functions? I remember you saying that we should prefix the sync ones with sync_
. What are your thoughts?
Two options (I'm open to either):
- Create
sync_
or_sync
variants of functions - Allow any function that could be sync/async to have an optional final
callback
parameter that determine whether it will act in sync mode or async mode (libuv style).
Other options might be good as well, haven't thought too much about that part yet.
Now that I think of it I don't think we should be doing sync or async most often. The only times where we would is when we have to use libuv and it relates to paths, for example Path:exists
or Path:is_file
. Other stuff like Path:read
or Path:write
I think we should remove from this library is it has nothing to do with paths. Instead we should put them in a fs
library which makes a lot more sense. The functions also don't necessarily have to take paths, they should be able to take strings for example.
plenary.path follows pathlib and read
write
is present there. Doesn't make sense to change it now after we stated that we somewhat follow pathlib. https://github.com/nvim-lua/plenary.nvim#plenarypath
fair enough