Skip to content

Add quick search modal#44530

Open
davidbonan wants to merge 35 commits intozed-industries:mainfrom
davidbonan:quick-search
Open

Add quick search modal#44530
davidbonan wants to merge 35 commits intozed-industries:mainfrom
davidbonan:quick-search

Conversation

@davidbonan
Copy link

@davidbonan davidbonan commented Dec 10, 2025

Summary
Implements a quick search modal for project-wide searching.

Features
This modal allows users to quickly search for files and content within the project. It includes a picker for displaying search results and a preview editor for showing the selected result.

Enregistrement.de.l.ecran.2025-12-10.a.12.04.48.mov

Performances tested on large codebase (monorepo and zed project).

Related issue #8279

Release Notes:

  • Added quick search without multibuffer

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Dec 10, 2025
@zed-industries-bot
Copy link

zed-industries-bot commented Dec 10, 2025

Messages
📖

This PR includes links to the following GitHub Issues: #8279
If this PR aims to close an issue, please include a Closes #ISSUE line at the top of the PR body.

Generated by 🚫 dangerJS against edfab4a

@MrSubidubi MrSubidubi changed the title Adds quick search modal Add quick search modal Dec 10, 2025
@gustavotrott
Copy link

THANK YOU! Can't wait to use it.

While watching your video, I noticed the typed word wasn't highlighted in the preview window. I suggest to highlight the word too and not only the line!

Also, about Prevent file modification in the preview.. Being able to modify in the preview would be really useful if it's feasible to support.

@davidbonan
Copy link
Author

@gustavotrott I have a UX problem with that:
If I modify a file in the modal, the file is modified but not saved and not opened in the main editor. I find it disturbing to have an unsaved modified file that is not open. Any suggestions?

@davidbonan
Copy link
Author

Update :

  • Allow modifications directly from the preview, when modifying in the preview, the file opens silently in the main editor.
  • Quick Search panel has a fixed size
  • Results counter in the header ("42 results in 8 files" or "200+ results (limited)")
  • Add search options: Case sensitive, Whole word, Regex, Include ignored
  • Collapse/expand files (click on the header)
  • Secondary actions: Cmd+Enter to open in a split
  • When text is selected in the editor, pre-populate the search field with this text when opening the quick search mode.
  • Highlight the word in the preview
  • Improve UI (square borders, header and footer)
  • Improve UX (upon clicking the mouse, we open the preview instead of opening the file directly in the editor and closing the modal)
Capture d’écran 2025-12-11 à 10 55 09 Capture d’écran 2025-12-11 à 10 55 24

@davidbonan davidbonan marked this pull request as ready for review December 11, 2025 12:28
@baldwindavid
Copy link
Contributor

Nice. This is the sort of experience I'd like to see for ALL modals as it's very similar to Helix. I wanted to do something like this for #43961 , but already a stretch to get a new modal. If you get any traction on this, I'd love to build this sort of thing into my PR.

@maxbrunsfeld
Copy link
Collaborator

Testing this out now.

@davidbonan First impression - this is a good feature, it seems to be a very popular request. Your implementation fits into the codebase pretty cleanly and seems high quality. Thank you for doing this!

My only concerns are about UX inconsistency and elegance. Are there any opportunities to make this fit in better with the rest of Zed. I'm going to spend some time this morning exploring this.

@baldwindavid I took a look at your PR too. It seems like, once we land this, you should restructure your PR to make use of some of the same code for previewing buffers, and make the modals look consistent.

@davidbonan
Copy link
Author

@maxbrunsfeld Thanks for the feedback.

Could you provide one or two concrete examples of what you’re looking for in terms of UX consistency or elegance ?
In particular, if there are specific existing screens, modals, or flows I should align with, that would be very helpful in guiding the changes.

@maxbrunsfeld
Copy link
Collaborator

maxbrunsfeld commented Dec 15, 2025

Just streaming out feedback as I test:

  • Performance - Testing in chromium, the latency is much worse than our current project search, because we wait to get all the matches before updating the list, instead of streaming in the results. I think we need to stream the results in to the list, so that it feels fast in large repos.
  • UI - Usually in Zed, whenever we show code, it is syntax-highlighted. Even LSP completions get highlighted. I think there is an opportunity to syntax-highlight the lines in the list: we already open every buffer as part of the Project::search API. Right now, the quick search view is immediately dropping all of the open buffers after extracting the matched lines. But instead, we could keep them open until parsing completes, so that when it does, we can update the matches for that buffer to show the syntax-highlighted lines.
  • Performance - As a continuation of this thought ☝️ , should we keep all of the buffers open once we find results in them, rather than dropping any of them? It would make it very fast to update the preview. I noticed that right now, there is a delay before the preview updates.

