editor: Add search highlighting for active elements#35931
editor: Add search highlighting for active elements#35931DarkMatter-999 wants to merge 16 commits intozed-industries:mainfrom
Conversation
|
We require contributors to sign our Contributor License Agreement, and we don't have @DarkMatter-999 on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'. |
|
@cla-bot check |
|
The cla-bot has been summoned, and re-checked this pull request! |
smitbarmase
left a comment
There was a problem hiding this comment.
Looks good, just left few notes.
|
@smitbarmase, made the required changes, please re-review. "search.match_background": "#00FF007F",
"search.active_match_background": "#FF00007F",
|
smitbarmase
left a comment
There was a problem hiding this comment.
We are almost there.
- I think it would be great to actually define sensible colors for at least the theme we support out of the box. You can find them in
assets/themes. It should be distinct enough or straight up complementary, since even with two matches you should be able to identify which one is active.
Zed with this PR:
VSCode:
Sublime:
- We also don't want to break any theme, since after this change, active highlight might start to look different for different themes. I think we should fallback to
search_match_backgroundifsearch_active_match_backgroundis not specified. Right now, fallback works only if bothsearch_match_backgroundandsearch_active_match_backgroundaren't specified.
crates/theme/src/styles/colors.rs
Outdated
| pub tab_bar_background: Hsla, | ||
| pub tab_inactive_background: Hsla, | ||
| pub tab_active_background: Hsla, | ||
|
|
There was a problem hiding this comment.
I think it's alright to not have these comments, since variable naming is apparent.
|
Hey @smitbarmase I've updated the default themes and added backward compatibility for other themes as fallback to |
|
Hey @DarkMatter-999, after digging deeper into this, I found a major issue with the approach. Using a separate highlight key for the active match might not be the best idea because:
I started from scratch and after experimenting, I ended up with this PR: #44098. Thanks to you for the theme changes, I cherry-picked them as is. Thanks for your contribution! I’m closing this in favor of that PR. |

Closes #28617
Release Notes:
Before
After