Skip to content

Add search_on_input setting to Project Search#42889

Merged
SomeoneToIgnore merged 16 commits intozed-industries:mainfrom
holoflash:search-on-input
Feb 13, 2026
Merged

Add search_on_input setting to Project Search#42889
SomeoneToIgnore merged 16 commits intozed-industries:mainfrom
holoflash:search-on-input

Conversation

@holoflash
Copy link
Copy Markdown
Contributor

@holoflash holoflash commented Nov 17, 2025

I was really missing the ability to instantly see search results while typing in the Project Search and decided to try and implement it.
As this may not be a feature that everyone wants, I made it toggle-able via the settings (or the settings.json)

Settings

Set to false by default
Screenshot 2025-11-17 at 16 17 09

settings.json

Set to false by default
Screenshot 2025-11-17 at 16 18 21

Video demo:

search_on_input_demo.mov
  • Search input is debounced with 250ms in this mode (cool?)

The desire for this feature has been expressed here too: #30843

Release Notes:

  • Implemented project search on input. Can be toggled with search.search_on_input settings, and debounced with search.search_on_input_debounce_ms (200ms default)

@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented Nov 17, 2025

We require contributors to sign our Contributor License Agreement, and we don't have @holoflash 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
Copy link
Copy Markdown

cla-bot Bot commented Nov 17, 2025

We require contributors to sign our Contributor License Agreement, and we don't have @holoflash 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'.

@holoflash
Copy link
Copy Markdown
Contributor Author

@cla-bot check

@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented Nov 17, 2025

We require contributors to sign our Contributor License Agreement, and we don't have @holoflash 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
Copy link
Copy Markdown

cla-bot Bot commented Nov 17, 2025

The cla-bot has been summoned, and re-checked this pull request!

@holoflash holoflash changed the title feat[search]: show search results on input Add search_on_input setting to Project Search Nov 17, 2025
@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented Nov 17, 2025

We require contributors to sign our Contributor License Agreement, and we don't have @holoflash 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
Copy link
Copy Markdown

cla-bot Bot commented Nov 17, 2025

The cla-bot has been summoned, and re-checked this pull request!

@holoflash
Copy link
Copy Markdown
Contributor Author

@cla-bot check

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Nov 17, 2025
@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented Nov 17, 2025

The cla-bot has been summoned, and re-checked this pull request!

@P1n3appl3
Copy link
Copy Markdown
Contributor

I've been playing with this change for a little bit and I think we want to land it. Thanks for the feature and I appreciate the added test! I've got a couple of thoughts, but not all of these need to be resolved to merge the feature.

  • It's hard to pick a debounce time that works for everyone, but I don't think it warrants making a setting. If anything 250ms feels a bit high for me. I wonder if it'd be possible to scale it based on worktree size (so in tiny projects you get instant results, and in huge ones you don't get thrashing...) or if that's overcomplicating things.
  • There's some visual jitter when the matches refresh. I get that we want to stream matches in instead of waiting for them all to show up, but I think it might be better UX if we don't always show an empty list for at least a frame. Despite the ordering being stable, I keep losing track of a match when it's only barely moving on the screen just because it flashes.
    • I've tried opening this with larger projects such as the rust compiler, and there it's pretty annoying when you see some matches, type a few more characters, and all the existing matches disappear for a few seconds and you just see an empty pane with "searching". I'm increasingly convinced that for the updates we'd want to keep showing the previous results until we have at least one new result or we finish the search and determine there aren't any matches.
  • This doesn't matter too much since the setting is opt in, but I worry that we'd really want to do some performance optimizations to avoid fully re-searching everything when the query changes. Caching logic might be too complicated to be worth it, but @osiewicz mentioned that it might be a good idea to keep track of all the files where no matches were returned. That way for the common case of adding a few characters to the query we could in theory avoid re-searching all those files. Of course in the general case (especially when regex matches get involved) this doesn't hold up, but it seems like a decent heuristic that covers the most common usage and could potentially be a huge perf win.

