You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I'm aware this is a very complex feature, but I'll write it down in case you ever get to it.
Sublime text has this neat feature where you find files, and once you press @ it switches to "symbols" mode. For example, in snacks repo, doing preview@ would open up lua/snacks/picker/preview.lua in the background while picker is still visible, and start showing lsp symbols results in the same picker, which can also be fuzzy matched.
Here's a short recording:
sublime-file-symbol-picker.mp4
Describe the solution you'd like
I'd like to be able to create a custom picker that would achieve something similar, or ideally the same thing.
For starters, it would be good enough to be able to hook into something like on_prompt_change hook to get the input prompt value, and get the last "valid" item in a more graceful way.
Describe alternatives you've considered
Currently, I hacked this up, where it opens up the files picker, and once @ is typed, it closes the files picker with the last selected file, and opens up lsp_symbols picker.
vim.keymap.set('n', '<C-p>', function()
localshould_open_symbols=false-- Last valid item selected. Once `@` is typed, current item in the `confirm` callback is no longer validlocallast_item=nillocalmain_picker=Snacks.picker.files({
on_change=function(_, item)
ifitemthenlast_item=itemendend,
confirm=function(picker, item)
iflast_itemandshould_open_symbolsthenpicker:close()
vim.schedule(function()
vim.cmd(('e %s'):format(last_item.cwd..'/' ..last_item.file))
Snacks.picker.lsp_symbols()
end)
returnendvim.cmd(('e %s'):format(item.cwd..'/' ..item.file))
end,
})
localwin=main_picker.input.winwin:on(
{ 'TextChangedI' },
Snacks.util.throttle(function()
localline=win:line()
ifline:match('@$') thenshould_open_symbols=truemain_picker:action('confirm')
returnendend, { ms=30 })
)
end)
Additional context
No response
The text was updated successfully, but these errors were encountered:
Did you check the docs?
Is your feature request related to a problem? Please describe.
I'm aware this is a very complex feature, but I'll write it down in case you ever get to it.
Sublime text has this neat feature where you find files, and once you press
@
it switches to "symbols" mode. For example, in snacks repo, doingpreview@
would open uplua/snacks/picker/preview.lua
in the background while picker is still visible, and start showing lsp symbols results in the same picker, which can also be fuzzy matched.Here's a short recording:
sublime-file-symbol-picker.mp4
Describe the solution you'd like
I'd like to be able to create a custom picker that would achieve something similar, or ideally the same thing.
For starters, it would be good enough to be able to hook into something like
on_prompt_change
hook to get the input prompt value, and get the last "valid" item in a more graceful way.Describe alternatives you've considered
Currently, I hacked this up, where it opens up the files picker, and once
@
is typed, it closes the files picker with the last selected file, and opens uplsp_symbols
picker.Additional context
No response
The text was updated successfully, but these errors were encountered: