-
-
Notifications
You must be signed in to change notification settings - Fork 618
feat: add option to skip gitignored files on git navigation #2583
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
Conversation
lua/nvim-tree/actions/moves/item.lua
Outdated
---@return fun() | ||
function M.fn(where, what) | ||
function M.fn(where, what, opts) |
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.
Moreover, if we all agree, I'd do a little refactor here, having just an opts
table with the where
and what
fields, so that we can easily add new ones if necessary.
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.
Yes please. The API could be altered to pass opts
.
We would need to retain backwards compatibility as per ApiTreeToggleOpts
so as not to break existing users.
If you are sufficiently motivated we could add enums for where and what :)
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.
Unless we release 0.x.x and introduce whatever breaking changes we want for 1.0.
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.
Unless we release 0.x.x and introduce whatever breaking changes we want for 1.0.
Interesting... the highlight overhaul could also go before 1.0.0. Perhaps we might do an audit and do any "final breaks" before the big release.
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, skips nicely:
nowrapscan
- changes before and after
- changes before
- changes after
skip_gitignored
false
just need to get default mappings / API sorted.
lua/nvim-tree/actions/moves/item.lua
Outdated
---@return fun() | ||
function M.fn(where, what) | ||
function M.fn(where, what, opts) |
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.
Unless we release 0.x.x and introduce whatever breaking changes we want for 1.0.
Interesting... the highlight overhaul could also go before 1.0.0. Perhaps we might do an audit and do any "final breaks" before the big release.
What are you thinking about now for API? Maybe:
or even full user control, not quite sure how it would play out:
I'm not the biggest fan of more options... |
Between the two I would go with this one, but I would even prefer to add a separate |
Fair enough; that's more consistent with the current no-arg navigation methods, indeed all of our default mappings. The user wouldn't really gain anything from the extra complication of args. Skip ignored args are also very git specific and any other possible navigation skips would be equally specific. Let's keep it simple. |
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.
Approved following the actual addition to API etc.
We have a couple of choices to address this style issue:
I'd personally go with the latter, but that would introduce an inconsistency with the rest of API entries. However, if we agree on this, I could work on a refactor to make it the standard. It would also greatly improve readability in my opinion... |
It would be much more readable however we are in circular dependency land. API is a big problem.
Do you mean something like Api.node = {
navigate = {
git = {
["next"] = wrap_node(require("nvim-tree.actions.moves.item").fn { where = "next", what = "git" }),
prev = wrap_node(require("nvim-tree.actions.moves.item").fn { where = "prev", what = "git" }),
next_skip_gitignored = wrap_node(require("nvim-tree.actions.moves.item").fn { where = "next", what = "git", skip_gitignored = true }),
prev_skip_gitignored = wrap_node(require("nvim-tree.actions.moves.item").fn { where = "prev", what = "git", skip_gitignored = true }),
},
},
} That would enhance readability. There are a hundred ways we can refactor / split / tidy / lazy bind API however I'm happy enough with a |
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; looking forward to using this one...
Alright, let's merge this way for now.
Well, the |
This would be handy since usually we don't want to focus gitignored files. We have to decide if this option should be local to the function (in this case we would need to add a couple of extra API wrappers, something like
node.navigate.git.next_skip_gitignored
) or if we want it to be global...