@maxbrunsfeld
Copy link
Collaborator

I pushed up one small change to prevent the result count header from briefly disappearing (causing vertical shifts) when searching.

Can you address the latency issue, streaming in the results? Do you have thoughts on how that should work, or if there are any issues with adding that?

@P1n3appl3
Copy link
Contributor

@yara-blue this overlaps pretty heavily with the telescope design stuff we were talking to @danilo-leal and @mattermill about.

@baldwindavid
Copy link
Contributor

baldwindavid commented Dec 15, 2025

Just off the top of my head some recent PRs, discussions, and issues are related:

I think that all of these are driving towards a request of an experience similar to the one in this quick search PR. This is basically how everything is presented in Helix. Not that we need to copy Helix, but I do think it would be beneficial to take a holistic approach to this. This PR seems like a great one to polish up to set the tone for future pickers.

This was referenced Dec 15, 2025
@davidbonan
Copy link
Author

@maxbrunsfeld
Updates:

  • Add syntax highlighting to the preview.
  • Caches buffers to improve performance.
  • UI : Add rounded border + Improve header to match with ProjectSearch view
Capture d’écran 2025-12-16 à 10 09 18

@maxbrunsfeld
Copy link
Collaborator

Are you streaming the results in now?

@davidbonan
Copy link
Author

Are you streaming the results in now?

Yes in line 1558 you can see the stream process

@maxbrunsfeld
Copy link
Collaborator

Thanks for explaining; I’ll manually test and review again

@maxbrunsfeld
Copy link
Collaborator

@davidbonan The new UI looks great, streaming is looking good.

I hit a problem when using it in the chromium repo, typing in the search bar seemed to freeze the editor. I think there are already some performance problems with regular project search, so I'm trying to figure out if there's anything we need to do in this PR to make sure we handle long-running searches properly.

Could you test that scenario when you get a chance? Searching in a large repo like WebKit, Chromium or Linux

@justsomelegs
Copy link
Contributor

hey @davidbonan nice work!, it might be worth us working together on this tbh, i've been working on basically the same things but with a focus on modular sources #44942.

if not i understand but just a thought?

Updates the quick search modal to use dynamic sizing based on viewport dimensions and minimum constraints.

This ensures the modal adapts better to different screen sizes and avoids being too small on larger screens.
It also replaces fixed pixel values with a ratio for the left panel width.
Adapts the quick search modal layout to use a vertical
layout when the viewport width is below a certain threshold,
improving usability on smaller screens.

This change also refactors the rendering logic for better
readability and maintainability.
Enhances quick search navigation by automatically expanding collapsed file headers when navigating through the list.
This change addresses an issue where double-clicking
an item in quick search wasn't correctly triggering
the navigation. It ensures that the selected index
is properly updated and the confirmation action is
executed, leading to the intended navigation.
Updates the quick search functionality to directly consume the
search results receiver (`rx`) instead of relying on the `project`
object, streamlining the data flow and improving efficiency.
Allows other UI tasks to run between search result batches
to improve responsiveness.
Adds a spinner and text label to indicate when Quick Search is actively searching for results. This provides visual feedback to the user that the search is in progress.
@davidbonan
Copy link
Author

davidbonan commented Dec 31, 2025

I have landed the project search cancellation changes in #45406 (that @maxbrunsfeld paved the way for in #45300); I think we're good to remove project search changes from the scope of this PR now.

@osiewicz Wow, the cancellation mechanism greatly improves the speed of searching in “search on input” mode.
Thx!

@wuchunpeng777

This comment was marked as spam.

@maxbrunsfeld
Copy link
Collaborator

Manually testing this one more time, now that #45406 has landed.

@maxbrunsfeld
Copy link
Collaborator

@davidbonan The UI is looking really good; I'm liking the larger size.

It looks like we are starting and stopping language servers as we page through the different preview buffers. I think that there is some way of opening a buffer without starting language servers. We do that for instance when a buffer only appears as an excerpt in a multi-buffer. I think we should do that here.

