-
-
Notifications
You must be signed in to change notification settings - Fork 609
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
feat(#1389): add recurse opt for git and diag moves #2525
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 great! I've been wanting this for a long time...
Works beautifully:
- one deep
- many deep
- deltas at multiple levels
-
group_empty = true
-
show_on_dirs = true
show_on_open_dirs = false
Except for:
-
show_on_dirs = false
- does not recurse
@alex-courtis This cannot work with |
I see. It looks like we have a short-circuit to not retrieve git status on folders:
That's OK; we can remove that one: git status is now very cheap and will likely be fetched at some point. |
My previous commit defines a new
I was able to map these next moves with the recurse opt like so: vim.keymap.set('n', ']e', function() api.node.navigate.diagnostics.next({recurse=true}) end, opts('Next Diagnostic'))
vim.keymap.set('n', ']c', function() api.node.navigate.git.next({recurse=true}) end, opts('Next Git')) It this the way you suggested it to be @alex-courtis? |
Fantastic! I'll review and test this one next weekend. |
I'm completely fine with that: there are many factors at play with diagnostics, which are usually quite lazy. Git is always known. We could try and tweak if it becomes a problem. |
Many thanks for looking into that one; YAGNI |
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.
Looking good; all the pieces are there and work, just needs API tidy.
Many thanks for all your work on this one and apologies for lacking the time to review.
@alex-courtis Should be good now. |
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 - change is well contained with a very small blast radius.
Same test results as #2525 (review)
Is it intended for this functionality to work when show_on_dirs = false
? Did you look at always retrieving git status as per #2525 (comment) ?
If we don't intend it to work we could:
- document the limitation
- document the fallback behaviour
-
show_on_dirs = false
- missing prevs
- minor nits
@alex-courtis No, it will not work when Retrieving the git status for a directory when |
No worries. I will hold you to that ;) |
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 great, it's working exactly as advertised.
However, we should still implement the prev use cases. They will inevitably be requested as soon as users discover this new functionality, which will be surprisingly quick.
I'm not seeing any reason why we can't do that with move_next_recursive
- it's quite comprehensive.
Also... merge conflicts, sorry.
The recurse opt can be used to directly go to the next item showing git/diagnostic status recursively. Signed-off-by: Antonin Godard <[email protected]>
Rename get_status to status_is_valid. Use status_is_valid function in multiple place to avoid duplicating code. Signed-off-by: Antonin Godard <[email protected]>
Signed-off-by: Antonin Godard <[email protected]>
The root node cannot have a status. Previously if moving from the root node, status_is_valid was trying to fetch the status from it and errored. Signed-off-by: Antonin Godard <[email protected]>
Hi @alex-courtis, here are 4 commits implementing next and prev recursive moves as discussed. |
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.
Everything works and is documented, great job!
- move to utils.lua
- remove limitation from diagnostics help
Signed-off-by: Antonin Godard <[email protected]>
Signed-off-by: Antonin Godard <[email protected]>
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.
Working nicely, many thanks for all your work.
Changing my git bindings now :)
…2525) * feat(#1389): add next recursive for git and diag moves The recurse opt can be used to directly go to the next item showing git/diagnostic status recursively. Signed-off-by: Antonin Godard <[email protected]> * refactor: status logic in single function Rename get_status to status_is_valid. Use status_is_valid function in multiple place to avoid duplicating code. Signed-off-by: Antonin Godard <[email protected]> * feat(#1389): add prev recursive for git and diag moves Signed-off-by: Antonin Godard <[email protected]> * fix(#1389): next recursive: take root node into account The root node cannot have a status. Previously if moving from the root node, status_is_valid was trying to fetch the status from it and errored. Signed-off-by: Antonin Godard <[email protected]> * fix(#1389): doc: remove show_on_open_dirs limitation Signed-off-by: Antonin Godard <[email protected]> * feat(#1389): move find_node_line to utils Signed-off-by: Antonin Godard <[email protected]> * feat(#1389): doc: note recursive moves are to files only, tidy --------- Signed-off-by: Antonin Godard <[email protected]> Co-authored-by: Alexander Courtis <[email protected]>
Would like having comments on this feature that I personally find useful. This solves the initial problem stated in #1389, I think. Also works when
nvim-tree.git.show_on_dirs
ornvim-tree.git.show_on_open_dirs
are set totrue
/false
.