-
-
Notifications
You must be signed in to change notification settings - Fork 93
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
Focus on correct entry #104
Comments
I'd generally be happy to enable these sorts of things, but it's very difficult to do so ergonomically with the async nature of pickers. #78 (comment) elaborates what I mean as virtually the same problem arises. Generally speaking, it's achievable right now, but you essentially need The below works if set right below current_picker:register_completion_callback(function()
local selection_index = find_entry(current_picker, file.filename)
vim.defer_fn(function() current_picker:set_selection(current_picker:get_row(selection_index)) end, 10)
local num_cb = #current_picker._completion_callbacks
current_picker._completion_callbacks[num_cb] = nil
end) where While the above function works, it feels like quite a callback rabbit hole. What I would like much more is if we could synchronize the picker refresh. That would allow for a lot of these things to become a breeze and combine it with a lot of other things as mentioned in the above referenced issue. |
Ok, I'm working a bit more on file browser today and finally have properly understood why we have issues here. It's quite funny. In some sections, we maybe overcautiously reset the prompt as well. Unfortunately, this essentially causes the finder loop to be triggered twice (telescope too fast brr), which clears completion callbacks like above prematurely. Not sure whether that should be solved upstream. cc @Conni2461 just for general awareness that resetting prompt in |
I've seen this behavior when working on refresh but could not figure out why, i'll open an issue and try to figure it out at some point :) |
Do you have a recommendation for how to reproduce this behavior on the configuration side (as opposed to making the above modification to a fork)? Happy to help implement in this repo if you think it's still straightforward or feasible regardless, another vote for this functionality. I'm using this plugin as a replacement for ranger within neovim, and I often find myself exploring file hierarchies by going up, realizing I went too far, then needing to go back down, etc. Having the selection after |
Just to align, you are referring to
Yes, I'd say this is now straightforward / feasible after fixing this upstream and happy to accept a PR for this. We'd need an option essentially here telescope-file-browser.nvim/lua/telescope/_extensions/file_browser/config.lua Lines 47 to 80 in b1bc53e
that enables a selection callback pretty much like when a file is created, like here telescope-file-browser.nvim/lua/telescope/_extensions/file_browser/actions.lua Lines 99 to 115 in b1bc53e
The way this selection callback works conceptually:
PR very welcome :) I hope the above is sufficient guidance to get you started, let me know if you are interested to work on this and would need further guidance etc. |
Finally getting back to this, sorry for the delay 😬 I appreciate the detailed pointers, definitely helped. I got something working locally in my own branch in this PR (3-liner, super simple): #193 Some quick questions: When you say
you mean such that we can let users opt in/out of this behavior? or are you referring to an additional param of some sort? Also, is the first Can take discussion to PR as well, if that's preferable |
After removing a file or directory, the focus jumps to the bottom for me. Should I make a new issue out of this? |
Yes please so we can pin down the actual issue. I'll review the selection callbacks as part of tree feature + large RFC in #210 anyways and so would be good to know what to look out for. |
any luck? its 2024-04-28 |
Considering the following cases:
The text was updated successfully, but these errors were encountered: