Skip to content

Feat(integrations): Snacks picker integrations #182

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

JustBarnt
Copy link

This is almost a direct copy of telescopes integration. I tried to map the highlight groups as closely as I could.

I added snacks_picker to the integrations table for enabling and disabling.
I also added a snacks.picker table to the root of the configuration as well so in the future it shouldn't result in breaking changes to add other snacks integrations.

Attached as screenshots of both the classic and flat styles

Classic

image

Flat

image

@DOD-101
Copy link
Collaborator

DOD-101 commented Apr 24, 2025

Hey, thanks for the PR!

Would it be possible to do something similar to #173 for snacks?

@JustBarnt
Copy link
Author

@DOD-101 I meant to attach a screenshot of the match color, but I'm definitely open to suggestions if this isn't a good enough contrast

image

@DOD-101
Copy link
Collaborator

DOD-101 commented Apr 24, 2025

I'd make it the same as in telescope, so bold and no bg.

It migh also be a good idea to create shared highlight groups between this and telescope (look at the tree integrations to see what I mean), but I'll have to look at the code more closely tomorrow to judge how viable that is.

@JustBarnt
Copy link
Author

Yeah I can take a look at it, this is my first time messing around with colorschemes and what not so it's been a learning process for me. Thanks for the feedback!

@JustBarnt
Copy link
Author

@DOD-101 I think I get what you mean by shared highlight groups. Looking at nvim-tree like you suggested, I see that instead off settings the highlight groups manually, they are just linked to the Tree highlight groups. I should definitely be able to do the same for SnacksPicker

@JustBarnt
Copy link
Author

So after testing when trying to do shared highlight groups I've got to issues.

  1. Snacks has a more simplified highlight groups compared to Telescope so its not a 1 to 1 mapping, so I'm having trouble getting it look like it, which makes me lean toward not letting them share highlight groups.
  2. When trying to test, you have to make telescope.styles equal to what ever style you want the snacks picker to be. So we would have to rename telescope.styles to something like picker.styles which would be a breaking change. I'm not sure if we are trying to avoid breaking changes or not, or we add a compatibility option, but that just adds more code debt that would have to be maintained.

I'm leaning towards maybe it's just better to implement snacks without sharing highlight groups and just trying to make it look as close to telescope.

@DOD-101
Copy link
Collaborator

DOD-101 commented Apr 26, 2025

  1. Snacks has a more simplified highlight groups compared to Telescope so its not a 1 to 1 mapping, so I'm having trouble getting it look like it, which makes me lean toward not letting them share highlight groups.

There seems to be a lot of duplicates in telescope, where we would only need one shared highlight group:

e.g:

   -- telescope.lua

    G.TelescopePreviewTitle = { fg = C.white0, bg = C.bg, bold = true }
    G.TelescopeResultsTitle = { fg = C.white0, bg = C.bg, bold = true }
    G.TelescopePromptTitle = { fg = C.white0, bg = C.bg, bold = true }
    G.TelescopeTitle = { fg = C.white0, bg = C.bg, bold = true }

Would just be linked to something like PickerTitle.

It is also not necessary to have snacks.picker to use all the highlight groups that telescope requires or look exactly the same. It's more about making sure that the same functionality uses the same highlight Group. Otherwise, future PRs similar to #173 would have to make changes in two separate places.

  1. When trying to test, you have to make telescope.styles equal to what ever style you want the snacks picker to be. So we would have to rename telescope.styles to something like picker.styles which would be a breaking change. I'm not sure if we are trying to avoid breaking changes or not, or we add a compatibility option, but that just adds more code debt that would have to be maintained.

I would for now just leave the config options as you have set them up. In the future, I believe we should add an option to toggle all the options where there is a flat and classic version, but that is outside the scope of this PR.


If you are unsure about any of the changes you have made or don't know how to match something up, just make a commit and I will suggest things in my review.

@JustBarnt
Copy link
Author

@DOD-101 Sounds, good I will take a stab at it then!

@JustBarnt
Copy link
Author

@DOD-101 I just update the groups. I would definitely appreciate your thoughts and even some changes if you think it's appropriate. I think it looks a little odd, since SnacksPickerInputBorder does not go entirely around the input field like it does with Telescope so I tried to improvise a little.

Copy link
Collaborator

@DOD-101 DOD-101 left a comment

Choose a reason for hiding this comment

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

Please create the hl groups in groups/native.lua and link both telescope and snacks.picker to them. You can call them something like Picker....

image

For me this is what it looks like out of the box.

  1. The filenames being a different color should be changed to match telescope.
  2. The inside of the search bar has a different color than the border.

@JustBarnt
Copy link
Author

@DOD-101 Yeah sounds good. Hopefully here soon in the next few days, I will get a change to work on this again some more. Thanks for help!

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.

2 participants