plenary.nvim icon indicating copy to clipboard operation
plenary.nvim copied to clipboard

wip: Standardizing pathlib

Open tjdevries opened this issue 3 years ago • 5 comments

tjdevries avatar Apr 01 '21 17:04 tjdevries

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?

oberblastmeister avatar Apr 01 '21 18:04 oberblastmeister

Two options (I'm open to either):

  1. Create sync_ or _sync variants of functions
  2. 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.

tjdevries avatar Apr 02 '21 02:04 tjdevries

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.

oberblastmeister avatar Apr 28 '21 14:04 oberblastmeister

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

Conni2461 avatar Apr 28 '21 15:04 Conni2461

fair enough

oberblastmeister avatar Apr 29 '21 12:04 oberblastmeister