bug(picker) LSP pickers fails to resume
Did you check docs and existing issues?
- [x] I have read all the snacks.nvim docs
- [x] I have updated the plugin to the latest version before submitting this issue
- [x] I have searched the existing issues of snacks.nvim
- [x] I have searched the existing issues of plugins related to this issue
Neovim version (nvim -v)
0.10.4
Operating system/version
MacOs
Describe the bug
When trying to resume an LSP picker, the error is shown:
No results found for
lsp_references
Steps To Reproduce
- Go to a variable, or any symbol
- run
:Snacks.picker.lsp_references() - Select an item or close the picker
- Move the cursor to an empty line
- run:
Snacks.picker.resume() - The error is shown, and an empty picker is displayed
Expected Behavior
I would expect the picker to resume and show the same results, regardless of the cursor position.
Repro
vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()
require("lazy.minit").repro({
spec = {
{ "folke/snacks.nvim", opts = {} },
-- add any other plugins here
},
})
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
bad bot
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
not stale.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
Bad bot! Not stale.
This is a problem for me too. After moving the cursor, a resume does not always work.
Case:
- Have cursor on a function name. Use
lua Snakcs.picker.lsp_references()method to find references. - Cancel the picker, mopve the cursor away from the function name.
- Use
lua Snacks.picker.resume()to resume - There is now an empty LSP References
- Move back to the function identifier
- Again, use
lua Snacks.picker.resume()to view the again populated LSP References list
Can it be that resume still uses the cursor for context?
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
not stale.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
Not stale.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
not stale.
This has been fixed in commit c210439!
The Problem
LSP pickers failed to resume when the cursor moved away from the original symbol because they needed to re-query the LSP server, which returned different/empty results from the new cursor position.
The Solution
The new resume implementation now caches LSP picker results (resume.lua:21):
items = source:find("^lsp_") and picker.finder.items or nil
When resuming, the cached items are used instead of re-querying:
if state.items then
state.opts.finder = function()
return state.items
end
end
Result
You can now:
- Run
:lua Snacks.picker.lsp_references()on a symbol - Select an item or close the picker
- Move the cursor anywhere (even an empty line)
- Run
:lua Snacks.picker.resume()or:lua Snacks.picker.resume("lsp_references") - ✅ The picker resumes with the original cached results
This works for all LSP pickers: lsp_references, lsp_definitions, lsp_implementations, lsp_symbols, etc.
🤖 Generated with Claude Code
Co-Authored-By: Claude [email protected]