@holoflash
Copy link
Copy Markdown
Contributor Author

@P1n3appl3
Thanks so much for the review!
I'm looking into some of the things you wrote and here are some thoughts so far:

  • Removing the debounce entirely makes the search feel much smoother overall. Big and small projects. I have a local commit ready to be pushed with it removed if you agree.

I made it opt-in because I assume that there's a good reason for the current implementation (hitting the ENTER key), but coming from vscode, I'm used to the results showing instantly, and being able to search right in the file browser.
Could you fill me in on why the current approach was chosen in the first place in ZED? Would help me understand what else needs to be done to make this feature work nicer.

As for the other points. I'm not really sure what the best approach might be. Maybe if something is inputed in the search field, continue the search but ONLY on the results coming from the previous query? (would need to temporarily cache the results?)

  • user types: "express" --> get search results for "express"
  • user types: "expression" ---> continue search but only on results from "express"
  • user types: "expression a" ---> continue search but only on results from "expression"
  • user erases some letters: "expressi" ---> continue search but on results from "express"
  • user erases more letter:" expre" ---> do a new search because query is broader than initial search.

This might need a little debounce though to not trigger on each letter if typed quickly.
Could be done in reverse as you mentioned by excluding results instead.
Just high level thoughts, I don't know how to go about implementing this as I'm writing.

I'll just push the version without the debounce so you can get a feel for it.
Maybe that alone might make this work without all the extra stuff.

@Be-ing
Copy link
Copy Markdown
Contributor

Be-ing commented Nov 20, 2025

I could imagine wanting this enabled sometimes (small projects) but not others (large projects with rust-analyzer regularly stressing my system). I wonder if it might be better to make this toggleable with a button next to the search bar by the filter and case sensitivity buttons instead of buried in the settings. That would also make it more discoverable.

@holoflash
Copy link
Copy Markdown
Contributor Author

holoflash commented Nov 22, 2025

@Be-ing
I personally would like that too! Just not sure if it's too intrusive of a feature.
But here's what that could look like:

Screen.Recording.2025-11-22.at.10.41.35.mov

I just pushed the above as a suggestion.

@P1n3appl3
Copy link
Copy Markdown
Contributor

It's worth noting that the "quick search" feature in #44530 implements this functionality. I think it may still be worth doing here, but we should at least use the same logic between the impls.

@holoflash
Copy link
Copy Markdown
Contributor Author

It's worth noting that the "quick search" feature in #44530 implements this functionality. I think it may still be worth doing here, but we should at least use the same logic between the impls.

Neat @P1n3appl3
I'll see how that one progresses and if I can use the new quick_search for this instead.
Coincidentally ended up binding ⌥+cmd+q to toggling this feature, so even that part makes sense 🤩

Copy link
Copy Markdown
Contributor

@SomeoneToIgnore SomeoneToIgnore left a comment

Choose a reason for hiding this comment

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

Thank you.

I think we can drastically improve it if we remove the live toggle: do you have any other editors' example where it present?

Comment thread assets/keymaps/default-linux.json Outdated
"ctrl-shift-h": "search::ToggleReplace",
"alt-ctrl-g": "search::ToggleRegex",
"alt-ctrl-x": "search::ToggleRegex",
"alt-ctrl-q": "search::ToggleSearchOnInput",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  1. This key combination is rather nuclear, given that ctrl/cmd-q quits Zed.
  2. This functionality, live toggle search on input — is it represented by any other editors?

Overall, feels like an unnecessary compilation in all this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

My first iteration didn't have the live-toggle.
I implemented it as suggested by @Be-ing above, but not something I've see anywhere else.

I'm all for removing it if it's not in demand.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Given how much code will be removed and that it's the only UI element that's changed, I'm 100% in for a removal + the new default flip.

Copy link
Copy Markdown
Contributor Author

@holoflash holoflash Feb 12, 2026

Choose a reason for hiding this comment

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