One other question - what do you think should happen when you click with the mouse on a certain spot in the preview buffer? Right now it puts your cursor there, and transfers focus to the preview buffer, and you can actually edit. If you edit, it opens that buffer in a tab below the modal, but the modal stays open. I think that's a bit odd. Maybe we should make the buffer read-only in this view. I also wonder if we should even keep the modal open if you click to the preview buffer. Maybe at that moment, we should just immediately open the buffer in a tab, and put the cursor at the location where you clicked. Thoughts?

@osiewicz
Copy link
Contributor

osiewicz commented Jan 8, 2026

@maxbrunsfeld

It looks like we are starting and stopping language servers as we page through the different preview buffers. I think that there is some way of opening a buffer without starting language servers. We do that for instance when a buffer only appears as an excerpt in a multi-buffer. I think we should do that here.

Yeah, classic multi-buffers are lazy with regards to spawning language servers. The main API for it is Editor::register_buffer which is called on selection changes and such. If we're spawning language servers in preview buffers, then most likely that function is getting called from one of it's call-sites.

@gustavotrott
Copy link

Maybe we should make the buffer read-only in this view. I also wonder if we should even keep the modal open if you click to the preview buffer. Maybe at that moment, we should just immediately open the buffer in a tab, and put the cursor at the location where you clicked. Thoughts?

I think that would actually be a shame.

Being able to edit the file directly inside the modal is extremely useful. I rely on this all the time in JetBrains editors. For example, when I need to make the same change across several different files, I just use quick search and apply the edits right there, jumping between files and adjusting each one without breaking the flow.

Automatically closing the modal on click would also feel quite awkward and not very practical. Sometimes I just want to select some text in the preview to copy a snippet of code. With that behavior, it would immediately open the file in a tab, which is not what I want in that moment. I would much rather depend on a double click or pressing Enter to explicitly open the file.

I am not sure what the best solution is to allow editing inside the Quick Search modal, but the current behavior in Zed where multiple files open stacked and are directly editable works really well for me. Having that same capability inside the Quick Search modal would be even better. If it is possible to reuse an approach similar to what already exists for editing inside Project Search, that would be great. Otherwise, not allowing edits there would feel like a clear downgrade.

@maxbrunsfeld
Copy link
Collaborator

We can allow editing, but then we shouldn’t also open the file in the workspace below the modal. And I guess we would need to auto-save the buffer when you change the search query after editing in there, because otherwise the buffer might be dropped without saving your changes.

@maxbrunsfeld
Copy link
Collaborator

Thanks for the feedback on the feature

@marcocondrache
Copy link
Contributor

Just my two cents: If the quick search modal lets you edit, how is that really different from global search with multi-buffer? Feels like the same thing, just shown differently. I always thought quick search was meant for quickly finding and inspecting something, not editing.

@sf0rman
Copy link

sf0rman commented Jan 14, 2026

I really like this, but instead of a popup window, it would be nice if the found files show on the left (where project_panel, git_panel etc go) and the content for each shown in the main screen.

@gustavotrott
Copy link

Just my two cents: If the quick search modal lets you edit, how is that really different from global search with multi-buffer? Feels like the same thing, just shown differently. I always thought quick search was meant for quickly finding and inspecting something, not editing.

Read the issue #8279 and you will understand the difference.

@ryanwinchester
Copy link

Is there a keyboard shortcut to open all the results in multibuffer?

@feeiyu
Copy link
Contributor

feeiyu commented Jan 20, 2026

I have a small suggestion after using this feature:
When opening a file from Quick Search and then opening Quick Search again, would it be possible to restore the previous search state (query and results)?

I think this could make repeated navigation a bit smoother.

@mattermill
Copy link
Contributor

This is looking really good so far! I made some changes to respect OpenExcerpts shortcuts in the quick search preview.

I pushed them to davidbonan-quick-search-open-excerpts if you could review, or allow edits from maintainers.

cc @maxbrunsfeld

@davidbonan
Copy link
Author

I pushed them to davidbonan-quick-search-open-excerpts if you could review, or allow edits from maintainers.

@mattermill Normally it’s already activated

@maxbrunsfeld Before applying the changes or revert changes requested in the comments, I would like to have confirmation from the Zed team on what is wanted

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

Status: In progress

Development

Successfully merging this pull request may close these issues.