Commit graph

824 commits

Author SHA1 Message Date
Nathan Sobo
3a8d012d1a
Fix macOS find query seeding (#56681)
Some checks are pending
Congratsbot / check-author (push) Waiting to run
Congratsbot / congrats (push) Blocked by required conditions
deploy_nightly_docs / deploy_docs (push) Waiting to run
run_tests / orchestrate (push) Waiting to run
run_tests / check_style (push) Waiting to run
run_tests / clippy_windows (push) Blocked by required conditions
run_tests / clippy_linux (push) Blocked by required conditions
run_tests / clippy_mac (push) Blocked by required conditions
run_tests / clippy_mac_x86_64 (push) Blocked by required conditions
run_tests / run_tests_windows (push) Blocked by required conditions
run_tests / run_tests_linux (push) Blocked by required conditions
run_tests / run_tests_mac (push) Blocked by required conditions
run_tests / doctests (push) Blocked by required conditions
run_tests / check_workspace_binaries (push) Blocked by required conditions
run_tests / build_visual_tests_binary (push) Blocked by required conditions
run_tests / check_wasm (push) Blocked by required conditions
run_tests / check_dependencies (push) Blocked by required conditions
run_tests / check_docs (push) Blocked by required conditions
run_tests / check_licenses (push) Blocked by required conditions
run_tests / check_scripts (push) Blocked by required conditions
run_tests / check_postgres_and_protobuf_migrations (push) Blocked by required conditions
run_tests / extension_tests (push) Blocked by required conditions
run_tests / tests_pass (push) Blocked by required conditions
Closes #55619

### Summary

- Route `buffer_search::UseSelectionForFind` through
`BufferSearchBar::deploy` instead of updating the query editor directly.
- Add an explicit seed-query override to `deploy`, so the Cmd-E action
can force `SeedQuerySetting::Always` while regular deploy callers
continue to pass `None` and respect the user’s
`seed_search_query_from_cursor` setting.
- By going through `deploy`, Cmd-E now also runs the search path that
keeps buffer-search navigation state in sync:
  - shows/initializes the search bar for the active searchable item
  - applies the seeded query via `search_suggested`
- calls `search`, which updates the query editor, search options, active
search query, search history, and macOS find pasteboard
  - refreshes `searchable_items_with_matches` and `active_match_index`
  - activates the current match after the search completes
- This ensures the subsequent Cmd-G action has the expected active
query, match list, search token, and active match index to select the
next result.
- Add a macOS-only end-to-end regression test using the default macOS
keymap with `simulate_keystrokes("cmd-e")` and
`simulate_keystrokes("cmd-g")`.

### Validation

- `cargo test -p search test_cmd_e_then_cmd_g_uses_selection_for_find`
- `cargo fmt --check --package search --package zed_actions`
- `./script/check-keymaps`
- `cargo check -p search`
- `cargo check -p workspace`
- `cargo check -p vim`

Release Notes:

- Fixed macOS Cmd-E/Cmd-G find behavior so Cmd-E seeds find from the
cursor or selection and Cmd-G advances through the newly seeded matches.
2026-05-13 23:35:10 +00:00
Kirill Bulatov
c049193fd9
Make all status bar tools able to hide its button via UI (#54971)
Closes https://github.com/zed-industries/zed/discussions/53471

Adds a requirement on status bar items to provide a way to hide
themselves.

<img width="329" height="153" alt="image"
src="https://github.com/user-attachments/assets/b98ee5ba-a439-44d7-9ab5-f4511b66a574"
/>

<img width="464" height="40" alt="image"
src="https://github.com/user-attachments/assets/b41d9189-3475-4e61-b3a4-bc731dd52c53"
/>


Release Notes:

- Added a way to hide sidebar buttons
2026-05-08 10:36:03 +00:00
Conrad Irwin
be705e677b
Merge gpui::Task and scheduler::Task (#53674)
Release Notes:

- N/A or Added/Fixed/Improved ...
2026-05-05 22:41:13 +00:00
Oleksiy Syvokon
250e697ff7
project_search: Fix project search status text and refactor search state (#54753)
This change fixes a small bug where we were showing "Loading project..."
even when in fact we had already started the search.

It also refactors three booleans in the `SearchState` enum, so that it's
harder to make similar mistakes in the future.


Release Notes:

- N/A
2026-04-24 10:45:16 +00:00
Lukas Wirth
c5a2807492
Remove smol as a dependency from a bunch of crates (#53603)
We aren't making use of it in these crates and it unblocks some
web-related work

Release Notes:

- N/A or Added/Fixed/Improved ...
2026-04-24 10:29:51 +00:00
Finn Evers
9b40411c6a
Fix bad GitHub merge queue merge (#54721)
No, sadly, the title is not a typo. See
https://www.githubstatus.com/incidents/zsg1lk7w13cf for the context.
I'll read with joy and popcorn through that root cause analysis.

It makes literally zero sense what happened here, but for some completly
bonkers reason GitHub completely messed up the merge queue with
https://github.com/zed-industries/zed/pull/54632.

I have no idea how it happened. It makes literally zero sense. A PR
going into the merge queue should have the same LoC when getting out of
it. GitHub obviously does not check this. GitHub causes extra work with
a feature that is supposed to save time.

Thanks, I guess.

Release Notes:

- N/A

---------

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
2026-04-23 23:47:30 +00:00
Danilo Leal
0ab64d6414
branch_picker: Add button to filter remote branches (#54632)
This PR brings back the button to filter remote branches when accessing
the title bar's branch picker with the mouse. It was unintentionally
removed when we introduced the new worktree picker.

Release Notes:

- N/A
2026-04-23 18:26:44 +00:00
Dino
2d86e3b30b
search: Fixed highlighting item beyond cursor (#54514)
Search is highly generic, editor is the only implementation that has a
concept of a cursor. When the cursor moves eventually
`Editor::selections_did_change` runs which among a bunch of things
triggers the `SearchEvent::ActiveMatchChanged`. This was handled by the
`BufferSearchBar` by moving the currently highlighted item.

When going to the next search result (from the cursor position) we call
`BufferSearchBar::match_index_for_direction`. It relied on the
current_index being updated during the handling of `ActiveMatchChanged`
which we removed. It now instead figures out the next/prev search result
from the users cursor in the buffer directly.

The `SearchEvent::ActiveMatchChanged` was being used for different
responsibilities in different places in the codebase where it was
emmited, namely:

* On the `editor::Editor::selections_did_change` it was being emmited in
  case a single selection (single cursor) existed, and this was the
  thing reponsible for indirectly updating the active match as soon as
  the cursor moved out of match.
* On the `terminal` side, it's being emitted when the user clicks on the
  terminal, to "simulate" what the cursor position would be and update
  the active match to the next closes match compared to the click
  position.
* On the `markdown_preview` side it was being emmited whenever the
  active match was updated but, from testing, it does actually seem to
  not drive anything and is unnecessary?

Given that we no longer want to update the active match in the buffer
everytime the user moves the cursor, we removed the event emission from
`editor::Editor::selections_did_change` as well as removing the one from
`markdown_preview`, as it seems it doesn't have any noticeable impact.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes #44367

Release Notes:

- Fixed search highlighting changing anytime the cursor moves.

---------

Co-authored-by: Yara <git@yara.blue>
2026-04-23 14:18:46 +00:00
Oleksiy Syvokon
5294e16547
Wait for worktree scan to complete before starting search (#54534)
When starting a search on a project that is in the middle of a scan, we
used to miss results in files that had not yet been scanned.

This change makes the search wait for the scan to complete.


Closes #9858

Release Notes:

- Fixed incomplete search results when the project scan is incomplete
2026-04-23 13:35:13 +00:00
Conrad Irwin
c97442029a
Fix hang in replace all when the query contains non-ASCII text and regex-special characters (#54422)
Closes #54331
Updates #50848

Release Notes:

- Fixed hang in replace all when the query contained non-ASCII text and
regex-special characters
2026-04-22 10:47:52 -06:00
Conrad Irwin
ce08d965bc
Fix cmd-e on macOS to behave more like it should (#54451)
Closes #50578

Release Notes:

- Fixed cmd-e on macOS to work when `seed_search_query_from_cursor` has
been changed
2026-04-21 19:54:02 +00:00
Cameron Mcloughlin
da6ac6c551
workspace: Add separate "format and save" action (#53710)
Release Notes:

- Added `workspace: format and save` action which always formats,
regardless of settings
2026-04-14 16:20:05 +01:00
saberoueslati
1ac669d108
editor: Fix selection occurrence highlights during regex buffer search (#52611)
## Context

When using regex buffer search (e.g. `^something`), Zed correctly
navigates only to actual matches. However, navigating to a match selects
the matched text, which triggers the **selection occurrence highlight**
feature. That feature performs a *plain literal* search for the selected
word and highlights all occurrences, including ones that don't satisfy
the regex. The user would see a 4th mid-line occurrence highlighted,
even though `^something` never matched it, this behavior is quite
confusing.

The fix tracks whether the current selection was set by search
navigation via a new `from_search: bool` on `SelectionEffects`. When
`last_selection_from_search` is set and `BufferSearchHighlights` are
active, selection occurrence highlights are suppressed. Making a manual
text selection during an active search clears the flag, restoring normal
occurrence-highlight behavior.

The behavior now matches how VSCode handles this case.

The video below demonstrates the behavior after the fix and shows that
it matches the VSCode behavior now

[Screencast from 2026-03-28
01-33-46.webm](https://github.com/user-attachments/assets/07a005b8-53b1-4abf-93d2-96406f0b6a11)

Closes #52589

## How to Review

Three files changed — read in this order:

1. **`crates/editor/src/editor.rs`** Adds `from_search: bool` to
`SelectionEffects` (with a builder method) and
`last_selection_from_search: bool` to `Editor`.
`selections_did_change()` records the flag from effects.
`prepare_highlight_query_from_selection()` returns `None` early when
both `last_selection_from_search` and active `BufferSearchHighlights`
are set.

2. **`crates/editor/src/items.rs`** `activate_match()` now calls
`.from_search(true)` on its `SelectionEffects` so search-driven
selections are marked at the source.

3. **`crates/search/src/buffer_search.rs`** Regression test
`test_regex_search_does_not_highlight_non_matching_occurrences`:
verifies that after search navigation, `SelectedTextHighlight` is
suppressed and exactly 3 `BufferSearchHighlights` exist; and that after
a manual selection, `SelectedTextHighlight` is restored.

## Self-Review Checklist

- [x] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Fixed regex buffer search highlighting non-matching word occurrences
via the selection occurrence highlight feature
2026-04-13 23:25:28 -07:00
Kirill Bulatov
4f3e4d2f46
Stop highlighting selection matches in the search inputs (#53307)
Follow-up of https://github.com/zed-industries/zed/pull/52553

Restores previous search inputs' behavior where no extra highlights were
applied.

Before:


https://github.com/user-attachments/assets/38b6e70c-d5d5-4e06-abec-97d20af44f39

After: 


https://github.com/user-attachments/assets/6e4b3931-adf0-4c2a-afc3-f3c839fc9add


Release Notes:

- N/A
2026-04-07 19:17:49 +03:00
Jozsef Lazar
43867668f4
Add query and search options to pane::DeploySearch action (#47331)
Extend the DeploySearch action to accept additional parameters for
configuring the project search from keymaps:

- query: prefilled search query string
- regex: enable regex search mode
- case_sensitive: match case exactly
- whole_word: match whole words only
- include_ignored: search in gitignored files

With this change, the following keymap becomes possible:

```json
["pane::DeploySearch", { "query": "TODO|FIXME|NOTE|BUG|HACK|XXX|WARN", "regex": true }],
```

Release Notes:

- Added options to `pane::DeploySearch` for keymap-driven search
initiation
2026-04-07 19:11:39 +03:00
Ahmet Kaan Gümüş
fd4d8444cf
markdown_preview: Add search support to markdown preview (#52502)
Context

The markdown preview had no search functionality — pressing Ctrl+F did
nothing. This PR implements the SearchableItem trait for
MarkdownPreviewView, enabling in-pane text search with match
highlighting and navigation.

  Changes span four crates:

- project: Added SearchQuery::search_str() — a synchronous method to
search plain &str text, since the existing search() only works on
BufferSnapshot.
- markdown: Added search highlight storage to the Markdown entity and
paint_search_highlights to MarkdownElement. Extracted the existing
selection painting into a reusable paint_highlight_range helper to avoid
duplicating quad-painting logic.
- markdown_preview: Implemented SearchableItem with full match
navigation, active match tracking, and proper SearchEvent emission
matching Editor behavior.
- Keymaps: Added buffer_search::Deploy bindings to the MarkdownPreview
context on all three platforms.
  
The PR hopefully Closes
https://github.com/zed-industries/zed/issues/27154

  How to Review

1. crates/project/src/search.rs — search_str method at the end of impl
SearchQuery. Handles both Text (AhoCorasick) and Regex variants with
whole-word and multiline support.
  2. crates/markdown/src/markdown.rs — Three areas:
    - New fields and methods on Markdown struct (~line 264, 512-548)
- paint_highlight_range extraction and paint_search_highlights (~line
1059-1170)
    - The single-line addition in Element::paint (~line 2003)
3. crates/markdown_preview/src/markdown_preview_view.rs — The main
change. Focus on:
- SearchEvent::MatchesInvalidated emission in schedule_markdown_update
(line 384)
    - EventEmitter<SearchEvent> and as_searchable (lines 723, 748-754)
- The SearchableItem impl (lines 779-927), especially active_match_index
which computes position from old highlights to handle query changes
correctly
  4. Keymap files — Two lines each for Linux/Windows, one for macOS.

  Self-Review Checklist

- [ x ] I've reviewed my own diff for quality, security, and reliability
- [ x ] Unsafe blocks (if any) have justifying comments (no unsafe)
- [ x ] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
(should be 😄 )
- [ - ] Tests cover the new/changed behavior (not sure)
- [ - ] Performance impact has been considered and is acceptable (I'm
not sure about it and it would be nice to see experienced people to
test)


Release Notes:
- Added search support (Ctrl+F / Cmd+F) to the markdown preview

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2026-04-06 16:42:20 +00:00
Dino
c0f01c4278
Update futures to 0.3.32 (#52910)
As part of the work that is being developed for the Project Panel's Undo
& Redo system, in
https://github.com/zed-industries/zed/tree/5039-create-redo , we're
implementing an asynchronous task queue which simply receives a message
with the operation/change that is meant to be carried out, in order to
ensure these run in a sequential fashion.

While trying to use `futures_channel::mpsc::Receiver`, it was noted that
`recv` method was not available so this Pull Request updates the
`futures` crate to `0.3.32`, where it is available.

This version also deprecates `try_next` in favor of `try_recv` so this
Pull Request updates existing callers of `try_next` to use `try_recv`,
which was mostly updating the expected return type from
`Result<Option<T>>` to `Result<T>`.

Co-authored-by: Yara <git@yara.blue>
2026-04-05 23:05:35 +01:00
Danilo Leal
9537861e45
Refine split diff icons (#53022)
Follow-up to https://github.com/zed-industries/zed/pull/52781, adding
some different icons to better express the state in which the split diff
_is selected_ but _isn't active_, which happens when the editor is
smaller than a given amount of defined columns.


https://github.com/user-attachments/assets/2e7aaf6c-077f-4be5-9439-ce6c2050e63d

Release Notes:

- N/A
2026-04-02 19:17:29 -03:00
Cole Miller
2a15bf630d
Require multibuffer excerpts to be ordered and nonoverlapping (#52364)
TODO:
- [x] merge main
- [x] nonshrinking `set_excerpts_for_path`
- [x] Test-drive potential problem areas in the app
- [x] prepare cloud side
- [x] test collaboration
- [ ] docstrings
- [ ] ???

## Context

### Background

Currently, a multibuffer consists of an arbitrary list of
anchor-delimited excerpts from individual buffers. Excerpt ranges for a
fixed buffer are permitted to overlap, and can appear in any order in
the multibuffer, possibly separated by excerpts from other buffers.
However, in practice all code that constructs multibuffers does so using
the APIs defined in the `path_key` submodule of the `multi_buffer` crate
(`set_excerpts_for_path` etc.) If you only use these APIs, the resulting
multibuffer will maintain the following invariants:

- All excerpts for the same buffer appear contiguously in the
multibuffer
- Excerpts for the same buffer cannot overlap
- Excerpts for the same buffer appear in order
- The placement of the excerpts for a specific buffer in the multibuffer
are determined by the `PathKey` passed to `set_excerpts_for_path`. There
is exactly one `PathKey` per buffer in the multibuffer

### Purpose of this PR

This PR changes the multibuffer so that the invariants maintained by the
`path_key` APIs *always* hold. It's no longer possible to construct a
multibuffer with overlapping excerpts, etc. The APIs that permitted
this, like `insert_excerpts_with_ids_after`, have been removed in favor
of the `path_key` suite.

The main upshot of this is that given a `text::Anchor` and a
multibuffer, it's possible to efficiently figure out the unique excerpt
that includes that anchor, if any:

```
impl MultiBufferSnapshot {
    fn buffer_anchor_to_anchor(&self, anchor: text::Anchor) -> Option<multi_buffer::Anchor>;
}
```

And in the other direction, given a `multi_buffer::Anchor`, we can look
at its `text::Anchor` to locate the excerpt that contains it. That means
we don't need an `ExcerptId` to create or resolve
`multi_buffer::Anchor`, and in fact we can delete `ExcerptId` entirely,
so that excerpts no longer have any identity outside their
`Range<text::Anchor>`.

There are a large number of changes to `editor` and other downstream
crates as a result of removing `ExcerptId` and multibuffer APIs that
assumed it.

### Other changes

There are some other improvements that are not immediate consequences of
that big change, but helped make it smoother. Notably:

- The `buffer_id` field of `text::Anchor` is no longer optional.
`text::Anchor::{MIN, MAX}` have been removed in favor of
`min_for_buffer`, etc.
- `multi_buffer::Anchor` is now a three-variant enum (inlined slightly):

```
enum Anchor {
    Min,
    Excerpt {
        text_anchor: text::Anchor,
        path_key_index: PathKeyIndex,
        diff_base_anchor: Option<text::Anchor>,
    },
    Max,
}
```

That means it's no longer possible to unconditionally access the
`text_anchor` field, which is good because most of the places that were
doing that were buggy for min/max! Instead, we have a new API that
correctly resolves min/max to the start of the first excerpt or the end
of the last excerpt:


```
impl MultiBufferSnapshot {
    fn anchor_to_buffer_anchor(&self, anchor: multi_buffer::Anchor) -> Option<text::Anchor>;
}
```
- `MultiBufferExcerpt` has been removed in favor of a new
`map_excerpt_ranges` API directly on `MultiBufferSnapshot`.

## Self-Review Checklist

<!-- Check before requesting review: -->
- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
Co-authored-by: Jakub Konka <kubkon@jakubkonka.com>
Co-authored-by: Conrad <conrad@zed.dev>
2026-04-01 17:25:32 +00:00
Max Brunsfeld
fb87786375
Automatically switch to unified diffs when diff view is narrower than a configurable "minimum split diff width" (#52781)
Release Notes:

- The git diff diff view now automatically switches from split mode to
unified mode when the pane is narrower than a configurable minimum
column count. You can configure this via the new
`minimum_split_diff_width` setting.
2026-03-30 18:47:50 -07:00
Conrad Irwin
7d3ccce952
Don't auto-close in search (#52553)
This was incidentally broken when we switched to the auto_height editor

Self-Review Checklist:

- [ ] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [ ] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [ ] Tests cover the new/changed behavior
- [ ] Performance impact has been considered and is acceptable

Closes #52124

Release Notes:

- Disabled autoclose of brackets in the project search
2026-03-27 11:30:51 -06:00
Anthony Eid
852b4fc5f4
git_graph: Implement basic search functionality (#51886)
## Context

This uses `git log` to get a basic search working in the git graph. This
is one of the last blockers until a full release, the others being
improvements to the graph canvas UI.

## Self-Review Checklist

<!-- Check before requesting review: -->
- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A

---------

Co-authored-by: Remco Smits <djsmits12@gmail.com>
Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
2026-03-27 11:10:01 -04:00
Piotr Osiewicz
93e641166d
theme: Split out theme_settings crate (#52569)
Self-Review Checklist:

- [ ] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [ ] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [ ] Tests cover the new/changed behavior
- [ ] Performance impact has been considered and is acceptable

Closes #ISSUE

Release Notes:

- N/A
2026-03-27 14:41:25 +01:00
Giorgi Merebashvili
4b1a2f3ad8
search: Fix focus replacement field when opening replace (Ctrl+H) (#51061)
Previously, focus stayed on the search bar because a pre-focus check
`handle.is_focused(window)` was always false at deploy time.

Before you mark this PR as ready for review, make sure that you have:
- [x] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [x] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- Fixed: When opening find-and-replace with `Ctrl+H`, the replacement
input is now focused instead of the search bar.
2026-03-23 09:12:00 +00:00
claire
b0e35b6599
Allow search/replace to span multiple lines (#50783)
Closes #49957 

Also adds `start_of_input` context, and modifies both
`{start,end}_of_input` to work for both single line and auto height
editor modes.


https://github.com/user-attachments/assets/e30f2b20-a96c-49d5-9eb6-3c95a485d14a

Before you mark this PR as ready for review, make sure that you have:
- [x] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [x] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- Added support for multi-line search and replace input in Buffer Search
and Project Search

---------

Co-authored-by: Nathan Sobo <nathan@zed.dev>
2026-03-19 11:10:14 -06:00
Om Chillure
e5dc2f06c9
search: Fix replace all being silently dropped (#50852)
Fixes #50848

### Problem
When Replace All was triggered with a stale search query (i.e., the
query text had changed since the last completed search), the old code
ould restart the search and immediately return, silently discarding the
replace-all intent. This caused the Replace All action to appear to do
nothing on the first try, only working on subsequent attempts once
results were already loaded.

### Fix :
Fix this by introducing a `pending_replace_all` flag on
ProjectSearchView. When Replace All is invoked while a search is in
flight or the query is stale, the flag is set and the action is
deferred.
Once the search completes and `entity_changed` is called, the flag is
checked and `replace_all` is automatically dispatched.

Also disable the Replace Next button in the UI while a search is
underway, since it cannot meaningfully act without up-to-date results.

### Release Notes:

- Fixed "Replace All" in project search not working on the first attempt
when the search query was changed or results hadn't loaded yet.
2026-03-19 15:19:03 +00:00
João Soares
0238d2d180
search: Fix deleted files persisting in project search results (#50551)
Closes #50524

When a file is deleted while project search results are displayed, the
deleted file's buffer was kept alive by the search multibuffer and would
reappear on re-search.

**Root cause:** `Search::into_handle()` treated buffers without a
`project_entry_id()` (which happens when `DiskState::Deleted`) as
"unnamed buffers" and fed them
directly into the search pipeline. The multibuffer's strong
`Entity<Buffer>` reference kept the buffer alive.

**Fix:**
- Filter deleted-file buffers from search candidates in `into_handle()`
and `all_loaded_buffers()`
- Subscribe to `FileHandleChanged` events on the search multibuffer to
proactively remove deleted files from existing results

Before you mark this PR as ready for review, make sure that you have:
- [x] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

### Video:

https://drive.google.com/file/d/1pEz6JywFcZlz8aiXbLOxIdj84SQWLIiF/view?usp=sharing

Release Notes:

- Fixed deleted files persisting in project search results
2026-03-19 16:09:15 +01:00
Suphachai Phetthamrong
5d7e10e2e8
search: Fix project search tooltip keybinding hint disappearing (#51568)
What
---
The keybinding hint in the Project Search status bar button tooltip
disappears shortly after the tooltip appears, while the label "Project
Search" remains. This is most reproducible with no file open.

Why
---
`SearchButton` used `Tooltip::for_action` with no stored focus handle,
so `KeyBinding::render` called `window.focused(cx)` at render time to
resolve the `pane::DeploySearch` binding. When the `Tooltip` entity
re-rendered (it subscribes to theme settings changes) and the focused
element was no longer in a `Pane` key context, the keybinding lookup
failed silently and the shortcut hint vanished.

Fix
---
Store the active pane item's `FocusHandle` in `SearchButton` via
`set_active_pane_item` and use `Tooltip::for_action_in` so the
keybinding is always resolved against a stable `Pane` context. Falls
back to `Tooltip::for_action` when no pane item is active.

Closes #51562

Test Plan
---

- [x] `cargo fmt --check`
- [ ] `cargo test --workspace`
   - currently blocked by an unrelated compile error test 
- tests::test_terminal_kill_allows_wait_for_exit_to_complete ... FAILED
- [x] Manual verification of:
- Try to reproduce the issue and the keyboard shortcut visible for as
long as the cursor is hovering over the button.
   
Release Notes
- Fixed Project Search status bar button tooltip keybinding hint
disappearing while hovering

Screenshots
---
Current:
<img width="835" height="496" alt="image"
src="https://github.com/user-attachments/assets/cb1ffdf2-7733-47f6-9030-041459c2734c"
/>

Expected:
<img width="835" height="496" alt="image"
src="https://github.com/user-attachments/assets/84cb54b9-290c-4210-b86b-7ae9f8bf9ac0"
/>

Release Notes:

- N/A
2026-03-17 09:41:17 +00:00
Danilo Leal
4e8937b62d
ui: Refactor the Button component icon methods (#51496)
Previously, if you wanted to have a button that contains icons on both
edges, you'd need to use a `ButtonLike` component, which takes any
children. Meanwhile, the `Button` would only take one icon, where you
could control its position through the `IconPosition` enum. This has
always felt unnecessarily limiting. So, this PR removes this limitation
by adding two new methods to the button: `start_icon` and `end_icon`.

In the meantime, I have also been bothered by the unnecessary
indirection in the `IconButton` due to the existence of the `ButtonIcon`
component. So I figured I could also completely eliminate that by adding
some of its methods directly to the `IconButton` and in the Button, just
using a regular `Icon` component.

---
## Before
```rust
Button::new("id", "Label")
    .icon(IconName::Plus)
    .icon_position(IconPosition::Start)
    .icon_size(IconSize::Small)
    .icon_color(Color::Muted)
```

## After
```rust
Button::new("id", "Label")
    .start_icon(Icon::new(IconName::Check))
    .end_icon(Icon::new(IconName::ChevronDown).size(IconSize::XSmall))
```

This should have no visual impact to the UI.

Release Notes:

- N/A
2026-03-13 14:13:12 -03:00
Piotr Osiewicz
97421c670e
Remove unreferenced dev dependencies (#51093)
This will help with test times (in some cases), as nextest cannot figure
out whether a given rdep is actually an alive edge of the build graph

Closes #ISSUE

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [ ] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- N/A
2026-03-09 13:22:12 +01:00
Kunall Banerjee
32bd95107e
search: Fix popover spacing for split diff buttons (#49655)
Closes #49571.

| Before | After |
|--------|--------|
| <img width="455" height="141" alt="image"
src="https://github.com/user-attachments/assets/538b011d-40e7-4ca5-b3dd-b1b8b993fd8f"
/> | <img width="475" height="187" alt="image"
src="https://github.com/user-attachments/assets/b091320e-726a-4cc7-b9d9-85c27f04c75a"
/> |

Before you mark this PR as ready for review, make sure that you have:
- [x] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [x] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- Fixed popover spacing for split diff buttons
2026-03-01 10:11:15 +00:00
Cole Miller
be5763632d
Start removing callers of legacy excerpt APIs (#50144)
Paving the way to remove `ExcerptId`. Done in this PR:

- Unshipped the stack trace view
- Get rid of `push_excerpts`
- Get rid of some callers of `remove_excerpts`

We still need to remove some calls to `remove_excerpts` and other APIs,
especially in `randomly_edit_excerpts` and collaboration.

Release Notes:

- The stack trace multibuffer view has been removed.

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2026-02-26 10:37:43 -05:00
0x2CA
fc2d805ac8
Fix Collapse All Files button being limited to the current buffer (#50076)
Refactor buffer search bar click handler to use listener pattern

The click handler for the buffer search bar now uses the `cx.listener`
pattern instead of directly dispatching the action. This approach
properly binds the action handler to the component's context and ensures
consistent behavior with other event handlers in the codebase.

Closes #ISSUE

Before you mark this PR as ready for review, make sure that you have:
- [x] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [x] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)


before:


https://github.com/user-attachments/assets/4fe5eaa4-be5c-4fe5-92d6-60a4f2059f7a

after:


https://github.com/user-attachments/assets/31238988-b664-4c4b-b143-e4d09c5f0a62



Release Notes:

- Fixed the "Collapse All Files" button to work globally, now it's
limited to the current buffer

---------

Co-authored-by: Joseph T. Lyons <JosephTLyons@gmail.com>
2026-02-26 15:08:10 +00:00
Cole Miller
512f1f60f2
git: Fix diff view buttons not working when project diff or branch diff is empty (#49884)
Release Notes:

- git: Fixed a bug where the buttons to toggle the split diff view would
have no effect when the diff being viewed was empty.
2026-02-23 19:28:13 -05:00
Kirill Bulatov
e8d453721c
Revert "Enable type on search by default for the project search (#49374)" (#49619)
This reverts commit 1d66bbe06f.

Needs 2 more fixes:

* enter does not move to the first excerpt anymore
* there could be situations when a narrowed search does not decrease the
excerpt enough to see the result onscreen

Release Notes:

- N/A
2026-02-19 16:24:54 +00:00
Kunall Banerjee
8815573101
buffer_search: Don’t hide UI icons if search query is too large (#49493)
Remove tracking of editor width in buffer search, removing the behavior
where the UI icons used in the search bar would be hidden if the search
query need to fill the whole element's width.

Closes #49446.

Release Notes:

- Don’t hide UI icons in buffer search if search query is too large

Co-authored-by: dino <dinojoaocosta@gmail.com>
2026-02-19 15:57:50 +00:00
Kirill Bulatov
1d66bbe06f
Enable type on search by default for the project search (#49374)
Deals with https://github.com/zed-industries/zed/issues/9318
Re-lands https://github.com/zed-industries/zed/pull/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>
2026-02-18 21:39:45 +00:00
Lukas Wirth
7d80412cca
Reduce amount of monomorphizations from FnMut closures (#49453)
Replaces a bunch of `impl FnMut` parameters with `&mut dyn FnMut` for
functions where this is the sole generic parameter.
Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-02-18 12:00:02 +01:00
Coenen Benjamin
b6c48b60ab
search: Fix collapse/expand all button sync (#48773)
Derive collapsed state from `Editor.has_any_buffer_folded` instead of
tracking it separately, removing redundant `ResultsCollapsedChanged` event
and stale `is_collapsed`/`results_collapsed` fields.

Closes #48734 

Release Notes:

- Fixed collapse/expand all button in buffer search and project search
not syncing correctly when toggling individual file sections

---------

Signed-off-by: Benjamin <5719034+bnjjj@users.noreply.github.com>
Co-authored-by: dino <dinojoaocosta@gmail.com>
2026-02-16 12:55:16 +00:00
Kirill Bulatov
ae12c80dca
Revert proejct search on type (#49163)
Reverts the whole "project search on type" set of PRs until we figure
out better ways to deal with flickering between search results
appearing.

Release Notes:

- N/A
2026-02-14 08:31:30 +00:00
holoflash
3023cf3e28
chore: remove no-longer needed search_on_input=false toggle before tests (#49161)
Just cleaning up after myself.

When search_on_input was toggled default [in this
PR](https://github.com/zed-industries/zed/pull/42889/changes/1f831e028d4de9e872a78b0af8b9d24e33f7d3c7)
I toggled it to false before a few tests that weren't expecting it.

Then [this PR changed](https://github.com/zed-industries/zed/pull/49150)
it to be false by default and the extra toggle before the tests slipped
through.

Think it's a good idea to remove this to avoid any confusion in the
future.
@SomeoneToIgnore 


Release Notes:

- N/A
2026-02-14 08:18:48 +00:00
Kirill Bulatov
a0eb63d1af
Fix search on input behavior (#49150)
Follow-up of https://github.com/zed-industries/zed/pull/42889

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

Release Notes:

- N/A
2026-02-13 23:20:13 +00:00
holoflash
fee42e1d89
Add search_on_input setting to Project Search (#42889)
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
<img width="911" height="618" alt="Screenshot 2025-11-17 at 16 17 09"
src="https://github.com/user-attachments/assets/8eaaab65-684e-4c5f-9a3c-9cb62cff0925"
/>
### settings.json
Set to false by default
<img width="396" height="193" alt="Screenshot 2025-11-17 at 16 18 21"
src="https://github.com/user-attachments/assets/90ebda95-c454-4bc5-8423-5da593832fd2"
/>

### Video demo:

https://github.com/user-attachments/assets/715d6b77-3a61-45f8-8e1a-9bd880c697c3

- Search input is debounced with 250ms in this mode (cool?)


The desire for this feature has been expressed here too:
https://github.com/zed-industries/zed/discussions/30843

Release Notes:

- Enabled project search on input. Can be turned off with
`search.search_on_input` settings toggle.
2026-02-13 17:54:17 +02:00
Dream
015913afea
search: Support brace syntax in project search include/exclude patterns (#47860)
Closes #47527
## Summary
The include/exclude filters in Project Search now support standard glob
brace syntax like `{a,b}`.
**Before:** `crates/{search,project}/**/file.rs` would error with
"unclosed alternate group"
**After:** Pattern correctly matches files in both `crates/search/` and
`crates/project/`
## Implementation
Added `split_glob_patterns()` function that splits by comma only when
not inside braces, preserving the `{a,b}` syntax that `globset` natively
supports.

Release Notes:

- Added support for `{a,b}` glob syntax in project search
include/exclude filters

Here is the screenshot of before and after.

Before:
<img width="1414" height="408"
alt="{0233D673-E876-4CFC-81BC-E0DE778CA382}"
src="https://github.com/user-attachments/assets/f30170a8-6cb5-4ee6-9c30-fb21b2c18be5"
/>

After:
<img width="1271" height="635"
alt="{321F7C80-13A0-4478-BCE9-530F1824A9E2}"
src="https://github.com/user-attachments/assets/0bd70a01-d576-438f-9286-01aebb08aeaf"
/>
2026-02-12 15:00:31 +02:00
Richard Feldman
ee3f40fe25
Re-add MultiWorkspace (#48800)
Release Notes:

- Added agent panel restoration. Now restarting your editor won't cause
your thread to be forgotten.

---------

Co-authored-by: Anthony Eid <56899983+Anthony-Eid@users.noreply.github.com>
Co-authored-by: Eric Holk <eric@zed.dev>
Co-authored-by: Danilo Leal <67129314+danilo-leal@users.noreply.github.com>
Co-authored-by: Anthony Eid <anthony@zed.dev>
Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
Co-authored-by: Cameron Mcloughlin <cameron.studdstreet@gmail.com>
2026-02-12 01:06:23 +00:00
Mikayla Maki
83de8a25e0
Revert PRs for landing in main (#48969)
We're going to re-apply these after landing the multiworkspace branch.

Release Notes:

- N/A
2026-02-12 00:28:17 +00:00
Katie Geer
f233ae4c29
Add telemetry for user-facing notifications (#48558)
## Summary

Adds a "Notification Shown" telemetry event that fires whenever a
user-facing notification is displayed in Zed. This helps the team
understand error patterns, notification frequency, and which parts of
the application generate the most notifications.

## Event Schema

| Property | Type | Description |
|----------|------|-------------|
| `notification_type` | `string` | `"error"` or `"notification"` |
| `source` | `string` | Origin category (e.g., `lsp`, `git`, `settings`,
`editor`) |
| `lsp_name` | `string?` | Language server name (only for LSP
notifications) |
| `level` | `string?` | Severity: `"critical"`, `"warning"`, or `"info"`
|
| `has_actions` | `bool` | Whether the notification has action buttons |
| `notification_id` | `string` | Debug string of the NotificationId |
| `is_auto_dismissing` | `bool` | Whether the notification
auto-dismisses |

## NotificationSource Categories

A new `NotificationSource` enum categorizes notifications by origin:

- `lsp` - Language server notifications
- `settings` - Settings/keymap parse errors
- `update` - App updates, release notes
- `extension` - Extension suggestions/errors
- `git` - Git operations, commit errors
- `project` - Project-level issues
- `collab` - Collaboration notifications
- `remote` - SSH/remote project errors
- `file` - File access errors
- `editor` - Editor operations (search, encoding)
- `agent` - AI assistant notifications
- `cli` - CLI installation
- `system` - Generic fallback

## Privacy

**Message content is intentionally not included** in telemetry because:
- LSP messages come from external servers and may contain file paths or
error chains
- Error messages may contain sensitive paths or API-related information
- The metadata alone provides sufficient insight for error tracking

## Implementation

Updated function signatures to include `NotificationSource`:
- `show_notification(id, source, cx, build_fn)`
- `show_toast(toast, source, cx)`
- `show_error(err, source, cx)`
- `show_app_notification(id, source, cx, build_fn)`
- `notify_err(workspace, source, cx)`
- `notify_async_err(source, cx)`
- `notify_app_err(source, cx)`
- `detach_and_notify_err(source, window, cx)`

Release Notes

- N/A (internal telemetry change)

---------

Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
2026-02-11 10:21:37 -08:00
Cole Miller
f7314976bd
git: Enable the split diff for everyone (#48912)
Release Notes:

- Added support for viewing diffs in split ("side by side") mode
2026-02-11 06:28:55 +00:00
Cole Miller
05e99dad54
git: Standardize nomenclature for side-by-side diff (#48910)
"Unified" for the old view, and "split" for the new one.

Release Notes:

- N/A
2026-02-11 05:33:03 +00:00
Cole Miller
6f09ead50e
git: Add click with modifier to set default for side-by-side diff toolbar buttons (#48908)
Release Notes:

- N/A
2026-02-11 05:07:50 +00:00