But keep the button for it in the search toolbar?
I went with the "eye" icon there. Is there a better fit? (if we're keeping this)

Screenshot 2026-02-12 at 17 36 55

Or should it just be something that's togglable via the Settings?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

But no, neither we need this, no UI changes at all?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh ok, nice! But keep it an option that can be toggled on/off in the Settings then?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes.

Copy link
Copy Markdown
Contributor Author

@holoflash holoflash Feb 12, 2026

Choose a reason for hiding this comment

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

Just pushed the suggested changes.

The only UI thing I left is the text on the search screen.
Show different text depending on the user's settings.

  Label::new(if EditorSettings::get_global(cx).search.search_on_input {
                    "Start typing to search. For more options:"
                } else {
                    "Hit enter to search. For more options:"
                })

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I see that this PR is still open:
#44530

Depending on which gets merged first, it might be nice to revisit this and use the quick search for search_on_input.

Comment thread assets/settings/default.json Outdated
Comment thread crates/editor/src/editor_settings.rs Outdated
Comment thread crates/search/src/buffer_search.rs Outdated
- Setting: `search_wrap`
- Default: `true`

## Center on Match
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I noticed that there was a duplicate here so I removed it.
And I'm not quite sure what is going here with the mixed ## ###

@katie-z-geer ?

Comment thread docs/src/reference/all-settings.md
Copy link
Copy Markdown
Contributor

@SomeoneToIgnore SomeoneToIgnore left a comment

Choose a reason for hiding this comment

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

Thanks!

One small caveat left is the settings' documentation wording: that only toggles search on input for project search, whether the search settings it's placed into are both buffer and project searches.

But I think this is a good start already.

@SomeoneToIgnore SomeoneToIgnore merged commit fee42e1 into zed-industries:main Feb 13, 2026
27 checks passed
@github-project-automation github-project-automation Bot moved this from Community PRs to Done in Quality Week – December 2025 Feb 13, 2026
@SomeoneToIgnore
Copy link
Copy Markdown
Contributor

After some internal feedback, got #49150 that flipped the default back (alas) and added a debounce between strokes.

I will update the PR description here accordingly, to accumulate release notes in one place.

SomeoneToIgnore added a commit that referenced this pull request Feb 13, 2026
Follow-up of #42889

* disable by default
* add a configurable debounce, 200ms default

Release Notes:

- N/A
@SomeoneToIgnore
Copy link
Copy Markdown
Contributor

Sorry for the bad news: turns out we'll have to revert the whole shebang of 3 related PRs for now as the feedback was "remove the flickering before having it released, even disabled"-ish.

I plan to push it forward and redo the way we deal with this: the idea is to reuse search properties (it should stream files in the same order between reruns) and replace excerpts gradually, not clearing the entire thing each time, as we do now, most probably next week.

@SomeoneToIgnore
Copy link
Copy Markdown
Contributor

Another attempt: #49374

@holoflash
Copy link
Copy Markdown
Contributor Author

@SomeoneToIgnore nice!!
Thanks so much for taking this all the way!

rtfeldman pushed a commit that referenced this pull request Feb 17, 2026
Follow-up of #42889

* disable by default
* add a configurable debounce, 200ms default

Release Notes:

- N/A
SomeoneToIgnore added a commit that referenced this pull request Feb 18, 2026
Deals with #9318
Re-lands #42889 with more
fixes to reduce overall flickering

Release Notes:

- Enabled type on search by default for the project search

---------

Co-authored-by: Cole Miller <cole@zed.dev>
@krims0n32
Copy link
Copy Markdown

I was looking for this setting in Zed 0.228.0 (arch btw), but it does not seem to be included although it looks like this was merged? Also tried 0.229 preview but no dice.

It is in the documentation:
https://zed.dev/docs/reference/all-settings#search-on-input

@injust
Copy link
Copy Markdown
Contributor

injust commented Mar 25, 2026

@krims0n32 I believe this was reverted. You should track #9318 to see when the feature lands.

The search_on_input setting documentation was mistakenly added in #49177, it seems.

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

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

Development

Successfully merging this pull request may close these issues.

8 participants