Skip to content

feat: add new snacks picker extension#145

Open
kyerpotts wants to merge 1 commit intoThePrimeagen:masterfrom
kyerpotts:feat/add_snacks_support
Open

feat: add new snacks picker extension#145
kyerpotts wants to merge 1 commit intoThePrimeagen:masterfrom
kyerpotts:feat/add_snacks_support

Conversation

@kyerpotts
Copy link

@kyerpotts kyerpotts commented Mar 1, 2026

Added support for the popular snacks picker. Snacks can now be selected as a picker by following the same config patterns as fzf_lua & telescope


Note

Low Risk
Adds a new optional extension and a small utility refactor; changes are localized to picker UI behavior with minimal impact on core functionality.

Overview
Adds a new snacks.nvim picker extension (extensions/snacks.lua) that lets users pick the current model or provider via snacks.picker.select, including dependency checks and preselecting the current choice.

Refactors shared selection logic by moving index_of into extensions/pickers.lua and updating the Telescope extension to use the shared helper for default_selection_index.

Written by Cursor Bugbot for commit a15b14a. This will update automatically on new commits. Configure here.

@kyerpotts kyerpotts force-pushed the feat/add_snacks_support branch from 9bcafce to f87e41a Compare March 4, 2026 15:00
snacks = {
on_show = function(picker)
picker.list:view(index_of(models, current))
end,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on_show nested under wrong key, never invoked

Medium Severity

The on_show callback is nested inside a snacks key in the opts table passed to snacks.picker.select. The snacks picker API expects on_show as a top-level option in the picker config — there's no documented support for a nested snacks key. This means on_show is silently ignored, so the cursor won't scroll to the currently selected model/provider, unlike the telescope and fzf_lua implementations.

Additional Locations (1)

Fix in Cursor Fix in Web

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pure unadulterated baloney.
See line 73 at https://github.com/folke/snacks.nvim/blob/main/lua/snacks/picker/select.lua if you're hungry for deli meat.

feat: add snacks picker extension

The added snacks picker follows the same item selection behaviour as
telescope; the selected item will be highlighted the list, but the order
of items will not be changed. This is in line with common snacks use
patterns.

refactor: move the shared behaviour of index_of to pickers.lua
@kyerpotts kyerpotts force-pushed the feat/add_snacks_support branch from a15b14a to 4f149c6 Compare March 4, 2026 15:11
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

snacks = {
on_show = function(picker)
picker.list:view(pickers_util.index_of(models, current))
end,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Snacks picker view scrolls viewport but doesn't select item

Medium Severity

picker.list:view(index) in snacks.nvim manages the visible viewport scroll position, not the cursor/selection. Unlike telescope's default_selection_index which pre-selects the item, this only scrolls the list to make the current model/provider visible without actually highlighting or selecting it. The cursor likely remains on the first item, making the pre-selection UX inconsistent with the telescope and fzf_lua pickers.

Additional Locations (1)

Fix in Cursor Fix in Web

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ThePrimeagen this is horsepoop, the bugbot couldn't tell snakes from spaghetti in this case. I've verified the behaviour as working correctly

@ataha322
Copy link

This competes with #160

is there a way a user of snacks can use that vim.ui.select api instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants