Commit Graph

40894 Commits

Author SHA1 Message Date
Parker Loflin f070c7ff6c settings: Make SettingsFile::Global compare equal to itself (#67121)
## Summary

`Ord for SettingsFile` had no `(Global, Global)` arm, so
`Global.cmp(&Global)` returned `Less`. Each global settings parse added
a duplicate `file_errors` entry, and lookups of `Global` returned
`None`. Nothing reads `Global` errors, so there is no user-visible
change.

## Testing

- `test_file_ord` now includes `Global` and checks `cmp` on every pair.
It fails without the fix.
- `cargo test -p settings` and `./script/clippy -p settings` pass.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- N/A
2026-11-18 09:50:35 +00:00
Parker Loflin 881c618a6a Remove dead code in client, call, channel, and collab (#67126)
## Summary

Removes unused code. No behavior changes.

- `client`:
- unused `UserStore` methods, including `contact_updates_done`, the only
sender of `UpdateContacts::Wait`, so the variant also goes
  - `Telemetry::report_assistant_event` and `has_checksum_seed`
  - `Client::override_rpc_url`
  - `InviteInfo`
  - four `zed_urls` helpers
- `call`, `channel`: unused `Room` and `ChannelStore` helpers. The
collaborators handler no longer emits `CollaboratorsChanged` and
notifies twice, because `replace_collaborators` already does both.
- `collab`: unused DB types, `ChannelRole` predicates, and `Config` and
`ConnectionPool` helpers. `return Err(..)?;` becomes `Err(..)?;`.
- `livekit_api`: the empty `LiveKitParticipantUpdate`.
- `#[allow]`s that no longer suppress anything, including in `id_type!`
and the `non_snake_case` ones in `proto` and `rpc`.

## Testing

- `./script/clippy`
- `cargo test -p client -p call -p channel -p collab -p rpc -p proto -p
livekit_api` (Postgres-backed DB tests not run locally)

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- N/A
2026-11-18 09:49:23 +00:00
Parker Loflin 1ab8b9abfb edit_prediction_cli: Fix total token percentiles (#67124)
## Summary

`print_report` sorted the inserted and deleted token counts separately,
then added them by rank, so "Total tokens" percentiles mixed counts from
different predictions. It now adds each prediction's counts before
sorting.

## Testing

- `token_totals_are_summed_per_prediction` checks the sorted totals. It
fails without the fix.
- `cargo test -p edit_prediction_cli` and `./script/clippy` pass.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- N/A
2026-11-18 09:39:00 +00:00
Guilherme Moura 3fd0253081 agent_ui: Keep Follow toggle off after idle disable (#63467)
# Objective

Fixes #62973.

The Agent panel Follow toggle did not stick after you turned it off.
Once Follow had been on, every later message turned the icon back on.

## Solution

`ThreadView::toggle_following` only called `workspace.unfollow` /
`follow` while the thread was `Generating`. Turning Follow off while
idle updated `should_be_following` but left the workspace still
following the Agent. At the end of the next successful turn,
`should_be_following` is copied from
`workspace.is_being_followed(Agent)`, so that leftover follow state
flipped the icon back on.

The toggle now always applies follow/unfollow. The end-of-turn sync is
unchanged (it still remembers unfollow-by-navigating-away
mid-generation). `ChatWithFollow` (`cmd-enter`) is unchanged.

## Testing

- Reproduced the bug on the macOS `Zed.app` build.
- Applied the change, built `cargo build -p zed`, and ran
`target/debug/zed`.
- Same steps after the fix: turn Follow on, turn it off while idle, send
a message. The icon stayed off.
- Follow still works when turned back on.
- No new unit test: this path needs a live `Workspace`, and there is no
existing harness around `toggle_following`.

## 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 adheres to Zed's UI standards
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

## Showcase

Before (`Zed.app`): turn Follow off while idle, send a message, the icon
comes back on.



https://github.com/user-attachments/assets/3b98714a-42a0-4215-accb-0e2e6fd3213c



After (debug build with this change): same steps, the icon stays off.



https://github.com/user-attachments/assets/bb4dbf67-c937-409d-a79c-015bb3538d64



---

Release Notes:

- Fixed the Agent panel Follow toggle turning itself back on after being
disabled ([#62973](https://github.com/zed-industries/zed/issues/62973))

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
2026-11-18 09:36:05 +00:00
Parker Loflin 705b429e78 multi_buffer: Sync only changed buffers (#67053)
## Summary

A change to any buffer made the multibuffer's next sync read every
buffer and diff, and adding a buffer counted as a change. With N
buffers, each change cost O(N). Inserting excerpts syncs first, so
building a multibuffer one path at a time took O(N²) time on the main
thread. Project search, project diagnostics, multi-file git diffs, and
find references all build their multibuffers this way.

The multibuffer keeps a set of the buffers that changed or were added
since the last sync, and a sync reads only those buffers and their
diffs. `Buffer::record_changes` takes this set in place of a changed
flag, and each buffer adds its ID when it changes. The snapshot stores
each buffer's dirty, deleted-file, and conflict flags and counts how
many buffers have each one, so `is_dirty`, `has_deleted_file`, and
`has_conflict` don't scan every buffer.

This also fixes three cases where the multibuffer stayed out of date
until another buffer changed:

- The `Buffer` methods `did_reload`, `set_capability`, `set_conflict`,
and `set_agent_selections` changed dirty, conflict, or selection state
without marking the buffer as changed.
- Removing a buffer didn't update `is_dirty`, `has_deleted_file`, or
`has_conflict`.
- `MultiBuffer::clone` dropped changes that the original hadn't synced
yet.

Benchmark: a test searches an in-memory project of N files, with two
matches in each, in a `ProjectSearchView`. Both versions call
`MultiBuffer::sync_from_buffer_changes` N + 1 times, and sync time is
the total of those calls. Release build, single-threaded GPUI test
executor, multibuffer and worktree invariant checks off, Ryzen 7
9800X3D, median of five alternating runs of `main` and this branch:

| Files | Sync before | Sync after | Sync speedup | Search before |
Search after | Search speedup |
|---|---|---|---|---|---|---|
| 1,000 | 49.4 ms | 2.4 ms | 21× | 4.21 s | 4.13 s | 1.02× |
| 2,000 | 216.3 ms | 5.2 ms | 42× | 10.59 s | 10.24 s | 1.03× |
| 4,000 | 928.5 ms | 9.8 ms | 95× | 30.17 s | 28.83 s | 1.05× |

## Testing

- `test_dirty_state_across_buffers` checks `MultiBuffer::is_dirty`
across three buffers through edits, saves, a reload, a capability
change, and an excerpt removal. It fails on `main` at the reload.
- `test_deleted_file_and_conflict_state_across_buffers` marks two
buffers deleted, then conflicted, without editing them, and clears or
removes them one at a time. Each flag stays set until its last buffer is
cleared or removed. It fails on `main` at the first conflict check.
- `test_clone_with_pending_changes` clones a multibuffer before it syncs
a buffer edit and checks that both copies show the edit. It fails on
`main`, where the clone misses the edit.
- After each mutation, the randomized multibuffer tests check that each
buffer's snapshot matches the buffer's version and flags, and that the
counts agree with the flags.
- `cargo test -p multi_buffer`, `cargo test -p editor -p search -p
language`, and `./script/clippy -p multi_buffer -p language` pass, as do
the randomized multibuffer tests with `ITERATIONS=300`.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- Improved performance of multibuffers with many files, such as large
project search results
2026-11-18 09:34:07 +00:00
tidely 5b282ac8bb gpui: Add simulate_window_scale_factor_change to HeadlessAppContext (#67113)
## Summary

I was writing a skill for agents to iterate on their GPUI UI changes by
screenshotting frames in a headless app context, and I ran into this
missing function, which meant all headless renders used the same scale
factor. There are likely many other functions that could be useful if
forwarded, but this is the first one I ran into.

## Testing

Ran a heavier test locally, but not worth pushing here

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- N/A
- [GPUI] Added `simulate_window_scale_factor_change` to
`HeadlessAppContext`
2026-11-18 07:38:13 +00:00
Parker Loflin bb5e6dfd07 project_panel: Show the empty-name error for whitespace-only names (#67125)
## Summary

#38744 made the empty-name check `filename.is_empty()` inside `if
!filename.is_empty()`, so it never ran. Names made only of whitespace
got the leading or trailing whitespace warning instead of "File or
directory name cannot be empty." The check is now
`filename.trim().is_empty()`.

## Testing

- `test_whitespace_only_filename_is_reported_as_empty` enters spaces as
a new file's name and checks for the error. It fails without the fix.
- `cargo test -p project_panel` and `./script/clippy` pass.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- Fixed the project panel showing the wrong message for whitespace-only
file names

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
2026-11-18 05:53:08 +00:00
Parker Loflin 96362135eb path: Compare RelPaths without splitting them into components (#67023)
## Summary

`RelPath`'s `Ord` compared `components()`, splitting both paths at every
separator. It now compares bytes, ranking `/` below every other byte,
and skips equal 16-byte chunks first. Components never contain `/`, so
the order is the same.

The worktree snapshot keys `entries_by_path` by `RelPath`, so the
background scanner compares paths for every insert and lookup. It does
that while holding `BackgroundScanner::state`, which workers hold for
about 90% of an initial scan, so the comparison sets how fast the scan
finishes.

One comparison, outside Zed in a release build:

| Pair | Before | After |
|---|---|---|
| Equal paths | 75.9 ns | 3.7 ns |
| Siblings at depth 6 | 71.8 ns | 2.1 ns |
| Different top-level directories | 13.8 ns | 1.3 ns |
| Parent and child | 66.2 ns | 3.5 ns |
| `a/b` and `a.b` | 35.2 ns | 1.3 ns |
| 200-byte name, last byte differs | 23.3 ns | 5.9 ns |
| 16 one-byte components | 198.3 ns | 4.0 ns |
| Random pairs from the Linux snapshot | 38.2 ns | 7.2 ns |
| Neighbours in the sorted Linux snapshot | 78.4 ns | 12.4 ns |

Initial scan with `Worktree::local` and `RealFs` in a headless app, one
scan per process, warm file cache, Ryzen 7 9800X3D (16 threads), median
of alternating runs (9 per variant, 5 for Firefox):

| Tree | Entries | Wall before | Wall after | CPU before | CPU after |
|---|---|---|---|---|---|
| Linux snapshot as empty files, tmpfs | 72,680 | 333.6 ms | 212.2 ms |
1,210 ms | 1,184 ms |
| Linux checkout | 120,916 | 615.4 ms | 360.7 ms | 2,126 ms | 2,034 ms |
| Firefox checkout | 532,906 | 4.38 s | 2.29 s | 11.62 s | 10.18 s |
| Zed checkout | 5,351 | 45.8 ms | 36.8 ms | 147.8 ms | 144.0 ms |

The snapshot is not a Git repository, so the scan defers directories
deeper than `file_scan_depth`. Both versions found the same entries in
every run.

## Testing

- `test_rel_path_cmp_matches_component_order` is new. It checks the
order against `components()` for pairs that differ at or around a
separator, prefixes, non-ASCII names, and paths with NUL bytes, such as
the keys that `tree_sort_path` builds. It also checks each pair with
15-, 16-, and 32-byte directory prefixes prepended, so the 16-byte chunk
loop runs.
- Outside Zed, the new comparison agreed with `components()` on 8
million random pairs, including paths with NUL bytes, and returned
`Equal` only for equal paths. Both comparisons sort the 103,708 paths of
the Linux snapshot in the same order, as plain paths and as
`tree_sort_path` keys.
- `cargo test -p path`, `cargo test -p util`, `cargo test -p worktree`,
`cargo test -p project_panel`, and `cargo test -p git_ui` pass.
- `cargo test -p project --features test-support --test integration`
passes.
- `./script/clippy -p path` passes.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- Improved the time to scan large projects when they are opened
2026-11-18 00:35:29 +00:00
Dmytro Danilenkov 58be7923cf git: Fix broken pipe error when blaming large untracked files (#67110)
## Summary

Split out of #66953.

Zed runs `git blame --contents -` and writes the buffer text into git's
stdin. when the file is not in HEAD (new or untracked), git exits
without reading stdin. if the buffer is over 64KB (checked on my macOS)
the write fails with `Broken pipe` and Zed returns that error instead of
empty blame. I guess on Linux it will also fail because 64 KB is default
pipe size.

steps to reproduce:
1. In git repository create an untracked file larger than 64 KB and open
it in Zed.
2. cmd+shift+p(macOS) and select "Run editor: toggle git blame"
3. On main you should get an error toast containing `Broken pipe`

<img width="1509" height="793" alt="Screenshot 2026-11-17 at 23 20 02"
src="https://github.com/user-attachments/assets/663550fc-44d7-4a57-add4-c45415a73bb9"
/>

the fix: check git exit status first and report the write error only
after that.

after fix no error:
<img width="1509" height="807" alt="Screenshot 2026-11-17 at 23 29 18"
src="https://github.com/user-attachments/assets/f570f228-17c9-4149-93c9-5569cbfc751a"
/>



## Testing
manually tested, no broken pipe error.
Added `test_blame_untracked_path_with_large_contents`. On `main` it
fails with `Broken pipe (os error 32)`; with this change it passes. Ran
the `git` crate tests on macOS.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] N/A UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- Fixed git blame failing with a broken pipe error for large untracked
files.

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-18 00:29:57 +00:00
Dino df5cf7b718 editor: Add action to fold document at the current line's indentation (#66849)
## Summary

Even though the `editor: fold at level X` actions are useful, when I do
want to use those I end up having to figure out the level myself, for
example, when wanting to fold all variants of an `enum` or all
methods/functions in an `impl` block.

As such, this Pull Request introduces a `editor: fold at current
indentation level` action which will take the current line's indentation
level and fold the whole document at that level. This makes it super
easy to, for example, place the cursor in a variant of an `enum`, call
the action and have all the variants visible on screen, regardless of
whether the variants have extra arguments. Refer to the recording below
for an example.

## Testing

Tested both manually, as shown in the recording below, as well as
introduced the following tests:

* `editor::editor_tests::test_fold_at_current_level`
*
`editor::editor_tests::test_fold_at_current_level_is_column_independent_with_injection`
* `editor::editor_tests::test_fold_at_current_level_with_tabs`
*
`editor::editor_tests::test_fold_at_current_level_with_tabs_and_soft_tab_settings`
*
`editor::editor_tests::test_fold_at_current_level_with_spaces_and_hard_tab_settings`
*
`editor::editor_tests::test_fold_at_current_level_with_mixed_indentation`
* `editor::editor_tests::test_fold_at_current_level_ignores_empty_lines`
* `editor::editor_tests::test_fold_at_current_level_on_space_only_lines`
* `editor::editor_tests::test_fold_at_current_level_on_tab_only_lines`
*
`editor::editor_tests::test_fold_at_current_level_with_multiple_cursors`

### Recording


https://github.com/user-attachments/assets/20334b35-c14e-49b9-a2a5-63958709f40e

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- Added `editor: fold at current indentation level` to allow folding the
whole document at the current line's indentation level
2026-11-17 20:57:13 +00:00
Parker Loflin 4122f44f6f worktree: Check ancestor paths once per scanned directory (#67022)
## Summary

`scan_dir` checks each child against `file_scan_exclusions`,
`private_files` and `hidden_files`. Each check matched the child and
every one of its ancestors, so the ancestors of the directory being
scanned were matched again for every child. They are now matched once
per `scan_dir` call, and the loop matches only the child's own path. For
exclusions the directory's part is known to be false, because `scan_dir`
returns early for an excluded directory. The loop also no longer
rebuilds the child's path for the private and hidden checks.

This runs for every entry on initial scans and rescans.

The checks alone, over the 96k entries of the Linux snapshot in the
project panel benchmark with default settings, take 165 ms before and 55
ms after (3.0x). Both versions produced the same excluded, private and
hidden flags for every entry, with `share_private_files` on and off.

Whole initial scan with `Worktree::local` and `RealFs` in a headless
app, one scan per process, warm file cache, Ryzen 7 9800X3D (16
threads), median of alternating runs (9 per variant, 5 for Firefox):

| Tree | Entries | CPU before | CPU after | Wall before | Wall after |
|---|---|---|---|---|---|
| Linux snapshot as empty files, tmpfs | 96,305 | 1,737 ms | 1,603 ms |
494.7 ms | 488.8 ms |
| Linux checkout | 120,916 | 2,210 ms | 2,033 ms | 604.5 ms | 595.2 ms |
| Firefox checkout | 532,488 | 12.60 s | 10.92 s | 4.31 s | 4.23 s |
| Zed checkout | 5,337 | 141 ms | 134 ms | 43.2 ms | 42.9 ms |

CPU time drops 8 to 13% on the large trees. Wall time drops 1 to 2%: the
scan is limited by `BackgroundScanner::state`, which workers hold for
about 90% of the scan, mostly to insert each directory's entries, so
less work outside that lock doesn't shorten it.

## Testing

- `cargo test -p worktree` passes, including
`test_file_scan_exclusions`, `test_hidden_files` and
`test_private_single_file_worktree`.
- `./script/clippy -p worktree` passes.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- N/A
2026-11-17 19:53:23 +00:00
GSGFs7 a701d985a8 Fix missing Vue prop completions when Emmet is enabled (#66936)
## Summary

Closes #66033

Fix completion trigger contexts when multiple language servers are
enabled.

Previously, Zed sent completion contexts based on the combined trigger
chars of all attached servers. With Emmet enabled, lowercase letters
were incorrectly sent to Vue as trigger chars, causing props completions
to be skipped.

Each request now checks the target server's registered trigger
characters before it is sent, falling back to `INVOKED` with no trigger
character when the character was not registered.



https://github.com/user-attachments/assets/ebc032f2-61c6-48d4-a330-bf86099fb3e9


https://github.com/user-attachments/assets/e9161603-11e6-4f4f-9522-9abf9ca184fb

## Testing

Manually verified that typing `pla` in `<Input pla` provides props
completions with both Vue and Emmet language servers enabled.

Added integration tests in
`crates/project/tests/integration/project_tests.rs`:

- Added `test_completion_context_uses_target_server_triggers`, which
covers servers that register `.`, register `a`, and register none, with
both static and dynamic registration.
- Extended
`test_dynamic_completion_registration_honors_document_selector` to
assert the completion context forwarded after dynamic registration and
unregistration.

Run on Linux:

- `cargo test -p project --features test-support` (435 passed)

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [ ] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- Fixed Vue props completions missing when typing lowercase letters with
Emmet enabled.
2026-11-17 17:40:00 +00:00
sandroid 58849026ec helix: Honor use_system_clipboard (#66906)
## Summary

## What problem does this solve, how, and why does this change matter?

Ensures helix mode honors the the configured `use_system_clipboard`
instead of always ignoring it and acting as if the value was
`UseSystemClipboard::Never`.

To be honest, I'm a bit confused why #55455 decided that Helix mode
should deliberately ignore the configured setting, when the desired
behavior ("not clobbering the system clipboard") is already available
with `Never`, maybe @SrGaabriel can shed some light on this? I find the
feature to always copy/paste to/from the system clipboard super handy,
especially when using in combination with a clipboard manager.

closes #66782

## Testing

Enable helix mode. When `use_system_clipboard` is set to `Always` or
`OnYank`, `y` and `p` yank and paste from/to the system clipboard. When
`use_system_clipboard` is set to `Never`, `y` and `p` yank and paste
from/to the internal register.

I mostly duplicated the tests added in #55455 and run them against the
two different scenarios: `Always` and `Never`. For the tests targeting
the specific registers, I removed the assumption about the system
clipboard because IMO this is not what these tests should test. Let me
know if that's fine or if I should iterate on that.

## Self-review

- [X] I've reviewed my diff for quality, security, reliability, and
performance.
- [X] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [X] Tests cover the new or changed behavior.

Release Notes:

- Fixed Helix mode ignoring the `vim.use_system_clipboard` setting.
Yank, delete and paste in Helix mode use the system clipboard by default
again, as they did before 1.28 . If you wish to keep the 1.28 behavior,
set `"vim": { "use_system_clipboard": "never" }` to keep using the
internal register.
2026-11-17 16:48:24 +00:00
Keant b525067c80 Fix empty strip at bottom of commit modal (#67090)
zed/issues/67086

## Summary

What problem does this solve, how, and why does this change matter?
Tidy up the border for commit modal

Closes #67086

Before screenshot in issue
After screenshot attached

<img width="1373" height="598" alt="image"
src="https://github.com/user-attachments/assets/6ec3fab3-3c2a-40d1-bc45-c5becaec29c9"
/>


## Testing

Manually test your changes
How can reviewers test this easily? cargo run and check the commit modal

## Self-review

- [X] I've reviewed my diff for quality, security, reliability, and
performance.
- [X] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [X] Tests cover the new or changed behavior.

Release Notes:

- Fix empty strip at bottom of commit modal
2026-11-17 14:26:43 +00:00
Lorenzo Biassio 698368515d google_ai: Add Extra High thinking level for Gemini 4 Hydrogen (#67011)
## Summary

Following #65572, Zed loads BYOK Gemini models dynamically from Google's
`v1beta/models` catalog, while keeping model-specific thinking level
rules in `google_ai` because the catalog endpoint only reports a boolean
`thinking` flag.

Google's newly released [Gemini 4 Hydrogen
(`gemini-4-hydrogen`)](https://aistudio.google.com/docs/models/gemini-4-hydrogen)
introduces a fourth thinking level (`xhigh` / `"XHIGH"`) and defaults to
`high` rather than `medium` (while rejecting `minimal`). Without
explicit support in `google_ai`, `Extra High` is omitted from Zed's
thinking effort selector and Hydrogen defaults to `Medium`.

This PR:
- Adds `ThinkingLevel::XHigh` (`"Extra High"` / `"xhigh"`, serialized as
`"XHIGH"` on `generateContent` requests).
- Adds `supports_xhigh_thinking` so `Model::from_listed` exposes `[Low,
Medium, High, XHigh]` on `gemini-4-hydrogen` while keeping other
level-based models capped at `High` (ensuring BYOK `stream_completion`
strips `"xhigh"` when switching threads to models that reject it).
- Updates `default_thinking_level` to map `"gemini-4-hydrogen"` to
`ThinkingLevel::High`.
- Filters `request.thinking_effort` against
`config.supported_effort_levels` on hosted Google requests in
`language_models_cloud` before calling `into_google`, matching the BYOK
provider so switching a thread from `xhigh` to a hosted Gemini model
that doesn't accept it falls back to the model default instead of
failing validation.

## Testing

- `cargo test -p google_ai` (33 passed)
- `cargo test -p language_models provider::google::tests` (1 passed)
- `./script/clippy -p google_ai`
- `cargo fmt -p google_ai -p language_models -p language_models_cloud --
--check`

Reviewers with a Gemini API key (or Zed Cloud access) can select `Gemini
4 Hydrogen` in the Agent Panel and verify that thinking effort defaults
to `High`, lists `Low`, `Medium`, `High`, and `Extra High`, and falls
back gracefully when switching to `Gemini 4 Argon` or `Gemini 4 Carbon`.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- Added Extra High thinking effort support and High default thinking
level for Gemini 4 Hydrogen (`gemini-4-hydrogen`).

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
2026-11-17 13:00:41 +00:00
Aakash Bapna 849b5b8e07 onboarding: Keep header pinned while scrolling (#67079)
## Summary

Closes #66920

Make the header section sticky so that finish button is always in
viewport.


Before, the tree was:
```
div (root, scrollbar here)
└─ div#page-content (scrolls)
   └─ v_flex (780px, p_12, gap_6)
      ├─ header row
      ├─ divider
      └─ page body
```
After, it is:
```
v_flex (root)
├─ v_flex  ← header block, flex_none (never scrolls)
│  ├─ header row
│  └─ divider
└─ div (relative, flex_1, min_h_0, scrollbar here)
   └─ div#page-content (scrolls, track_scroll)
      └─ v_flex (780px, px_12, pb_12)
         └─ page body
```
## Testing

I have tested the page in various themes, the header cleanly merges with
the rest of page body without the overhanging padding in sticky section.

Before:
Header (and finish onboarding button) would scroll out of view.
<img width="1496" height="388" alt="Screenshot 2026-11-13 at 12 06
35 PM"
src="https://github.com/user-attachments/assets/2399c54f-58d5-4c87-8517-7deaf7409cbf"
/>


After:
Header sticks to top while the rest of page content scrolls.

<img width="1257" height="783" alt="Screenshot 2026-11-17 at 11 39
15 AM"
src="https://github.com/user-attachments/assets/2569d16a-dd72-48d9-b46a-b900f1885bb1"
/>


https://github.com/user-attachments/assets/07ab374c-cede-4458-95a2-48012bbe738d




## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- Improved the onboarding page to keep the "Finish Setup" button visible
while scrolling.

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
2026-11-17 12:52:39 +00:00
Cameron Mcloughlin 3dcdee6d2b sandbox: New linux sandbox (#67062)
Note: this PR does not change any behaviour of zed itself. The old
sandbox implementation is still in use. The code in this PR is not
considered secure. I'll need more time to torture it before I'm
confident :)

The old sandbox used `bwrap` to set up mounts to restrict FS access, and
an in-sandbox network proxy to forward HTTP requests. It has significant
limitations however:
- it cannot restrict FS access to paths that don't exist at sandbox
creation time. This means that files that become available while a
command is running are unprotected
- it cannot restrict FS access based on a glob - each individual mount
must be specified explicitly
- it cannot restrict network access that is not HTTP (i.e. SSH traffic).
- it cannot change permissions while a sandboxed command is running -
the grants given at the start of the execution are fixed. Agents can
request to re-run the app with broader permissions, which is fine, but
not great UX
- it cannot detect whether a command failed because it hit the sandbox
boundary or not. Again, agents can guess, but we'd like something more
robust
- it cannot dynamically prompt the user to escalate privileges

The new sandbox has a different different design which solves these
problems:
- all restrictions go through seccomp user notifications
- this allows us to register a supervisor process with the kernel to
validate the syscalls of another program. This supervisor can run
arbitrary userspace code to inspect syscalls before
allowing/denying/modifying them
- we create and upload a policy object to this supervisor which checks
syscalls against this policy
- if the policy says that the operation requires "ask"-ing, the
supervisor will ask zed to show a prompt to the user and report a
decision

This design is a lot more unified, and since it is much more flexible,
is also potentially suitable for sandboxing more parts of zed (user
terminals, LSP servers, etc.).

Release Notes:

- N/A
2026-11-17 12:43:21 +00:00
Likeai e5be9608dd worktree: Only treat a directory as a bare repository when HEAD and config are files (#67024)
## Summary

`is_dot_git` decides whether a directory is a bare repository by
checking that a
`HEAD` and a `config` entry exist inside it. The check only tests for
existence,
so any directory that happens to contain entries with those names is
treated as
a bare repository.

A small Rust crate is enough to trigger this:

    exp/
    ├── Cargo.toml
    └── src/
        ├── main.rs
        └── exp/
            ├── mod.rs
            ├── head/
            │   └── mod.rs
            └── config/
                └── mod.rs

where `src/exp/mod.rs` simply declares the two modules:

    pub mod config;
    pub mod head;

On case-insensitive filesystems (macOS by default), `src/exp/HEAD`
resolves to
the `head` module directory, and `src/exp/config` exists, so `src/exp`
matches
the bare-repository heuristic. Zed then registers its parent, the
ordinary
source directory `src/`, as a Git repository. That repository has no
working
directory, so opening it fails in `Repository::check_access` with `bare
repositories do not have a working directory`. The Git panel maps any
access
failure to `GitAccess::No` and shows the "detected dubious ownership"
empty
state, where **Trust Directory** cannot help, since the real problem is
not
ownership.

Because the Git panel follows the repository of the active file, opening
`src/exp/config/mod.rs` silently switches away from the real repository
to the
bogus `src` entry. The stale entry survives restarts until the project
root is
reopened. This is unrelated to linked worktrees; the same layout
reproduces in a
plain checkout. On case-sensitive filesystems the directory must
literally be
named `HEAD` to match.

This change requires both entries to be files rather than merely
present, so
directories named `HEAD`/`head` or `config` no longer register as Git
metadata.
The `.git` fast path is untouched, and real bare repositories still
match because
their `HEAD` and `config` are files (symlinked `HEAD` included, as
`Fs::is_file`
resolves symlinks).

## Testing

Reproduced and manually verified on macOS with a case-insensitive
volume:

1. Create a crate named `exp` with modules `exp::head` and `exp::config`
   (`src/exp/head/mod.rs`, `src/exp/config/mod.rs`) and commit it.
2. Open the crate in Zed and then open `src/exp/config/mod.rs`.
3. Before: the repository selector lists two repositories, `exp` and a
bogus
`src`, and the Git panel for `src` shows the dubious-ownership empty
state.
Selecting `exp` restores Git, but opening the file again switches back
to
`src`. After: only `exp` is listed, and status, staging and committing
work
   for files under `src/exp/`.
4. Confirm no regression for real bare repositories by opening a bare
clone and
a linked worktree of it; both are still detected and their Git features
work.

No automated test was added for this case.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- Fixed Git repository detection treating any directory containing
`HEAD` and
  `config` entries as a bare repository.
  

<img width="2040" height="1122" alt="截图Zed 1116101115"
src="https://github.com/user-attachments/assets/0629d47b-7cf1-41b2-95e3-0e9b631ca4ba"
/>

**After fixed**
  
<img width="1830" height="994" alt="截图zed 1116111127"
src="https://github.com/user-attachments/assets/fd1081c9-353e-48b0-b61a-eaf26ec6eb8e"
/>

---------

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2026-11-17 09:14:48 +00:00
Christopher Eades 6e7c5d3ae8 agent: Accept stringified line numbers in read_file tool (#67072)
## Summary

This addresses when agents send strings for `start_line` and `end_line`
which cause an error:
> string "300", expected u32
The agent can go pathological and blow the context out which causes it
to fail the assigned task worst case, but wastes a lot of tokens
otherwise.

Closes #67071

## Testing

Unit tests have been updated such that testing the string serialized
`start_line` and `end_line`, as well as integers, are now both parsed by
serde. Agent testing with local models, qwen3.8:27b via ollama, no
longer run into the serialization problem.

I've been running a dev compiled binary for about a week with this
change and have used the agent several times in many projects, including
to address another issue with the `terminal` tool leaking instructions
to the agent when the `terminal` has been denied (which I'll open
separately) and the agent is performing well with the dev binary
containing the change to the `read_file` tool.

See the attached screenshots for the previous behavior:

<img width="1257" height="1748" alt="image"
src="https://github.com/user-attachments/assets/0ab948a9-8d8e-40ba-9997-21f6dcccbca3"
/>

The new behavior:

<img width="1610" height="1802" alt="image"
src="https://github.com/user-attachments/assets/4a410892-402b-4702-84d3-3268d7e78a33"
/>

## Self-review

- [X] I've reviewed my diff for quality, security, reliability, and
performance.
- [X] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [X] Tests cover the new or changed behavior.

Release Notes:

- Fixed the agent's `read_file` tool failing when models pass
`start_line`/`end_line` as strings.

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
2026-11-17 07:17:22 +00:00
Jasper 482e76524b fix(git_graph): match log_source to CommitViewOptions reveal_file (#67042)
## Summary

closes #67003

Opening the git graph of a selected file will persist the scope of the
selected file to the commit view and position that file in view
automatically. Other files in the commit are still available to view and
are in the same order as if there was no selected file.

### Before


https://github.com/user-attachments/assets/237292dc-3a56-4f3e-a180-ef702c5a0a88

### After


https://github.com/user-attachments/assets/8bdc5735-2159-46c7-9347-3187f85f5f5d

## Testing

- Open a file in the editor
- Open the context menu on the file and select "View File History"
- Open any commit that has the selected file + any number of additional
files that were changed

The current behavior is that the commit view will open to the first file
rather than the file selected from the editor.

After making the minor updates the behavior of selecting a file to open
it's commit view results in that file being shown on the initial render
of the view.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- N/A
2026-11-16 20:50:25 +00:00
Ted Robertson 4191aeaf50 agent_ui: Check only the clicked pattern in pipeline permission dropdown (#56492)
Closes #55523

When the agent proposes a [chained
command](https://github.com/zed-industries/zed/issues/55523) like `ls &&
git status && git log`, the permission dropdown lists an "Always for `X`
commands" checkbox per sub-command. Clicking one checkbox activates
pattern mode with *all* patterns pre-checked, so the user appeared to be
approving every command in the pipeline even though they had only
clicked one. Pressing Allow then allow-listed every sub-command.

Fix: the first click activates pattern mode with only the clicked
pattern checked. Additional patterns require explicit checks.

**Note**: I've rebased onto `main` after #65039, which moved the
dropdown's selection state into `Conversation`. The dropdown's click
handler and the `ToggleCommandPattern` action handler now both call
`Conversation::toggle_permission_pattern`, so the fix lives in one
place. The duplicated fix and the one-click-behind workaround from the
previous version of this PR are gone.

**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

Release Notes:

- Fixed the agent's permission dropdown for chained terminal commands
checking every command when you clicked only one.

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
2026-11-16 19:20:21 +00:00
Jakub Konka 5709f329dc Support Corgi builds on FHS Linux (#67055)
Upgrade Corgi and the Nix development input to 0.1.107, which supplies a
pinned libstdc++ runtime for Linux builds. Declare the x86_64 native
libraries required to build Zed without host development packages.

Release Notes:

- N/A
2026-11-16 18:14:09 +00:00
Jakub Konka 9925feb84c gpui_web: Drop Shift from symbol keystrokes (#67052)
Browsers report the shifted character as the key, so Shift+1 arrived as
`shift-!` and never matched a `!` binding. Match the Linux platform's
convention and keep Shift only on letters and named keys.

Release Notes:

- [GPUI] Fixed handling of shifted characters to correctly drop the
modifier.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 17:34:29 +00:00
Remco Smits d833d4689d fs: Optimize filesystem watcher path matching by adding fast path for normalizing path (#66990)
## Summary

While I was creating https://github.com/zed-industries/zed/pull/66973 I
still thought that Zed wasn't keeping up at times as fast as I expected,
so I started looking into more in the performance issue and found with
profiling the most time was spend inside the **watcher_ids_covering**
method as you can see inside the profile:

**Before** (before fast path):
<img width="1278" height="465" alt="Screenshot 2026-11-14 at 20 29 22"
src="https://github.com/user-attachments/assets/0f5e5296-7d78-4650-8c0a-5535e62156b8"
/>

**After** (after fast path, see that it only shows that we spend around
900ms normalizing paths for a cargo build now)

<img width="1277" height="462" alt="Screenshot 2026-11-14 at 20 41 25"
src="https://github.com/user-attachments/assets/bfc39454-be94-4b97-a6a1-f55bbd825dee"
/>

My profile shows the following 2 things:

1. We seem to spend alot of time hashing the `WatchKey`.
2. We seem to spend alot of time inside the `folded_path` method to
normalize the path.

The second one is partially addressed in this PR, since most of the time
the path is ASCII case we can just call `to_ascii_lowercase` on the
lossy string. That removes the overhead of looping over every char of
the path, and normalizing it to lowercase.

This reduces the total time spend inside the `watcher_ids_covering`
method by **~31%** (~9s) from **~31.30s** to **~21.50s**.

| Metric | Before fast path | After 1 | After 2 | Average reduction |
|---|---:|---:|---:|---:|
| Notifications received | 213,761 | 214,054 | 213,686 | Comparable
(+0.05%) |
| Average routing/event | 133.4 µs | 90.0 µs | **87.0 µs** | **33.7%** |
| Total routing wall time | 28.51 s | 19.26 s | **18.59 s** | **33.6%**
|
| Total dispatch wall time | 31.32 s | 21.86 s | **21.20 s** | **31.2%**
|
| Observed queue peak | 1,131 | 663 | **359** | 54.8% |
| Average queue wait | 8.20 ms | 4.11 ms | **3.06 ms** | 56.3% |
| Maximum queue wait | 207 ms | 166 ms | **136 ms** | 27.1% |


## Testing

There is already test coverage for normalizing the paths, so didin't add
a test since it feld like adding a test for having a test. but happy to
add a test if thats really wanted!?

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- Improved responsiveness during heavy filesystem activity by reducing
filesystem watcher path-matching overhead.
2026-11-16 16:42:28 +00:00
Finn Evers d3d58c304b docs: Mention that new MCP server extensions will no longer be accepted (#67045)
Release Notes:

- N/A
2026-11-16 16:33:37 +00:00
Parker Loflin 7b5cc722a1 vim: Fix substitute without the g flag replacing the wrong matches (#67015)
## Summary

`SearchQuery::search` searches a slice of the buffer and returns offsets
into that slice. With `one_match_per_line`, it found each match's row by
passing the slice offset to `buffer.offset_to_point`, which takes a
buffer offset. When the slice started after the first line, matches got
the rows of lines nearer the top of the buffer, so the wrong matches
were kept. It now adds `range_offset`.

Only Vim's `:s` sets `one_match_per_line`, when it replaces the first
match on each line. It searches only the lines in its range, so it was
correct only when the range started on the first line. With `x` on line
1 and `aaaa` on line 2, `:s/a/b/` on line 2 gave `baba` instead of
`baaa`.

## Testing

- `test_replace_without_g_after_first_line` is new and fails without the
fix.
- `cargo test -p vim --lib` and `cargo test -p search --lib` pass.
- `cargo test -p project --features test-support --test integration
search` passes.
- `./script/clippy -p project -p vim` passes.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- Fixed Vim's `:s` without the `g` flag replacing the wrong matches when
used after the first line

---------

Co-authored-by: dino <dinojoaocosta@gmail.com>
2026-11-16 16:03:37 +00:00
Yann Defretin 917559da35 sidebar: Add keyboard navigation to the thread switcher (#66951)
## Summary

The thread switcher only cycles: `ctrl-tab` steps forward,
`ctrl-shift-tab` steps back, and releasing the modifier confirms. Its
view only handles `menu::Confirm`, `menu::Cancel` and
`agents_sidebar::ToggleThreadSwitcher`, so the global `menu::SelectNext`
/ `menu::SelectPrevious` bindings – arrow keys, `ctrl-n` / `ctrl-p` –
and `menu::SelectFirst` / `menu::SelectLast` do nothing while it is
open. With threads from several workspaces in the list, reaching the nth
entry costs n−1 presses of the trigger.

This PR makes the switcher handle those four actions, like the other
modal lists in Zed:

- Next and previous wrap around and preview the selected thread without
confirming it, the same way the cycle bindings do.
- `ctrl-up` / `ctrl-down` are bound in the `ThreadSwitcher` context,
mirroring the tab switcher, so the selection can move while the modifier
that opened the switcher is still held.

On macOS, `ctrl-up` / `ctrl-down` are taken by Mission Control and App
Exposé by default, so they may never reach Zed – `ctrl-n` / `ctrl-p`
still work with `ctrl` held. The thread switcher paragraph in
`docs/src/ai/parallel-agents.md` mentions the new keys.

Proposed in discussion #66923.


https://github.com/user-attachments/assets/b5138dab-3e16-4e2a-a99a-a5b7708a66bc


## Testing

- `test_thread_switcher_menu_navigation_wraps_without_confirming` covers
wrapping in both directions, `SelectFirst` / `SelectLast`, and checks
that stepping previews a thread without confirming it or recording an
access – only `menu::Confirm` does.
- `cargo test -p sidebar` and `./script/clippy -p sidebar` pass locally.
- Tested manually on macOS: open the switcher with `ctrl-tab`, keep
`ctrl` held and step with `ctrl-n` / `ctrl-p`, release to confirm.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- Added keyboard navigation to the thread switcher: arrow keys, `ctrl-n`
/ `ctrl-p`, Home / End, and `ctrl-up` / `ctrl-down` while the switcher's
modifier is held.
2026-11-16 14:20:13 +00:00
Parker Loflin 52b0e43064 editor: Don't write empty selections to the primary selection (#66986)
Closes #64446

## Summary

On Linux, each local selection change copies the selected text to the
primary selection and joins multiple selections with newlines. It
skipped the write only when the joined text was empty. With two or more
cursors and nothing selected, the text is one newline per extra cursor,
so every cursor move or keystroke replaced the primary selection with
newlines.

It now skips the write when every selection is empty.

## Testing

`cargo test -p editor --lib` passes on Linux.
`test_empty_selections_keep_primary_selection` is new, compiled only on
Linux and FreeBSD, and fails without the fix.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- Fixed multiple cursors overwriting the primary selection with newlines
on Linux
2026-11-16 13:59:16 +00:00
Parker Loflin f89b22bbea zlog: Count module filters toward the enabled log level (#66985)
## Summary

Log filters keyed by a module path, such as `"project::lsp_store":
"debug"`, are stored separately from scope filters.
`refresh_from_settings` computed the most verbose enabled level from the
scope filters only. Records more verbose than that level are rejected
before any filter is consulted, so a module filter could not enable
`debug` or `trace` records unless a scope filter or `ZED_LOG` already
allowed that level.

The level now includes module filters.

## Testing

`cargo test -p zlog` passes.
`test_refresh_from_settings_with_module_filter` is new and fails without
the fix.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- Fixed `log` settings keyed by module path (such as
`project::lsp_store`) not enabling `debug` or `trace` logs
2026-11-16 13:58:55 +00:00
Shreehitha Arushan 15ea61ea39 tab_switcher: Remove closed terminals from the open switcher (#66943)
## Summary

Closes #66654

When the tab switcher is opened from the terminal panel and a terminal
is closed from the list, its row stayed in the list until the switcher
was reopened.

The cause: the tab switcher only refreshed on the workspace's
`ItemAdded` / `ItemRemoved` events, and the workspace only emits those
for panes in the center area. The terminal panel has its own pane, so
its item changes never reached the switcher.

The fix: `TabSwitcher::open` already finds the focused dock panel's
pane. I now pass that pane to the delegate and subscribe to its
`AddItem` / `RemovedItem` events directly. Center panes still use the
existing workspace subscription, so nothing refreshes twice. I moved the
shared refresh code into a small `refresh_matches` helper so both
subscriptions use it.

Before: see the recording attached to #66654.

After:


https://github.com/user-attachments/assets/2e664c88-a7f4-43c1-b770-787354a4a471



## Testing

- Added `test_close_item_in_dock_pane`: opens the switcher on a pane
outside the workspace center, closes an item, and checks the list
updates.
- `cargo test -p tab_switcher` passes, and clippy is clean.
- Manually tested on Windows 11: opened 3 terminals in the terminal
panel, focused the panel, pressed ctrl-tab, and closed one with ×. The
row now disappears immediately while the switcher stays open.

To test: open 2+ terminals in the terminal panel, focus it, hold ctrl
and press tab, then click × on a row.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- Fixed closed terminals staying in the tab switcher until it was
reopened.
2026-11-16 13:48:28 +00:00
David Jensen d39178f6c9 agent_ui: Keep focus when background threads auto-send queued messages (#66787)
## Summary

Typing in one conversation no longer loses keyboard focus when a
different, background conversation finishes a turn and automatically
sends its next queued follow-up. Sending a queued message yourself (Send
Now, or fast-tracking the next queued message by pressing Send in the
empty composer) still returns focus to that thread's composer.

The focus decision stays in the shared queued-entry dispatch. Each
caller now passes an explicit source (automatic or manual), and the
dispatch focuses the composer only for manual sends. Queue validation,
cancellation, sending and error recovery are unchanged.

Closes #66416

## Testing

Automated checks run locally on the initial fixed implementation:

- New regression test for automatic sends failed without the fix (at the
foreground composer focus assertion) and passes with it. A second new
test covers manual sends keeping focus. Both passed scheduler seeds
0-19.
- All `agent_ui` and `gpui_apple` tests passed, `cargo fmt --check` and
`./script/clippy -p agent_ui -p gpui_apple` passed, and a full
development build succeeded.
- The full workspace suite and Windows/Linux validation were not run
locally.

Automated native desktop UI test on macOS with a local simulated ACP
agent (not a real external agent or model, and not a human manual test):
thread A had two queued follow-ups, and numbered chunks 01-18 were typed
into thread B one character at a time. A's turns completed mid-typing
and each follow-up auto-submitted, with no clicks, refocuses or window
activations. B's draft was then submitted and received exactly `Typing
in B: 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18`.

After the follow-up change that passes an explicit dispatch source (an
internal refactor of the same behavior), all `agent_ui` and `gpui_apple`
tests, both focus tests across seeds 0-19, Clippy and formatting were
rerun and passed. The development app and the desktop test above were
not rebuilt or repeated for that change, and the screenshots come from
the initial implementation.

To reproduce:

1. Open two threads, A and B, in the same window.
2. In A, send a message and, while it generates, queue two follow-ups.
3. Switch to B and start typing continuously.
4. When A's turn finishes, its next follow-up is sent. Typing in B
should continue uninterrupted.

AI assistance was used to prepare this change and its description.

## Self-review

- [ ] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

## Screenshots

<img width="800" height="125" alt="Image"
src="https://github.com/user-attachments/assets/69e7a496-d379-40de-bd0f-9febd5786ff7"
/>

Thread A – Queued followups

<img width="800" height="155" alt="Image"
src="https://github.com/user-attachments/assets/67a5b79c-de25-48f6-9f9b-eeec534b2398"
/>


Thread B – Typing focus retained

Release Notes:

- Fixed typing in an agent thread losing focus when another thread
automatically sends its queued messages.

---------

Co-authored-by: David Jensen <288440181+daejey@users.noreply.github.com>
2026-11-16 13:29:34 +00:00
Bennet Bo Fenner 89d3da6578 Preserve mid-conversation system prompt updates (#66490)
Release Notes:

- N/A
2026-11-16 13:07:38 +00:00
Lena 99dd426cba Highlight high-merge-rate authors on the community PRs board (#67038)
Pull in the list of authors with high clean merge rates from Snowflake
(clean merge rate means we are not counting a quick self-closed PR
mistake as a rejected PR), store the list in the GitHub project board's
readme (it's a hacky place, for simplicity), and show those authors as
"High MR" (not just "Returning") on the board with the community PRs.

Release Notes:

- N/A
2026-11-16 12:54:14 +00:00
Felipe Arthur 430a781076 Fix duplicate language server notifications (#67021)
## Summary

Repeated language server messages could stack identical notifications
while previewing themes.

- Skip an actionless prompt when a visible prompt has the same server
name, level, and message.
- Compare those fields directly while retaining per-request numeric IDs
and keeping action-bearing prompts independent.
- Preserve the existing notification and its dismissal timer when
discarding a duplicate.
- Move LSP-specific auto-dismiss setup into the prompt instead of
generic notification handling.

Implementation:
[`show_language_server_prompt`](https://github.com/zed-industries/zed/blob/ffaa5fbe8c30bc819c3d118e688b28c1f1a64fe1/crates/workspace/src/notifications.rs#L228-L253)
and
[`LanguageServerPrompt::new`](https://github.com/zed-industries/zed/blob/ffaa5fbe8c30bc819c3d118e688b28c1f1a64fe1/crates/workspace/src/notifications.rs#L274-L303).

This changes visible-notification handling, not the upstream
settings-to-LSP configuration refresh path.

![Original reproduction
screenshot](https://github.com/user-attachments/assets/c3cce22e-e1b8-4047-ad44-8eda72bca659)

## Testing

### Automated validation

- `cargo test --offline -p workspace --lib`: 309 tests passed on the
updated PR branch.
- The notification tests also passed across 20 scheduler seeds before
the cleanup was moved onto the PR branch.
- The new deduplication tests failed on `main` with only the tests and
their dev-dependency added, confirming coverage of the original stacking
bug.
- Coverage includes server and severity differences, delimiter
collisions, empty/Unicode/64-KiB messages, mixed action/no-action
prompts, dismissal, suppression, disabled auto-dismiss, and a duplicate
arriving 999 microseconds into a 1 ms timeout.
- Scoped Rust formatting and `git diff --check` passed.

The follow-up cleanup was validated with automated tests, not a visual
app run.

### Original contributor's manual testing

The original contributor reported manual testing on Linux (X11, XFCE),
using ZLS 0.17.0 with Zig 0.18.0-dev to produce a version-mismatch
warning.
They also supplied this alternative rust-analyzer configuration for
triggering a warning:

```json
{
  "lsp": {
    "rust-analyzer": {
      "initialization_options": {
        "checkOnSave": "invalid"
      }
    }
  }
}
```

1. Open a file handled by the affected language server and wait for its
warning notification.
2. Run `theme selector: toggle` and move through several themes.
3. Check that identical actionless notifications do not stack.

## Original contributor's self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- Fixed duplicate language server notifications appearing when switching
themes.

---------

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
2026-11-16 10:57:46 +00:00
Ben Brandt 12c1fc907f agent: Prompt for always_confirm patterns on in-project file edits (#67037)
`edit_file` and `write_file` skip the permission prompt for files inside
the project whenever the settings decision is `Confirm`. That is
intended for a `confirm` default, where in-project edits are reviewed
after the agent makes them. It also swallowed explicit `always_confirm`
patterns, which the docs say always prompt.

- `authorize_file_edit` now prompts when an `always_confirm` pattern
matches the path. It checks both the raw path and its normalized form,
so a `..` segment can't sidestep a pattern.
- A `confirm` default is unchanged: in-project edits still don't prompt.
- The docs, `default.json` and the `ToolPermissionMode::Confirm` doc
comment described `confirm` as "always prompt". They now describe what
the edit tools do with a `confirm` default and point to `always_confirm`
for prompting on specific files.

Related to #62276. This is an alternative to #66684, which would prompt
on every in-project edit under the default settings.

Release Notes:

- Fixed `always_confirm` patterns for the `edit_file` and `write_file`
agent tools not prompting for files inside the project.
2026-11-16 10:41:11 +00:00
Remco Smits 6c7508a133 fs: Reduce time spend for hashing WatchKey in watcher_ids_covering (#67008)
## Summary

follow-up on https://github.com/zed-industries/zed/pull/66973 and
https://github.com/zed-industries/zed/pull/66990

While working on https://github.com/zed-industries/zed/pull/66973 and
https://github.com/zed-industries/zed/pull/66990 I noticed that we spend
alot of time hashing the WatchKey. This was for a clean `cargo build`
around **~11s** which is alot, it was half of the time we spend inside
`watcher_ids_covering` before
https://github.com/zed-industries/zed/pull/66990 which removed the other
**~8s** overhead to around **~900ms**.

This PR uses the faster hasher `FxHasher` instead of the default one.
This reduces the time spend hashing for the **WatchKey** by around
**~3s**.

| Sampled operation | Standard hasher | Fx hasher | Reduction |
|---|---:|---:|---:|
| Ancestor matching overall | 14.42 s | **11.14 s** | **22.7%** |
| Hash-map lookups | 10.75 s | **7.49 s** | **30.3%** |
| Hash construction within lookups | 10.30 s | **7.14 s** | **30.7%** |
| Dispatch batch overall | 16.42 s | **13.16 s** | **19.9%** |

**Before**:
<img width="1277" height="462" alt="Screenshot 2026-11-14 at 20 41 25"
src="https://github.com/user-attachments/assets/28292e1d-2d8c-441c-bbee-70e0af5a741e"
/>

**After**:

<img width="1277" height="463" alt="Screenshot 2026-11-15 at 17 37 36"
src="https://github.com/user-attachments/assets/acee4ba5-7e9e-4c00-bc9b-39e9b6e47f47"
/>

## Testing

No behavior changes are expected and should be there, just a pure
performance boost for handling FS events :).

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- Improved responsiveness during heavy filesystem activity by reducing
filesystem watcher path-matching overhead.
2026-11-16 09:45:06 +00:00
Sha1rholder a57e2fdc38 Unifying agent instructions to AGENTS.md (#66716)
## Summary

Closes #66715

It's a follow-up of #45939

## Testing

This PR includes two commits. The first commit only removes CLAUDE.md
and GEMINI.md, and the second involves changes to
[dangerfile.ts](https://github.com/zed-industries/zed/blob/main/script/danger/dangerfile.ts).

Reset the second if not favored.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- N/A

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
2026-11-16 06:53:33 +00:00
Parker Loflin 053d91cb14 agent_ui: Check for an empty message without copying the text (#67020)
## Summary

`MessageEditor::is_empty` copied the whole draft with `text(cx)` to
check whether it was blank. It now reads characters from the buffer
until one isn't whitespace. `str::trim` removes exactly the characters
that `char::is_whitespace` matches, so the result is the same.

The thread view calls it on every render, through `render_send_button`.
The thread view's observer on the message editor also copied the text
each time the editor notified, to check for an empty draft. It now uses
`Editor::is_empty`, which reads the buffer length.

Both `is_empty` checks timed on a `rope::Rope` in a release build,
median per call:

| Draft size | Before | After | Speedup |
|---|---|---|---|
| 1 KB | 112 ns | 22 ns | 5x |
| 16 KB | 1.1 µs | 24 ns | 46x |
| 256 KB | 16.6 µs | 28 ns | 590x |
| 4 MB | 271 µs | 33 ns | 8,200x |

## Testing

- `cargo test -p agent_ui --lib message_editor` passes.
- `cargo test -p agent_ui --lib conversation_view` passes.
- `./script/clippy -p agent_ui` passes.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- N/A
2026-11-16 01:11:44 +00:00
Parker Loflin 125ca8672e util: Avoid allocating when sorting paths by extension (#67019)
## Summary

With `"sort_order": "extension"`, `compare_rel_paths_by` compared
extensions with `to_lowercase()`, which allocates two `String`s for each
pair of file names it compares. `compare_lowercase` compares ASCII
strings by their lowercased bytes and falls back to `to_lowercase()`
otherwise. For ASCII, `to_lowercase()` only lowercases each byte, so the
order is unchanged.

The project panel sorts its visible entries with this comparator, on a
background thread, each time it rebuilds them.

`cargo bench -p project_panel --bench sorting`, which sorts 96k entries
from a Linux checkout, in extension order:

| Sort mode | Before | After |
|---|---|---|
| `DirectoriesFirst` | 39.7 ms | 14.7 ms |
| `Mixed` | 38.6 ms | 12.4 ms |
| `FilesFirst` | 35.4 ms | 11.6 ms |

The other sort orders don't run this code. They measured 1 to 3% faster,
as did Unicode order, which this change can't affect, so that difference
is noise.

## Testing

- `cargo test -p util --lib paths` passes.
- `cargo test -p project_panel` passes.
- `./script/clippy -p util` passes.
- Outside Zed, `compare_lowercase` matched
`a.to_lowercase().cmp(&b.to_lowercase())` on 6 million random pairs of
ASCII and non-ASCII strings, and on every pair of the 252 extensions in
the benchmark snapshot.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- N/A
2026-11-16 00:05:19 +00:00
Parker Loflin 310bba2f2f util: Return early from natural_sort for equal strings (#67016)
## Summary

`compare_rel_paths_by` compares paths one component at a time. In the
default `DirectoriesFirst` mode it calls `natural_sort` on each pair of
components, including the parent directories the two paths share.
`natural_sort` walked equal strings character by character before
returning `Equal`. It now checks `a == b` first. For equal strings the
loop already returned `Equal`, so results are unchanged.

The project panel sorts its visible entries with this comparator, on a
background thread, each time it rebuilds them.

`cargo bench -p project_panel --bench sorting`, which sorts 96k entries
from a Linux checkout, in `DirectoriesFirst` mode:

| Sort order | Before | After |
|---|---|---|
| Default | 12.5 ms | 10.1 ms |
| Upper | 11.8 ms | 9.5 ms |
| Lower | 13.2 ms | 10.7 ms |
| Extension | 40.0 ms | 36.9 ms |
| Unicode | 8.4 ms | 8.3 ms |

Unicode order doesn't call `natural_sort`. `Mixed` and `FilesFirst` are
unchanged, because they go through `natural_sort_no_tiebreak`, which
already returns early for names that are equal ignoring ASCII case.

## Testing

- `cargo test -p util --lib paths` passes.
- `cargo test -p project_panel` passes.
- `./script/clippy -p util` passes.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- N/A
2026-11-16 00:02:04 +00:00
Parker Loflin 6b72097302 terminal_view: Avoid cloning text runs before shaping (#67013)
## Summary

`BatchedTextRun::paint` passed `self.text.clone().into()` to
`shape_line`. That cloned the `String`, then copied it again into the
`SharedString`. `self.text.as_str().into()` copies it once. Runs of 23
bytes or less are stored inline and no longer allocate.

`TerminalElement::paint` calls it for every text run. A run is a span of
adjacent cells on one line with the same style.

The two expressions timed outside Zed in a release build, median per
call including the drop:

| Run length | `text.clone().into()` | `text.as_str().into()` |
|---|---|---|
| 8 bytes | 13.5 ns | 4.8 ns |
| 16 bytes | 13.2 ns | 4.5 ns |
| 40 bytes | 22.6 ns | 12.8 ns |
| 80 bytes | 22.0 ns | 13.0 ns |
| 200 bytes | 22.6 ns | 13.2 ns |

That is about 9 ns per run. Paint time in the terminal was not measured.

## Testing

- `cargo test -p terminal_view --lib terminal_element` passes.
- `./script/clippy -p terminal_view` passes.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- N/A
2026-11-15 22:50:49 +00:00
Parker Loflin 021c7d4c4f language: Split buffer operations in linear time (#67014)
## Summary

`split_operations` took each 100-operation chunk with `Vec::drain(..n)`,
which shifts every remaining operation, so splitting was quadratic in
the number of operations. This iterates the operations once. The chunks
are unchanged, including the trailing empty chunk that
`create_buffer_for_peer` sends as the last one.

`create_buffer_for_peer` splits a buffer's full operation history when a
guest or remote client opens the buffer. Reconnecting projects and
channel buffers split the operations the other side is missing.

Time to split one list of edit operations, outside Zed in a release
build:

| Operations | Before | After |
|---|---|---|
| 10,000 | 192 µs | 12 µs |
| 100,000 | 25.8 ms | 123 µs |
| 250,000 | 171 ms | 502 µs |

## Testing

- `cargo test -p language --lib` passes.
- `cargo test -p remote_server --lib` passes.
- The collab `integration_tests`, `channel_buffer_tests` and
`remote_editing_collaboration_tests` pass.
- `./script/clippy -p language` passes.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- N/A
2026-11-15 22:49:03 +00:00
Remco Smits 24d3772111 fs: Fix wrong cfg guard for fast path for macos only (#67006)
## Summary

In https://github.com/zed-industries/zed/pull/66973 I introduced a
faster path for matching on macos, but I actually guarded it for linux
also, but that is not correct. Since the following code (what expensive
is on macos) was only guarded on macos.

So we should make the parent also guard for macos only.. this was a
mistake from me.


https://github.com/zed-industries/zed/blob/596dfdcf32d85d4d8d17a8887b4d0979ec7c5e14/crates/fs/src/fs_watcher.rs#L561-L577

## Testing

This changes nothing for macos, just so we don't also do the same path
for linux.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- N/A
2026-11-15 18:34:23 +00:00
Parker Loflin 596dfdcf32 language: Reset max start depth on pooled query cursors (#66983)
## Summary

`QueryCursorHandle` returns its cursor to a shared pool on drop. It
reset the cursor's byte and point ranges but not `max_start_depth`, and
tree-sitter keeps that setting across executions.

Only `SyntaxMapMatches` sets a depth, and it sets one on every query.
The other pool users never set it: highlight captures, injection
queries, `SyntaxLayer::override_id`, and `with_query_cursor`. After a
depth-limited matches query, the next of those to take the same cursor
matched only nodes within that depth. `Drop` now clears it.

The depth-limited queries are the text object queries behind Vim's
method, section, and comment motions (`] m`, `] ]`, `] /`), with depths
of 3 to 6. Missing highlights after those motions are inferred from the
code; only the syntax map is tested.

## Testing

`cargo test -p language --lib` passes.
`test_max_start_depth_does_not_carry_over_to_later_queries` is new and
fails without the fix.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- Fixed syntax highlighting sometimes going missing after Vim method,
section, and comment motions
2026-11-15 09:13:15 +00:00
Parker Loflin 5f27a0a02a fuzzy: Move segment results instead of cloning them (#66982)
## Summary

The string and path-set matchers in `fuzzy` and `fuzzy_nucleo` collect
matches per segment. They merged the segments with
`segment_results.concat()`, which clones every element. Each match was
copied (a `String` and a `Vec` for `fuzzy::StringMatch`) and the
original dropped, before the results were truncated to `max_results`.
This moves the matches.

`cargo bench -p fuzzy_nucleo --bench match_benchmark`, string matching
with 1-word queries:

| Benchmark | Before | After |
|---|---|---|
| `1-word/fuzzy/1000` | 67.9 µs | 58.4 µs |
| `1-word/fuzzy/10000` | 532 µs | 444 µs |
| `1-word/nucleo/1000` | 67.2 µs | 62.0 µs |
| `1-word/nucleo/10000` | 472 µs | 406 µs |

The 2- and 4-word groups match fewer candidates and improved by 2% to
22%. The path groups in that benchmark use `match_fixed_path_set`, which
this does not change.

A copy of the merge step outside Zed, merging 10,000 `StringMatch`
values from 16 segments: 412 µs before, 75 µs after.

## Testing

`cargo test -p fuzzy --features path/test-support`, `cargo test -p
fuzzy_nucleo`, and `cargo test -p file_finder --lib` pass.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- Improved fuzzy matching performance when many candidates match
2026-11-15 09:13:12 +00:00
Parker Loflin fb62376caa agent: Read buffer length without copying the text (#66981)
## Summary

`get_buffer_content_or_outline` chooses between a file's full text and
its outline by size. It measured the size with `buffer.text().len()`,
which copies the whole buffer into a `String`. `buffer.len()` reads the
same length from the rope's summary.

This runs on the main thread when the read file tool reads a file
without a line range and when a file is mentioned as context.

Both expressions timed on a `text::Buffer` in a release build:

| Buffer size | `text().len()` | `len()` |
|---|---|---|
| 16 KB | 1.8 µs | < 0.1 µs |
| 256 KB | 25 µs | < 0.1 µs |
| 4 MB | 398 µs | < 0.1 µs |
| 64 MB | 22 ms | < 0.1 µs |

## Testing

`cargo test -p agent --lib outline` passes.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- N/A
2026-11-15 09:13:10 +00:00
肆意妄为 e2f00a41ac Fix antialiased outline compositing on Windows (#66972)
## Summary

Antialiased rounded outlines can show dark spots on Windows when the
quad background is transparent black. The shader interpolates
straight-alpha colors at the inner edge, which mixes the transparent
background's RGB into partially covered border pixels.

Apply inner-edge coverage to the border alpha before compositing. Handle
zero combined alpha without dividing by zero.

## Testing

Windows 11 at 100% display scaling. I compared screenshots from the
original and patched Direct3D shaders using agent-desktop.

**Zed**  
The built-in onboarding page was pixel-identical before and after the
fix with the normal renderer configuration. To reproduce the affected
path in Zed, I applied the same temporary probe to both shaders to set
the RGB of transparent bordered backgrounds to black. I then measured
the default state of the two outlined buttons under **Import Settings**.

| Button | Corner pixels darker than both the straight border and the
page background |
| --- | ---: |
| VS Code | 8 → 0 |
| Cursor | 16 → 0 |

The top and bottom borders remained one physical pixel wide. This check
used an existing Zed debug build, which compiles the HLSL at startup.

**Material Gallery**  
On the **Loading indicator** page, I compared the **Start loading**
outlined button at rest and while held down. For the held state, a
temporary Gallery build dispatched a mouse-down event and captured the
rendered frame before mouse-up.

| State | Corner pixels darker than the straight border |
| --- | ---: |
| Default | 68 → 0 |
| Held | 24 → 0 |

All four straight edges remained one physical pixel wide in both states.
The held state retained its smaller corner radius and darker fill. The
Windows quad shaders also compiled successfully with Direct3D.

Release Notes:

- [GPUI] Fixed dark spots on antialiased rounded outlines.

---------

Co-authored-by: John Tur <john-tur@outlook.com>
2026-11-15 05:20:14 +00:00
Ben Brandt 703b5ac3f4 Update ACP SDK to 5.3.0 and follow schema 1.18 rule changes (#66979)
Updates `agent-client-protocol` to 5.3.0 (schema 1.18.0) and brings what
Zed already implements in line with the rules that changed.

- **Plan operations: the `file` plan type is removed.** Markdown plans
carry an optional absolute `path` instead, and the client always renders
`content`. A markdown plan with a `path` keeps the collapsible plan row
and gets an "Open Plan File" button. A relative `path` is ignored, so
the plan has no file. Naming or changing the file counts as a change to
the plan, so it re-shows a dismissed plan, as a new URI did for file
plans.
- **Unknown v2 command types are no longer offered as slash commands.**
The spec used to let a client show a command type it doesn't understand
as a plain command. It now says the client must not. The composer only
offers `command` entries for completion, input hints, validation, and
the "/ for commands" placeholder. `AcpThread` still keeps the full list.
This also covers the new `skill` entries, which Zed doesn't advertise
support for.
- **The new `speed` config option category converts from v1.** The
`unstable` SDK feature now parses `speed` as a known category. The v1
conversion rejected categories it didn't list, so one `speed` option
would have failed the agent's whole option list.

Checked against the 1.18 docs, no change needed:

- `replay_complete` (v2) is ignored. Zed still treats the
`session/resume` response as the end of replay and discards the thread
when a resume fails, and the RFD keeps the subagent freshness boundary
at the response.
- The subagent clarifications already hold. An `unknown` state shows as
unconfirmed, and a session message without a sender renders as a message
from another session.
- Zed doesn't send `tool_call/cancel` or `terminal/cancel` once the tool
call is final or the terminal has exited.
- Zed doesn't call `session/options` or `session/fork`, so the new rules
for them don't apply.

Not adopted yet: prompt suggestions, Agent Skills, placing `speed`
options next to the model selector, and using `replay_complete` to show
replayed history before the resume response.

Release Notes:

- N/A
2026-11-14 22:52:04 +00:00
Bennet Bo Fenner 15d136bf8e Fix R extension recommendations for unsupported file types (#66928)
Remove `.qmd`, `.Rmd`, and `.rmd` from the R extension recommendation
table, retaining `.r` and `.R`.

## Root cause

#63211 expanded the recommendation table using the language
configurations in extension source repositories. For R, those sources
already included a separate RMarkdown language with `path_suffixes =
["Rmd", "rmd", "qmd"]`, introduced in ocsmit/zed-r#42 and included in
version 0.2.6.

However, the extension registry still publishes R 0.2.5, which only
registers `.r` and `.R`. The recommendation therefore offers an
extension that cannot provide a language for the file that triggered it.
The source configuration was ahead of the published package; the
mappings were not valid for the version users could install.

The registry update in
https://github.com/zed-industries/extensions/pull/7288 remains blocked
on extension CI. Remove these recommendations for now rather than
suggest unavailable support. They can be restored once a working release
with RMarkdown support is published.

Release Notes:

- Fixed incorrect R extension installation suggestions for Quarto and R
Markdown files.

---------

Co-authored-by: Finn Evers <finn@zed.dev>
2026-11-14 19:33:53 +00:00
Parker Loflin 56a157e5b0 language: Reset unused-code state when seeking buffer chunks (#66977)
## Summary

`BufferChunks::seek` rebuilds the diagnostic endpoints and zeroes the
severity depths, but it left `unnecessary_depth` alone. After a seek
from inside an unnecessary-code diagnostic, every later chunk reported
`is_unnecessary`. `initialize_diagnostic_endpoints` now zeroes it with
the other depths.

`FoldChunks` seeks when it skips a fold, so text after a fold that
starts in unused code could render faded. That symptom is inferred from
the code; only the iterator is tested.

`seek` also called `initialize_diagnostic_endpoints` twice when the
iterator used cached highlights. The first call is removed.

A standalone release binary linked against `language` timed `seek` on an
iterator with cached highlights. The buffer is 4,000 lines of Rust with
a diagnostic on each of the first 2,000 lines. Each seek stays inside
the iterator's current range so highlights are not re-fetched.

Median time per seek:

| Diagnostics in seek range | Before | After |
|---|---|---|
| 0 | 210 ns | 114 ns |
| 1 | 0.77 µs | 0.40 µs |
| 10 | 1.28 µs | 0.68 µs |
| 100 | 6.7 µs | 3.4 µs |
| 1,000 | 59 µs | 29 µs |

## Testing

`cargo test -p language -- chunk diagnostic` passes.
`test_chunks_seek_out_of_unnecessary_diagnostic` is new and fails
without the fix.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- Fixed unused-code fading sometimes extending past the unused code
2026-11-14 16:22:22 +00:00