feat: vendor and clean up plenary#3647
Draft
clason wants to merge 38 commits into
Draft
Conversation
d288d00 to
81463b9
Compare
Contributor
I did make an effort to switch out the custom tree-sitter-lua based docgen for one based off of neovim core several years back. #3227 I can revive this. |
2ca4b60 to
bd0c1ae
Compare
Member
|
Thank you @clason . I almost understood and agreed the changes. I will use this branch and check extensions' behaviors. |
ef0c587 to
9f14788
Compare
ad9b358 to
2c4fbe5
Compare
Breaking change: drop directory preview from file previewer. This was only used by `telescope-file-browser`, which is not actively maintained and arguably out of scope.
Per #3647 (comment): bring back `neoplen.async.uv` with only the wrappers extensions actually depend on. Surveyed against telescope-frecency (draft PR nvim-telescope/telescope-frecency.nvim#343), which uses these 7: fs_stat, fs_open, fs_close, fs_read, fs_write, fs_unlink, fs_realpath. `init.lua` gets a `uv = "neoplen.async.uv_async"` entry so call sites that did `require("neoplen.async").uv.fs_*` keep working unchanged. Adding more wrappers later is a single `add(name, argc)` call. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Thanks, fixed! (And thank you for testing the branch, that goes a long way!) |
This comment was marked as resolved.
This comment was marked as resolved.
Contributor
Author
|
Thanks, fixed! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This started as an
procrastinationinvestigation into what we actually use from Plenary, and which part of it can easily be replaced with current Neovim API. This is obviously not ready to merge yet, but I'm putting this here in the open now that Plenary is going to be archived, in case people want to follow along (and pitch in) as I keep chipping at it.I think I have picked all of the low-hanging fruit, but there's obviously much more to be done. Roughly in order of difficulty:
class.luamodule is only used in the (now renamed)async_jobtelescope module to define a bunch of pipes objects. These should just be created directly, but care is required to adapt the downstream usage.scandir.luais only used in one place: to list files in a directory previewer.As I don't use that myself, I have been hesitant to convert it (should be a straightforward replacement using a variant ofAs far as I can tell, the directory preview is only used in the telescope-file-browser extension, which isn't actively maintained and arguably too far out of scope for a core extension.vim.system('ls'), so that's another nice, self-contained, project).path.luamodule usages are straightforward to replace withvim.fsandvim.fncalls; there's just quite a few of them. But this can be done file by file, so it's a good "fifteen minute project" when someone is bored. A first step could also be is to just replace suitable functions with wrappers of existing (libuv or Nvim ) API and prune then-unused internal functions. EDIT: In particular, the OO wrapper should be removed and replaced by flat string manipulation functions (and moved, if necessary, toutils.lua).strings.luamodule now contains only a few useful utility functions; these could be moved to a stand-alonetelescope.strings. (Except fordedent; that should be replaced.)border.luaandpopup.luacan probably stay, but should be refactored to be a single UI utility module -- possibly moved into thetelescopemodule. (That requires a bit more knowledge about the architecture than I have.) In any case, we don't need a wrapper that is expressly designed to make Nvim floating windows look like Vim popups (just something that makes our life easier).job.luamodule should be replaced byvim.system; again, the deep integration makes this trickier but there should not be much feature disparity that would block this. One could start with refactoring the toputils.luamodule and see where to go from there.async.lua(includingvararg.lua, which is only used there) andlog.luaare probably the biggest modules; these will have to stay for a bit untilvim.asyncandvim.logare done, in which case migrating to those will be a rather big (but necessary) refactor.So the plan for this PR is:
class,path, andscandir.border/popup,job,log,asyncand expose them for extensions.A follow-up PR should rewrite
jobas a thin wrapper overvim.systemand deprecate it (logandasyncwill get the same treatment once the corresponding upstream modules are stable).A couple of notes:
feat/neoplenbranch in your plugin spec.plenary.bustedandtest_harnessmodules are no longer in-tree but moved to an externalplentest.nvimmodule that is a test-only dependency.neoplenexactly so they won't conflict withplenaryinstalled as a dependency for an extension, but they of course will need to adapt in some way if we want to completely remove the dependency. I expect that this will involve a mix of using upstream API (for things likepath) combined with simply pulling in one of the remainingneoplenmodules. This is a bit tricky since I cleaned out modules that are still here, so I have probably removed functions that extensions rely on -- these will have to be added back. @delphinus