Select snacks picker element based on cursor position#458
Select snacks picker element based on cursor position#458stevearc merged 3 commits intostevearc:masterfrom
Conversation
lua/aerial/snacks.lua
Outdated
| local closest_or_exact_symbol = bufdata.positions[bufdata.last_win].exact_symbol or bufdata.positions[bufdata.last_win].closest_symbol | ||
| local currentIdx = closest_or_exact_symbol.idx | ||
| picker.list.cursor = currentIdx |
There was a problem hiding this comment.
I'd prefer to do this the way we do for telescope, where we determine the selected index while iterating over symbols to build the list
aerial.nvim/lua/telescope/_extensions/aerial.lua
Lines 183 to 189 in 9ebc135
There was a problem hiding this comment.
Made the requested changes, let me know what you think. Do note tho, setting the cursor happens on the on_show() call. Looking at the documentation and the code examples, I haven't found a way to set it at picker creation like Telescope does it. Any comment / information would ge helpful.
|
Great, LGTM! Looks like one legit CI failure, the others should go away if you rebase master |
When calling snacks picker, auto select the corresponding item, based on the cursor position on the buffer
526dd49 to
ba7bbe4
Compare
|
Oops, I'm not sure, I think my force push after the rebase messed up the flow 😅, could you please review again ? ty |
|
@YosefBayoude it looks like you have a small type error as well as a formatting problem (just in case you didn't see the tests failed) |
|
Yes I did see it, haven't had time tho, will look into it over this weekend |
|
Could you please rerun the workflow to see if it conforms now ? Thanks |
|
LGTM thanks for the PR! |
When calling snacks picker, auto select the corresponding item, based on the cursor position on the buffer.
It's a small QOL imrpovement, that doesn't have much impact on usability, but provides quick info at a glance.