40913 Commits

Author SHA1 Message Date
John Tur 4a4c8150f0 Bump tree-sitter to cf5d3a63 (#67174)
Release Notes:

- N/A

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 03:03:55 +00:00
John Tur 2eff23878e gpui: Normalize clipboard line endings on Windows (#66945)
Windows applications expect CRLF line endings in CF_UNICODETEXT, so
convert LF to CRLF when writing to the clipboard. Convert CRLF back to
LF when reading from the clipboard, too, to prevent surprises in
applications.

Release Notes:

- N/A
- [GPUI] N/A

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
nightly
2026-11-19 00:25:13 +00:00
morgankrey 3c2118dd69 Correct hosted model pricing and availability (#67165)
Update the hosted-model reference to match Cloud's customer-visible
catalog.

- Add Claude Haiku 5.5 pricing and its enforced 100k context window.
- Add Gemini 3.8 Flash pricing and its 1M context window.
- Move retired GPT-5.2-Codex out of the pricing/context tables and
replace the stale recommendation with GPT-5.3-Codex.
- Leave GPT-6.2 models out of the public reference while their rollout
is staff-only.

Prices come from Cloud's `crates/billing/src/plans.rs`, including the
10% Zed markup. Context limits come from
`crates/llm_api/src/services/model_service.rs`. The customer rollouts
are cloud#4143 and cloud#3909; GPT-5.2-Codex retirement is cloud#3135.
No billing data, database rows, or model access changes.

The human author reviewed the changes and removed the required README.md
review notice; that removal has been committed and pushed. This is the
single source PR to main; the premature manual stable PR #67166 is
closed. Publishing to preview and stable will use the docs workflow,
with its source revision explicitly verified first.
`script/trigger-docs-build --from-main` selects the workflow from main
but still checks out the channel release branch; it does not copy this
PR from main. Fable 5.2 documentation is already present on the current
stable branch and public Markdown page.

Validation:

- `cd docs && npx --yes prettier --check
src/account/zed-hosted-models.md` passed.
- `git diff --check` passed.
- A Python consistency check passed: 35 models have matching
pricing/context entries; all documented prices apply exactly 10% markup;
new rates, context limits, retirement, Fable retention, and GPT-6.2
exclusion match the intended change.
- `cd docs && npx --yes prettier --check src/` reports pre-existing
formatting issues in six unchanged files: configuring-languages.md,
development.md, extensions/themes.md, languages/r.md,
reference/all-settings.md, and vim.md. Those files are out of scope.
- The full mdBook build was not run locally.

Release Notes:

- N/A
2026-11-18 22:51:19 +00:00
Lucas White dd091a1b4f Update installer terms to General Terms and Zed Product Terms (#67119)
Replaces the terms shown by the Zed installers with the new **General
Terms of Service** followed by the **Zed Product Terms** (both dated
November 18, 2026), and updates the `legal/` mirror of zed.dev's legal
pages to match.

### Installers affected

| Installer | Where terms come from | Change |
| --- | --- | --- |
| macOS DMG | `script/bundle-mac` → `dmg-license
script/terms/terms.json` → `terms.rtf` | New content; `terms.json`
unchanged and still points at `terms.rtf` |
| Windows (Inno Setup) | `crates/zed/resources/windows/zed.iss` →
`LicenseFile: "script\terms\terms.rtf"` (English and Simplified Chinese)
| New content; `zed.iss` unchanged |
| Linux (install script, Flatpak, tarball) | No install terms | None |

### Files

- `legal/terms.md`: now the General Terms of Service (zed.dev `/terms`).
- `legal/zed-product-terms.md` (new): Zed Product Terms (zed.dev
`/terms/zed`, `slug: terms/zed`).
- `legal/privacy-policy.md`: new Privacy Policy, titled "Zed Industries
Privacy Policy" (zed.dev `/privacy-policy`).
- `script/generate-terms-rtf`: now builds one RTF from both documents.
- `script/terms/terms.rtf`: regenerated.

Release Notes:

- N/A
2026-11-18 18:22:29 +00:00
Moritz Fröhlich 846ff80e0e vim: Match Vim's word selection for * and # (#66794)
## Summary

Vim allows searching for punctuation runs using */# and furthermore does
not require the word to be searched for, to be adjacent to the cursor.
See also
[pattern.txt](https://github.com/neovim/neovim/blob/7e394dbb896eaf86cb1046666dd423d512cda55f/runtime/doc/pattern.txt#L62)

Vim's priority for selecting the run to be searched for is:
1. Word under the cursor
2. First word somewhere to the right of the cursor on the same line
3. Punctuation run under the cursor
4. First punctuation run somewhere to the right of the cursor on the
same line

Currently, Zed only allows picking words directly adjacent to the cursor
(both to the left and to the right) and will otherwise not search for
anything.
After this change, Zed will no longer search for a word on the immediate
left of the cursor, which did not match Vim's behavior.
Instead, the chosen run will be selected according to the priorities
outlined above.

## Testing

Pick any file and optionally a Neovim instance and observe that */#
behave as in Neovim.
In particular
* Zed will no longer search for a word on the immediate left of the
cursor.
* Zed will only pick runs that either surround the cursor or are
somewhere to the right of the cursor.
* It is possible to search for punctuation runs.
* Word runs are always prioritized over punctuation runs. 
For example: `(ˇ[ tmp ([tmp` will result in `([ tmp ([ˇtmp` (this is
also included in the test cases).

## 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:

- Improved `*` and `#` in Vim mode to follow Neovim's behavior and
search for the next word on the line when the cursor isn't on a word,
and for punctuation when no word follows

---------

Co-authored-by: dino <dinojoaocosta@gmail.com>
2026-11-18 17:48:16 +00:00
Ben Brandt 988007a89a Update ACP SDK to 5.4.0 and align v2 session behavior (#67155)
Update to published ACP Rust SDK 5.4.0 (schema crate 1.19.0). Follow the
[protocol changes since schema
1.18](https://github.com/agentclientprotocol/agent-client-protocol/compare/v1.18.0...dbff792240171b199b5ad24d01406720ac9e4bd3)
for behavior Zed already implements:

- Use each parent's `replay_complete` marker to distinguish historical
child state and cancel capabilities from current updates. Keep current
child updates that arrive before the resume response, but wait for a
successful response before sending child controls. Detach descendants
when their root closes.
- Reply to agent-cancelled v2 permission requests and elicitations with
`cancelled` or `cancel`, respectively. Leave background requests and
tools alone when cancelling foreground work, and keep accepting agent
status updates.
- Ignore `pattern` in v2 elicitation forms, but keep validating it in v1
forms.

Cursor and fork-at-position UI, retaining history from a failed resume,
and automatic keyed prompt resend are out of scope. This PR uses the
published SDK and does not depend on an unreleased SDK fix.

Release Notes:

- N/A
2026-11-18 17:47:54 +00:00
Neel 264f0b67be Update piper to fix truncated file writes (#67160)
The zip extraction tests in `crates/util/src/archive.rs` fail
intermittently on Linux CI with errors such as `unable to locate the end
of central directory record`, for example in [this run on
main](https://github.com/zed-industries/zed/actions/runs/44141138965).

The cause is a bug in `piper` 0.2.4, where closing the `Writer` right
after writing can make the `Reader` lose bytes (fixed upstream in
smol-rs/piper#31, released as 0.2.5).

This only bumps `piper` in `Cargo.lock`.

## Testing

I reproduced the failure by running a test that extracts a small zip
20,000 times in a loop, with 48 copies of it running concurrently to
create CPU contention:

- `piper` 0.2.4: 47 of 48 runs failed, with `unable to locate the end of
central directory record`, `unexpected end of file`, or an empty
extracted file.
- `piper` 0.2.5: 0 of 96 runs of the full `archive::tests` module
(including the loop) failed.

The loop test is not included, since it only fails under heavy load and
exercises a dependency rather than our code.

Release Notes:

- Fixed a rare issue where files written by Zed, such as extracted
downloads, could be truncated
2026-11-18 17:23:22 +00:00
Parker Loflin 5cffb90247 project: Load diff bases for many buffers in one git process (#67026)
## Summary

Opening a diff loads its base text with
`Repository::load_committed_text` (HEAD and index, for uncommitted
diffs) or `Repository::load_staged_text` (index, for unstaged diffs).
Each call was a separate git job with its own `git cat-file --batch`
process. A repository runs its git jobs one at a time, so opening many
diffs at once queued one process per buffer, and other git work (status,
staging, blame) waited behind them. Project search results open an
uncommitted diff for every buffer they show, and the Uncommitted Changes
view one per changed file. The branch diff view and the `default_branch`
diff base open an unstaged diff per file. Each process reads the index
to resolve `:path`, so the cost grows with the repository.

Loads requested while their job is queued join it and share one process.
Only the most recently queued job takes new loads, which keeps their
order relative to other git jobs. The job owns its batch, so a job
dropped before it runs cancels its loads. If the batch fails, each load
retries in its own process, so an unreadable object fails only its own
diff. The batch decodes its texts on a background thread. Remote
repositories still send one request per buffer.

Diff base reloads already loaded every open buffer's bases in one batch,
and a failed batch cleared the bases of every buffer. Reloads retry the
same way, and a buffer whose own load fails keeps its bases.

`load_revisions` discards git's stderr, which it never read. When a
`refs/tags/HEAD` ref exists, git writes an ambiguity warning for each
`HEAD` lookup, and about 1,700 lookups filled a 64 KiB pipe and blocked
git mid-batch, in opens and reloads alike.

Benchmark: open the first N files of a checkout as buffers in a headless
app with `RealFs`, wait 5 s for the initial git status, then time
opening all of their diffs at once. Binary files don't open as buffers,
hence 983 and 996. Warm cache, Ryzen 7 9800X3D, git 2.53, median of 5
alternating runs with and without this change:

| Checkout | Index | Diff | Diffs | Before | After | Speedup |
|---|---|---|---|---|---|---|
| Zed | 0.5 MB | uncommitted | 100 | 95.0 ms | 29.6 ms | 3.2× |
| Zed | 0.5 MB | uncommitted | 983 | 980 ms | 313 ms | 3.1× |
| Zed | 0.5 MB | unstaged | 100 | 81.8 ms | 17.2 ms | 4.8× |
| Zed | 0.5 MB | unstaged | 983 | 793 ms | 169 ms | 4.7× |
| Linux | 10.5 MB | uncommitted | 100 | 418 ms | 32.6 ms | 13× |
| Linux | 10.5 MB | uncommitted | 1,000 | 4.31 s | 281 ms | 15× |
| Linux | 10.5 MB | unstaged | 100 | 398 ms | 20.0 ms | 20× |
| Linux | 10.5 MB | unstaged | 1,000 | 4.08 s | 155 ms | 26× |
| Firefox | 72 MB | uncommitted | 100 | 2.43 s | 56.1 ms | 43× |
| Firefox | 72 MB | uncommitted | 996 | 25.4 s | 314 ms | 81× |
| Firefox | 72 MB | unstaged | 100 | 2.52 s | 43.5 ms | 58× |
| Firefox | 72 MB | unstaged | 996 | 24.5 s | 183 ms | 134× |

git's CPU time drops by a similar factor, for example from 25.1 s to 95
ms for 996 uncommitted diffs in Firefox.

GitHub-hosted runners, 1,000 diffs, shallow clones, one build that
switches to the old code with an environment variable, median of 5
alternating runs:

| Runner | Checkout | Diff | Before | After | Speedup |
|---|---|---|---|---|---|
| `ubuntu-latest` | Linux | uncommitted | 13.3 s | 598 ms | 22× |
| `ubuntu-latest` | Linux | unstaged | 13.2 s | 294 ms | 45× |
| `ubuntu-latest` | rust-lang/rust | uncommitted | 10.1 s | 638 ms | 16×
|
| `ubuntu-latest` | rust-lang/rust | unstaged | 10.0 s | 354 ms | 28× |
| `windows-latest` | rust-lang/rust | uncommitted | 45.2 s | 1.05 s |
43× |
| `windows-latest` | rust-lang/rust | unstaged | 44.5 s | 444 ms | 100×
|

## Testing

- `test_diffs_opened_together` opens three uncommitted diffs (index
equal to HEAD, index differing from HEAD, untracked) and one unstaged
diff in one batch, and checks each buffer's HEAD and index text.
- `test_diff_base_loads_fail_when_their_job_is_dropped` drops a queued
job and closes the job channel, and checks that its loads and later ones
fail instead of hanging.
- `test_diff_base_loads_join_only_the_newest_queued_job` checks that two
loads share one job, and that a load queued after an index write gets
its own job and sees the new index text.
- `test_diff_base_load_with_unreadable_revision_fails_alone` makes one
HEAD revision unreadable in the fake repository and checks that the
other loads, including the index text of the same file, succeed.
- `test_diff_base_reload_with_unreadable_revision_fails_alone` reloads
three diffs while one HEAD revision is unreadable, and checks that only
that file keeps its old bases.
- `test_load_revisions_with_ambiguous_head` loads 4,000 `HEAD:`
revisions with a `refs/tags/HEAD` ref. Without the stderr change, the
test scheduler reports a deadlock after 15 seconds.
- `cargo test -p project --features test-support`, `cargo test -p git`,
`cargo test -p fs`, `cargo test -p remote_server --lib`, and
`./script/clippy -p project -p git -p fs` 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 git diff loading when many files open at once, such as in
project search results and the Uncommitted Changes and branch diff views
2026-11-18 17:19:54 +00:00
Juan Luis Cano Rodríguez 8c514d28ed Add official Snap package for Linux (#66941)
## Summary

Closes #9922

Requires https://github.com/canonical/snapcraft/pull/6511. _Mostly_
reviewable but I am still doing QA.

The GHA pipeline is a proposal. Snap gets released to the `edge` risk on
every `main` commit, then any revision can be manually promoted to other
risks, including `stable`.

## Testing

```
snapcraft pack -v
sudo snap install ./zed...snap --dangerous --classic
```

## 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).
- [ ] Tests cover the new or changed behavior.

Release Notes:

- Added an official Snap package for Linux

---------

Co-authored-by: Neel <neel@zed.dev>
2026-11-18 17:12:40 +00:00
zed-zippy[bot] b840e80bf2 Bump Zed to v1.31.0 (#67157)
Release Notes:

- N/A

Co-authored-by: zed-zippy[bot] <234243425+zed-zippy[bot]@users.noreply.github.com>
2026-11-18 16:32:17 +00:00
Daniel Jeon 9f1c56d6f2 gpui: Preserve empty content masks when snapping to device pixels (#67130)
## Summary

Fully clipped content can leak a 1px line outside its parent when an
empty content mask lies at a fractional device-pixel coordinate. Outward
rounding can turn the empty mask into a nonempty region.

For example, a zero-height mask with a vertical range of `[181.2,
181.2]` in device-pixel coordinates is expanded to `[181, 182]` by
[cover_bounds](https://github.com/zed-industries/zed/blob/96362135eb98a011ac17b56a5c90cf77f9f597f1/crates/gpui/src/window.rs#L3673-L3683),
which rounds the top edge down and the bottom edge up. This creates a
1px-tall region where nothing should be visible.

This change preserves empty masks before rounding while retaining the
existing behavior for positive-area masks, preventing rendering
artifacts during fractional scrolling.

Possibly related to
[#63358](https://github.com/zed-industries/zed/issues/63358), which
reports intermittent horizontal rendering artifacts on Linux/Wayland.
The symptoms are similar, but this fix has not been tested against that
report, so a shared root cause is unconfirmed.

In the native Windows screenshots below, the **blue rectangles represent
the visible body area (viewport) of a scrollable container**, and the
**red rectangles represent its content**. The example positions the
content entirely below the viewport, reproducing the state of an item
that has been scrolled out of view.

- **A — Unclipped reference:** clipping is disabled so the full red
rectangle remains visible, showing what is being drawn.
- **B — Fractional-coordinate clipping:** the same content should be
completely hidden. Before the fix, its top pixel row leaks below the
blue viewport as a 1px line; after the fix, it is fully hidden.
- **C — Integer-coordinate control:** the content is fully hidden both
before and after the fix.

| Before | After |
| --- | --- |
| <img width="1658" height="894" alt="native-upstream-before"
src="https://github.com/user-attachments/assets/49943dc9-9f0e-4537-abec-4a03e879c299"
/> | <img width="1658" height="894" alt="native-upstream-after"
src="https://github.com/user-attachments/assets/7c60f959-46fb-4cf9-b43b-bc4b175bd363"
/> |

## 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:

- [GPUI] Fixed fully clipped content leaking single-pixel lines outside
nested clipping regions.

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
2026-11-18 16:29:18 +00:00
MartinYe1234 621a6adf30 markdown: Fix crash when a selection maps into the middle of a character (#67104)
## Summary

Fixes a crash when the platform asks rendered Markdown for its selection
(IME position updates on macOS and Wayland):

```
end byte index 5 is not a char boundary; it is inside 'о' (bytes 4..6 of string)
```

A Markdown selection is stored as source byte offsets.
`RenderedLine::rendered_index_for_source_index` converted one to a
rendered index by adding the source displacement to the rendered offset
and clamping only to the text length, so the result could be inside a
UTF-8 character. `RenderedText::text_for_range` then sliced there and
panicked. Three ways to get such an offset:

- The source changes after the selection was made and a clicked offset
ends up inside syntax that is now hidden, such as a link destination
that finished streaming in an agent message.
- The source is replaced while the selection is kept, such as a tool
call label whose title updates.
- Rendered text is longer than its source. Smart punctuation turns a run
of hyphens into en dashes, and a click late in the run produces a source
offset past the end of the hyphens.

Changes, all in `crates/markdown/src/markdown.rs`:

- A source offset inside hidden syntax maps to the end of the rendered
text before it instead of spilling into the following text.
- An offset before a line's first text no longer underflows.
- `text_for_range` and `surrounding_word_range` snap to a character
boundary of the laid-out text before slicing.
- Rendered text that is longer than its source, such as en dashes made
from a run of hyphens, gets a source mapping per character. Before,
clicking late in a run of en dashes selected the text after it; now
double-clicking selects the dashes and a drag selects one dash at a
time.

Not covered here:

- Source positions inside text the parser rewrites (dash runs, HTML
entities, backslash escapes, code lines with an expanded tab) are
estimates. The parser reports where a rewritten piece starts and ends in
the source, but not which source bytes produced each rendered character.
A run that mixes em and en dashes can be one hyphen off, for example.
This affects Copy as Markdown of part of such text and where a click in
Markdown Preview places the editor cursor; highlighting, selection and
Copy are exact. Making these exact needs the parser to report a
per-character correspondence.
- A selection still survives `Markdown::replace` by byte offset, so it
can highlight unrelated text afterwards.

Closes FR-546

## Testing

Manual reproduction on a build without this change:

1. In the agent panel, start a thread and send the following. The line
contains 40 hyphens.

   ```
Reply with exactly this one line and nothing else, not in a code block:
   Итог ---------------------------------------- 回回回回回回
   ```

The hyphens should render as a run of 20 short en dashes. If the reply
has a hyphen count divisible by 3 they render as wider em dashes and the
steps below do nothing, so ask again.
2. Wait for the reply to finish.
3. Double-click one of the last five dashes at the right end of the run.
Zed crashes with `end byte index … is not a char boundary; it is inside
'回'`.

To get the stack from the crash reports instead, single-click one of
those dashes and then click into an editor tab. The crash comes on the
next frame through `Window::invalidate_character_coordinates` →
`MarkdownInputHandler::selected_text_range`.

With this change neither variant should crash, double-clicking any dash
selects the whole run of dashes, and dragging across the run selects one
dash at a time.

Release Notes:

- Fixed a crash when clicking or selecting text in agent messages and
other rendered Markdown that contains non-ASCII characters
collab-staging
2026-11-18 15:05:04 +00:00
이대희 1043f4a86a git_ui: Add commit message model picker (#50674)
## Summary

Reworked per review to reuse the shared `LanguageModelSelector` instead
of a custom dropdown.

- The generate-commit-message button is now a split button: the primary
click generates, the chevron opens the same picker the Agent Panel uses
and saves to `agent.commit_message_model`.
- The picker lives in a new `language_model_selector` crate, moved out
of `agent_ui`, so `git_ui` can use it without a feature-crate dependency
the workspace forbids. `agent_ui` re-exports the moved items.
- The chevron stays enabled with no model configured, so a model can be
picked from there.

## Verification

- `cargo test` and `./script/clippy` pass for `language_model_selector`,
`agent_ui`, `git_ui`, `settings_content`, and `xtask`, including the
workspace dependency-direction test.
- Clicked through a debug build on Linux (NVIDIA GPU) with a real model
behind an OpenAI-compatible endpoint: the picker opens, searches, and
persists the selection; generating streams a message into the commit
editor in both the Git Panel and the commit modal; with no provider
configured, generate is disabled and the chevron still opens the picker.

### Showcase


https://github.com/user-attachments/assets/23812839-6d95-4167-b437-af7976655423

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Release Notes:

- Improved the Git Panel's commit editor with a picker that allows
selecting the model to be used for commit message generation.

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: dino <dinojoaocosta@gmail.com>
2026-11-18 13:23:57 +00:00
David Jensen f88e54eed5 agent_ui: Open tool call locations for files that are not text (#67092)
## Summary

Clicking a tool call's location label ("Read screenshot.png"), or the
"Go to File" button above image tool output, did nothing for image
files, and each read logged "Binary files are not supported".
`ToolCall::resolve_location` resolves locations by opening a text
buffer, which fails for binary files, and `AgentThreadEntry::location`
required that buffer, so `open_tool_call_location` returned before
opening anything.

`AgentThreadEntry::location` now returns the resolved location as an
`Option<AgentLocation>`. `open_tool_call_location` already opens the
path through the workspace (which picks the image viewer for images), so
the resolved anchor is only used to place the cursor, falling back to
the reported line when unresolved. This also makes a text file location
clickable before resolution finishes. An earlier attempt, #65860, was
closed by the CLA bot without review.

Known limit, unchanged here: when one tool call lists several locations
the label is not clickable (existing `locations.len() == 1` rule), and
every image output's "Go to File" opens the first location, because ACP
doesn't link content blocks to locations.

Implementation and testing were AI-assisted; I understand the fix as
described above and tested it locally.

Closes #65823

## Screenshots

<img width="1100" height="700" alt="1-read-tool-call"
src="https://github.com/user-attachments/assets/8c499ffb-9ab0-4a8e-88df-b0a3b5271763"
/>
Read tool call

<img width="1100" height="700" alt="2-image-opened-from-tool-call"
src="https://github.com/user-attachments/assets/8cd9f6e9-1c0d-4f23-ab1d-8672906c4af5"
/>
Image opened from tool call

## Testing

- New test `test_open_tool_call_location_without_resolved_buffer` in
`agent_ui`: a read tool call for a PNG opens a non-editor item for the
file, and a text file clicked before its location resolves opens at the
reported line. Both halves fail on the old code. Existing `acp_thread`
location tests are updated for the new return type.
- `cargo test -p agent_ui -p acp_thread` passes, except
`test_headless_terminal_retains_process_control` in `acp_thread`, which
is also flaky on unchanged `main` (failed 1 of 3 full runs).
`./script/clippy -p agent_ui -p acp_thread` is clean. macOS only.
- Manual on macOS: had pi-acp read a PNG and clicked the tool call
label, which opened the image viewer. pi-acp renders images as markdown
links rather than ACP image content, so the "Go to File" button on image
output is covered by the test only.

## 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.

Release Notes:

- Fixed "Go to File" on agent tool calls doing nothing for image files

Co-authored-by: David Jensen <288440181+daejey@users.noreply.github.com>
2026-11-18 12:56:01 +00:00
Bennet Bo Fenner f3626706fa Add typed support for the OpenAI Ultrafast service tier (#67143)
Add an Ultrafast request speed and an independent model capability flag.
Encode and decode OpenAI’s `ultrafast` service tier without changing
Zed’s existing Fast toggle or enabling Ultrafast in Zed’s model catalog.

Release Notes:

- N/A
2026-11-18 12:22:00 +00:00
Stiven Gjekaj da294762d6 editor: Fix crash after moving a project with a split diff to a new window (#67128)
## Summary

Fixes #66688.

When splitting, the RHS display map has a weak reference to the LHS
display map. If the RHS editor outlives the `SplittableEditor`, the LHS
display map will be deallocated. However, the scroll anchor may still
refer to it. This leads to a panic in `ScrollManager::native_anchor` at
line `scroll.rs:242`.

This PR ensures that the same clean-up as in `unsplit` occurs when the
`SplittableEditor` is released. The first commit refactors this clean-up
into a function that takes a `&mut App`. The second commit adds this
function to an `on_release` handler.

We choose to do clean-up on release rather than adding fallback logic in
`native_anchor`, as it removes the stale state in its source. Fallback
logic can be added if desired.

## Testing

- Added test case `test_rhs_editor_outlives_released_split`. This
scrolls within the LHS, releases the split editor, ensures that the RHS
editor lives longer, and attempts to get the native anchor. Before this
change, this test panics with the error given in the issue. After this
change, the test passes.
- All tests pass in `cargo test -p editor` (1235).
- No clippy warnings in `./script/clippy -p editor`.
- Manually tested on macOS.

### How to test

Within a window:

1. Have two projects open in the sidebar.
2. In one project, with uncommitted changes, run `git: diff`, then open
in split mode with `editor: toggle split diff`.
3. Scroll in the left pane.
4. Move the project into a new window with `workspace: move project to
new window` (or "Open Project in New Window" from the project's menu in
the sidebar).
5. Change the theme with `theme selector: toggle`.

On main, Zed will panic here. With this change, no problem occurs.

## Self-review

- [x] Checked diff for quality, security, reliability and performance.
- [ ] UI change checklist followed (if any)
https://zed.dev/docs/development/ui-checklist. (N/A, no UI changes)
- [x] Test(s) added to cover new/changed behaviour.

Release Notes:

- Fixed a panic when moving a project with a split diff to a new window.

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
2026-11-18 11:42:50 +00:00
Dino e944cfa2fe docs: Mention system clipboard register in Helix's core differences (#67140)
## Summary

After the discussion on
https://github.com/zed-industries/zed/issues/66782, update the Helix
mode's documentation, specifically in the "Core Differences" section to
mention that, by default, the system clipboard register is used for
yanking, deleting and pasting and instructing users how to set
`vim.use_system_clipboard` to make it behave just like Helix and use the
internal register by default instead.

## Testing

Tested manually by running `mdbook serve docs` and reading that section
of the documentation.

## 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 10:47:36 +00:00
Dino 38f5c4af0d git_ui: Fold buffers in commit view as soon as possible (#67111)
## Summary

When `git.commit_view.expand_files` is set to `false`, opening a git
commit will fold all buffers, except the file from which this was
opened, if any.

However, this was done by collecting all of the `BufferId` and then
calling `Editor::fold_buffers` once, after all excerpts had been
processed, which could lead to scenarios where the file's excerpts would
first "flicker" on screen before the buffers being folded.

This commit updates the approach such that, instead of collecting
`BufferId`, we now call `Editor::fold_buffer` in
`CommitView::append_commit_file` as soon as the first batch of excerpts
for the buffer is processed, meaning we fold the buffer as soon as
possible to avoid showing any excerpts at all.

Mostly picking up work from #66754 that wasn't shipped.

## Testing

Testing was done manually, as doing it programmatically would require us
introducing test helpers to pause the excerpts loading, which didn't
seem necessary for this change. A new test was added –
`test_reveal_binary_file_preserves_folded_header_position` – but it's
simply to ensure that we fold binary files, even if they're the target
file.

### Showcase

<details>
  <summary>Before</summary>


https://github.com/user-attachments/assets/5c454af9-9326-4053-b6e5-dd1f288d2a81
</details>

<details>
  <summary>After</summary>
  

https://github.com/user-attachments/assets/94a56424-2158-44ec-86d3-3c07c7ebd7a6
</details>

## 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 files in the commit view briefly appearing expanded before
collapsing when `git.commit_view.expand_files` is disabled.
2026-11-18 10:46:43 +00:00
Parker Loflin 761786a4ef project: Retry diffs since a commit after a failed load (#67116)
## Summary

`GitStore::open_diff_since` cleared its `loading_diffs` entry only on
success. After a failed load, every later call got the cached error, so
the branch diff for that buffer stayed broken until restart. The entry
is now cleared on failure too.

## Testing

- `test_open_diff_since_retries_after_failed_load` fails a load, then
checks that a retry succeeds.
- `cargo test -p project --features test-support` and `./script/clippy
-p project` 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 branch diffs staying broken for a file after a failed load
2026-11-18 10:07:55 +00:00
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