-
-
Notifications
You must be signed in to change notification settings - Fork 638
refactor(#2988): multi instance change_dir and dir_up #3209
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking great, really happy with your contributions and it's working as per current behaviour.
Please:
- Remove unused file
- Remove unused variable
- Fix change dir node wrapper
- Change incorrect require
- Move
change_dirto an instance member * - Change inline require to file level
- Remove unnecessary require *
The ones marked with a * will just go away if we move further with this refactor; see incoming comment.
| local M = {} | ||
|
|
||
| ---@param node Node | ||
| function M.fn(node) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function has been moved to Explorer:dir_up and it's working beautifully there.
This is great as this function is now unused, therefore we can delete this whole file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this file is still present.
You might have to git rm lua/nvim-tree/explorer/dir-up.lua
Edit: I am mistaken, I was thinking of the old file location.
Edit2: this stands: we really don't need this file and it should be removed.
lua/nvim-tree/explorer/init.lua
Outdated
| end | ||
| end | ||
|
|
||
| Explorer.change_dir = change_dir |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explorer.change_dir is assigned to the Explorer class, instead of the instance. This isn't great as all Explorer instances will share the same change_dir.
It should be set to the instance during the constructor e.g. self.change_dir = ...
|
Testing with Success: Base CasesOpen
Fail:
|
|
This is great, I'm happy to merge (following fixes) OR we can go further in this pull request OR go further in the next pull request. You've refactored the If you're keen we can do the same for ALL the What's the advantage? The code will simplify greatly when they are part of the explorer class:
|
change_dir and dir_up to the Explorer class|
FYI you can execute all the CI checks locally so that you don't have to wait for CI. Once you've merged this PR I can add you as a repo member so that you can run CI checks yourself. |
|
@alex-courtis hope you doing well, thanks for your time, I will be making this changes by saturday and also following all other instructions and comments you left. |
There's no rush; we can take all the time we want. |
|
@alex-courtis how is it hanging? sorry for disappearing, I just have been through some personal problems that's why I was unable to proceed on the they I mentioned. On the weekend I will spending some time on it. |
|
This PR was updated to meet the required changes of the last review:
Originally posted by @alex-courtis in #3209 (review) |
|
@alex-courtis are you there? |
Fantastic! I've run CI and there are a couple of issues requiring attention: https://github.com/nvim-tree/nvim-tree.lua/actions/runs/19577377412/job/56496916252?pr=3209
I should get to this review on the weekend. |
- Use wrap_explorer for change_root_to_parent to match other API methods - Fix incorrect require paths in dir-up.lua (remove "lua." prefix) - Remove unused explorer variable in change-dir.lua - Move change_dir assignment in Explorer:new before _load call - Add find_file require to explorer/init.lua for dir_up method
…/nvim-tree.lua into refactor-explorer-actions
I Just solved this but pre commit checks wouldn't let em commit, and I didn't noticed that I just ended up committing it right now successfully. I yes I know the nvim-tree contributors a volunteers my bad be a little be annoying for yourselves. |
Test CasesChange Dir DownOpen
Exception thrown: |
That occurs for github security reasons. You will be able to run checks after you have merged your first PR. |
alex-courtis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good, your style has visibly improved since last review.
Please:
- Decide upon splitting this PR: https://github.com/nvim-tree/nvim-tree.lua/pull/3209/files#r2572775780
- Resolve the runtime exception #3209 (comment)
- Revert unrelated changes https://github.com/nvim-tree/nvim-tree.lua/pull/3209/files#r2572770381
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't make unnecessary changes.
| ---@field opts table user options | ||
| ---@field augroup_id integer | ||
| ---@field renderer Renderer | ||
| ---@field change_dir any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still isn't quite right: we're assigning the static change_dir module to a member field on the Explorer class. In this class we are directly calling the module change_dir directly, instead of via the member, which is the right way to use a static module.
We're stuck at a half way point in the refactor of change dir. The outcome of this issue is to have all of change dir moved into the Explorer class as methods. You've achieved this nicely for Explorer:dir_up.
Decision time:
Option 1:
- complete both refactors, moving everything from change-dir.lua into Explorer
Option 2:
- revert the change-dir changes
- merge the dir-up changes
- create a follow up PR for change-dir
This is my fault: I said "It might be easiest to split into two PRs." where I should have said "complete these changes in two PRs"
I strongly recommend option 2.
The first few multiinstance refactor PRs were done in single PRs; we started doing many refactors in one PR only after we were practiced.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your review once again, I quickly follow instructions and update the PR.
fixes #2988
This PR is part of one of the Multi Instance tasks and aims to make a refactor moving the root actions
change_diranddir_upto theExplorerclass.PS: This is my first contribution to some nvim plugin, I've using nvim for almost 4-5 months now and become interested in getting involved into its Open source world.