Commit Graph

32361 Commits

Author SHA1 Message Date
Kirill Bulatov 2ff34954a0 Fix a flaky terminal test (#65160)
CI example:
https://github.com/zed-industries/zed/actions/runs/37274127321/job/111647574180?pr=65158

`true` could exit before the test checked for active PTY resources. The
ACP completion task releases those resources immediately after exit, so
correct cleanup could fail the assertion.


Release Notes:

- N/A
2026-10-05 08:24:37 +00:00
xdBronch 8385157b2f editor: Fix off by one in Open Docs action (#64317)
# Objective

using `editor: open docs` never chose the local file even when it
existed, found it was because this was slicing off the leading `/` which
gave an invalid path

## Solution

slice the URI correctly to preserve the path

## Testing

tested by using `editor: open docs` in my project before and after
running `cargo doc`, before it went to doc.rs, after it opened the local
docs file

## 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
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

---

Release Notes:

- fixed opening local documentation when using `editor: open docs`

---------

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
2026-10-05 08:21:11 +00:00
Rani 2117a376b9 editor: Reuse tab point cursor state across calls (#64409)
Follow-up to #58510 and #60605 for #32051. This is the `TabMap::sync`
cursor reuse @Anthony-Eid asked for in
https://github.com/zed-industries/zed/issues/32051#issuecomment-4781437473,
and it resolves the `todo(lw): Implement TabPointCursor properly`.

## What was slow

`TabPointCursor::map` was stateless: every call built a new fold chunk
iterator at column 0 of the row (several tree descents plus a rope seek)
and rescanned the row. `TabMap::sync` makes four of those calls per
edit, plus a fifth chunk iterator per edit to look for tabs after the
edit. With one cursor per line that is five iterator constructions per
cursor per keystroke.

Temporary timers around each layer in `DisplayMap::sync_through_wrap`
(not committed) showed the tab map was essentially the whole display
sync on the multi-cursor path. Per sync, `Multi-cursor input` bench,
Apple Silicon:

| layer | 1k cursors | 10k cursors |
|---|---|---|
| `InlayMap::sync` | 4 µs | 20 µs |
| `FoldMap::read` | 27 µs | 204 µs |
| `TabMap::sync` | 3,856 µs | 46,160 µs |
| `WrapMap::sync` | 27 µs | 190 µs |

## What this does

- `TabPointCursor` keeps its `TabStopCursor` and tab expansion state
between calls. A later column on the same row continues the scan. A
nearby later row is reached by walking the chunk `newlines` bitmaps
(bounded by a chunk budget). Anything else (a far row, an earlier point,
`reset()`) seeks the existing chunk iterator, so out-of-order input
stays correct and only costs a seek. `reset()` was a no-op that
`DisplayPointConverter` already relied on; it now forces a re-seek.
- `expand_tabs` takes the cursor and expansion state by reference, so
the cursor and the one-off `fold_point_to_tab_point` share one code
path. The one-off path builds its `TabStopCursor` directly as before.
- `TabMap::sync` maps the merged edits through one cursor per snapshot.
The points are non-decreasing within each snapshot.
- `TabMap::sync` seeks a single fold chunk iterator when looking for
tabs after each edit, and stops at the first newline instead of
converting the next row's start to an offset.

No callers change. `BlockMap::sync`, `BlockMap::spacer_blocks` and
`DisplayPointConverter` pick up the stateful cursor as is; the companion
side of `spacer_blocks` and `columnar_selection` keep using the
stateless `fold_point_to_tab_point` because they walk backward.

## Results

`TabMap::sync` per sync, same timers:

| | 1k cursors | 10k cursors |
|---|---|---|
| before | 3,856 µs | 46,160 µs |
| cursor reuse in the mapping pass | 1,989 µs | 23,718 µs |
| plus the shared chunk iterator | 1,380 µs | 16,205 µs |

The bench does three edits per iteration, so this removes roughly 90 ms
of a ~550 ms iteration at 10k cursors. The whole-bench number is noisy
at `sample_size = 10` (two runs of unmodified `main` gave 549 ms and 671
ms on my machine), which is why I am reporting the per-layer timers; the
criterion comparison against a saved `main` baseline was -9.6% at 10k (p
= 0.00) and within noise at 1k.

`To tab point/to_tab_point/1024` (one-off conversion) is unchanged:
412.0 ns before, 412.3 ns after (p = 0.10).

What is left in `TabMap::sync` is mostly the six `FoldOffset ->
FoldPoint` conversions per edit, which could get the same cursor
treatment in a follow-up. After this change the inlay, fold, tab and
wrap sync together are about 10% of the multi-cursor bench at 10k
cursors; the rest is outside them.

## Tests

The first commit adds tests only, and they pass on unmodified `main`:

- `test_random_tab_map_sync` drives buffer, inlay and fold mutations
plus tab size changes through `TabMap::sync` and checks the returned
`TabEdit`s by applying them to the previous tab text. Nothing asserted
on `TabEdit` ranges before, and `test_random_tabs` never calls `sync`.
- `test_tab_map_sync_edits` asserts the exact expanded edit ranges for a
small case.
- `test_random_tab_point_cursor` maps sorted, repeated, and then
unordered fold points (including columns past the end of the row and
multibyte text) through a single cursor with a randomized scan budget,
and compares against both the oracle and `fold_point_to_tab_point`.

All three pass at `ITERATIONS=5000`, as do `test_random_tabs` and
`test_to_tab_point_random`. `cargo test -p editor` passes (1144 tests)
and `./script/clippy -p editor` is clean.

One thing I ran into: with `MultiBuffer::build_random` the sync test
fails at seed 4882 on unmodified `main` too, because `FoldMap` reports a
fold edit whose old range does not cover text that a surviving fold
re-folds after excerpts are replaced. That is unrelated to the tab map,
so the test uses a singleton buffer. Filed as #64444.

Release Notes:

- Improved multi cursor editing performance
2026-10-05 07:44:07 +00:00
狐狸 e4945b5d09 remote: Reuse the known OS when reconnecting over SSH (#65024)
## Summary

The OS should not be re-probed during remote reconnection.

## Testing

Just a simple refactoring.

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

- Reuse the known OS when reconnecting over SSH

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
2026-10-05 07:30:35 +00:00
Kirill Bulatov ad4512a2e5 Fix tab double click (#65159)
Closes https://github.com/zed-industries/zed/issues/65140

Also return back the extra actions: for that, reverts part of
https://github.com/zed-industries/zed/pull/65081 and re-implements the
actions properly.


https://github.com/user-attachments/assets/04570ff5-08cb-4414-a386-b1b5b6660f47

Release Notes:

- N/A (Nightly only)
2026-10-05 07:20:42 +00:00
laizy eca87ab896 gpui: Remove redundant flushing_effects reentrancy guard (#65016)
Already guarded by pending_updates == 1, so the extra flag was
unnecessary.

## Testing

Manually test your changes; report results, mention platforms if
relevant.
How can reviewers test this easily? Include setup and steps.

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

- [gpui] Remove redundant flushing_effects reentrancy guard
2026-10-05 07:05:49 +00:00
Alex 279fe070bb languages: Fix JSON completion order for settings keys (#65139)
## Summary

Closes #64341

Typing `"status` in settings.json puts `show_call_status_icon` above
`status_bar`.

json-language-server includes quotes in `filterText` (`"status_bar"`),
but the search query doesn't. Since #62433, this means a match at the
start of the key gets a lower score than it should.

This strips the quotes in the JSON adapter's `process_completions`,
following the Python adapter. Insertion is unchanged.

Enum values like `"dark"` and `"system_dark"` have the same problem, but
their quotes come from the label. I'll handle those in a separate PR.

Before / after:

| Before | After |
|---|---|
|
![before](https://gist.githubusercontent.com/ragen1337/82464ddeeada40d7e3e018ed2278bf0d/raw/fc4ec492eb8e08bd9326b3f16333b00f0ef33c56/before.png)
|
![after](https://gist.githubusercontent.com/ragen1337/82464ddeeada40d7e3e018ed2278bf0d/raw/086ee3c6e34e081e5dee568dabe311930fe0e9a9/after.png)
|

## Testing

Added a unit test. `cargo test -p languages` and `cargo test -p editor`
pass.

Checked on macOS: typing `"status` in settings.json now puts
`status_bar` first. Selecting it inserts the same text as before.

## 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 JSON completion ordering when typing the start of a key.
2026-10-04 23:59:55 +00:00
Xin Zhao a84689073d path: Reimplement PathStyle on the standard library's path implementation (#64149)
# Objective

Rust's standard library `Path` API is platform-dependent, so you get
wrong results when processing a Windows path on Unix, or vice versa. Zed
needs this functionality because we support remote development, where
cross-platform path handling is routine. Zed's `PathStyle` takes on this
responsibility.

But handling paths can be really tricky: we need to handle paths with
non-UTF-8 characters, a problem I ran into in #63075. And thanks to
Microsoft, there are 5 different kinds of valid path prefixes! Not to
mention the `/` and `\` separators, which was another problem I ran into
in #63102. So we need to make some changes to the `PathStyle` API.

## Solution

I'm not an expert on this low-level API design, or on API design in
general. But the people who maintain the Rust standard library are.
Since `PathStyle`'s API is largely a cross-platform version of the
standard library's `Path`, the most reliable and straightforward
approach I could come up with is to bring the standard library's
implementation into the Zed repo and make the necessary modifications to
make it work cross-platform.

It turns out Rust already has a great abstraction: the
platform-dependent part of `Path` is packaged under
`library/std/src/sys/path` and selected at compile time, while the
`Path` implementation just uses the abstracted constants and methods:


https://github.com/rust-lang/rust/blob/6474e999898cad2289175e2a7d253f5d0f574fa2/library/std/src/path.rs#L96

So we can add some helper methods to `PathStyle` to represent the
compile-time-determined pieces of the standard library. Then we bring in
the rest, achieving our goal of making `PathStyle`'s functionality the
same as the standard library's, but cross-platform.

Overall, the `parent()` and `file_name()` methods I introduced in #62038
have been reimplemented, and a new `starts_with()` method has been
added. Their implementations are nearly the same as the ones in the
standard library. To make these methods work, the standard library's
`Components` struct was added in a new file,
`crates/path/src/path_component.rs`, which is the core of reliable path
handling; and `crates/path/src/windows_prefix.rs` was added to handle
Windows paths. Most of the code in these two files is the same as the
standard library's; I only made some small tweaks to make it work with
`PathStyle`.

## Testing

New tests for `starts_with` have been added.

## 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
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

---

Release Notes:

- N/A
2026-10-03 08:53:38 +00:00
Xiaobo Liu 5eed2397a8 git_ui: Add command to create tags at HEAD (#61973)
Add a Command Palette action that creates a lightweight local tag at the
active repository's HEAD. Refresh tag consumers after creation and show
success or failure notifications.

# Objective

This adds a `git: create tag at head` Command Palette action for
creating a lightweight local tag at the active repository's current
`HEAD`.

## Solution

The action uses the existing single-line Git modal style and
notification patterns. Tag creation uses `git update-ref` with a
required nonexistent previous value, preventing an existing tag from
being overwritten.

It also:

- Supports local and remote project repositories.
- Refreshes Git graph and history views after tag creation.
- Shows a bottom-centered success toast.
- Uses the existing critical error prompt for failures.
- Documents that created tags are local and are not pushed
automatically.

## Testing

- `cargo test -p git test_create_ref_requires_ref_to_not_exist`
- `cargo test -p git_ui test_create_tag_at_head`

## Showcase



https://github.com/user-attachments/assets/81ceffdb-d5f7-4e97-b513-4ee04b55b619



---

Release Notes:

- Add command to create tags at HEAD

---------

Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
2026-10-03 05:03:56 +00:00
Remco Smits a9c0144d00 git_ui: Improve Git graph UX (#59839)
# Objective

Currently the UX of the git graph is pretty bad, since we are displaying
all the refs inside the **description** column we bairly have room for
the description itself. It's also pretty hard to implement any more
advanced features like renaming/deleting a specific ref for example.

## Solution

My solution/idea is to move the refs to the git graph itself, so we have
more room to show the actual commit description, and we also move
towards a UI where it's possible to implement renaming/deleting of refs
for example.

I got inspired by this
[tweet](https://x.com/ruru_1x/status/2068021793173172351) that shows a
really clean git graph similar to how [git
kraken](https://www.gitkraken.com) does it. I think Zed should also move
to a UI similar to this, so we can make some more advanced features and
make them discoverable without blocking other parts of the UI e.g.
tooltips of the commit description.

## 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
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

## Showcase

**Before**
<img width="1512" height="821" alt="Screenshot 2026-06-24 at 17 45 49"
src="https://github.com/user-attachments/assets/620d04d2-581b-4d78-b8fa-17f6aee7807e"
/>

**After**
<img width="1512" height="820" alt="Screenshot 2026-07-08 at 17 22 37"
src="https://github.com/user-attachments/assets/ae6b55e2-7b9b-4f7a-a393-a0943798eb50"
/>

<img width="823" height="581" alt="Screenshot 2026-07-08 at 17 24 47"
src="https://github.com/user-attachments/assets/468e36fb-d615-452d-b96a-0161cffd8103"
/>


https://github.com/user-attachments/assets/0d0549c8-2593-4f1e-b3da-239bdbc3d22d

---

Release Notes:

- Git graph: Improved the UX of the git graph.

---------

Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
2026-10-03 04:19:21 +00:00
Jonathan Berkeley 01376d4926 git_hosting_providers: Add Gitiles provider (#63996)
Add Gitiles support to git hosting providers, to enable permalink / git
blame diff link features working for repositories browsed with Gitiles
(used by Gerrit).

Permalinks use the Gitiles URL format:
{base_url}/{repo}/+/{sha}/{path}#{line}

Configured via git_hosting_providers setting:

  { "provider": "gitiles", "name": "...", "base_url": "https://..." }

# Objective

- Add basic permalink + git blame linking support for another common Git
provider (Gerrit + Gitiles).

Gerrit/Gitiles is a self hosted setup used at several large
corporations, so it would be nice to have native support for it
alongside the other git hosting providers. It is relevant to many
people.

URL can vary substantially between different self hosted setups. URL can
be like https://gerrit.example.com or something more elaborate like
https://vcs.internal.example.com/plugins/gitiles.

This does not implement avatars or PR links (as the similar Chromium
provider does) since exact Gerrit setup (e.g. trailers used, avatars
used) can differ significantly between different self hosted instances.

It implements the fundamental Gitiles link part instead which is still
very useful, and is reliable; `base_url` can be set to the gitiles "Git
repositories on [instance]" [base
page](https://gerrit.googlesource.com/), and this integration will then
work.

## Solution

- Implements a new GitHostingProvider which constructs Gitiles format
permalinks based on the user config.

Implementation follows inspiration from other providers: Tangled /
Chromium (also Gitiles/Gerrit based but tied specifically to Chromium).

## Testing

- Unit tests cover the logic in this change.
- Built for Windows, performed exploratory testing (adding multiple
providers, different base_urls, trying a self hosted Gerrit instance vs
googlesource, git blame link through UI works, copy permalink via
right-click context menu in code works).

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments -> N/A
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines) -> N/A
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

## Showcase

#### "Copy permalink to line"
<img width="1958" height="677" alt="image"
src="https://github.com/user-attachments/assets/802a02af-db4e-4b9c-a7d5-ac26dc52cd7e"
/>

Above results in clipboard being set to:

https://gerrit.googlesource.com/gitiles/+/77d36f6ff5f50316daa82c6753af2c3217859df4/java/com/google/gitiles/GitilesUrls.java#34

#### Git blame diff view links to remote Gitiles view for the commit:
<img width="2242" height="808" alt="image"
src="https://github.com/user-attachments/assets/2792397a-83ae-4294-ae61-5a631975950d"
/>

Above example opens this link in browser:

https://gerrit.googlesource.com/gitiles/+/67c7844b7f7f228229c037cf297296874f50692c

---
`settings.json` for showcase example:
```json
  "git_hosting_providers": [
    {
      "provider": "gitiles",
      "name": "Gerrit Googlesource",
      "base_url": "https://gerrit.googlesource.com"
    }
  ],
```
---

Release Notes:

- Added `gitiles` as a Git hosting provider for Gitiles/Gerrit
deployments, enabling permalinks and navigation from git blame diff
view.

Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
2026-10-03 03:43:01 +00:00
Filip Czaplicki d9afb21688 git_hosting_providers: Add support for self-hosted Gerrit repositories (#53832)
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

I based my change on forgejo.rs and chromium.rs (gerrit instance).
I didn't include logic for parsing Gerrit metadata from commit message
(depends on gerrit configuration).

I tested with settings:
``` json
{
  "git_hosting_providers": [
    {
      "provider": "gerrit",
      "name": "googlesource",
      "base_url": "https://gerrit.googlesource.com",
    },
  ],
}
```
and https://gerrit.googlesource.com/git-repo

Release Notes:

- Add support for self-hosted Gerrit repositories for permalinks.

Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
2026-10-03 02:58:48 +00:00
Josh Kent 80ee0a3563 markdown_preview: Add Show Source to preview tab menu (#65081)
## Summary

Markdown files can now open in preview by default, but there's no
discoverable way back to the raw source.
`markdown::CloseAndReturnToEditor` exists (`cmd-shift-v` /
`ctrl-shift-v`), but nothing in the UI points to it.

This adds a "Show Source" entry to the preview tab's context menu that
triggers that action.

Tab menu entries that dispatch actions only work on the active tab.
Inactive tabs aren't rendered, so they aren't in the dispatch tree and
never receive the action. Because of that:

- "Show Source" only appears when the preview is the active tab.
- The editor's "Open Markdown Preview" and "Open SVG Preview" entries
had the same problem, so they're now hidden on inactive tabs too.

## Testing

- `cargo test -p markdown_preview`
- `./script/clippy -p markdown_preview -p editor`
- Manually verified on macOS:
- Right-click the active Markdown preview tab → "Show Source" closes the
preview and focuses the source editor.
- Right-click an inactive preview tab or inactive Markdown editor tab →
no preview entries are shown.

To try it: open any `.md` file in preview, right-click the preview tab,
choose "Show Source".

## 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 a "Show Source" option to the Markdown preview tab context menu.
- Fixed "Open Markdown Preview" and "Open SVG Preview" appearing in the
tab context menu of inactive tabs, where they had no effect.
2026-10-03 02:35:10 +00:00
Oleksandr Kholiavko 3fec483014 tabular_data_preview: Single-cell focus and arrow navigation with reveal (1/8) (#64916)
## Overview

Part **1 of 8** in a series adding full keyboard/mouse navigation, cell
selection, multi-format clipboard copying, and keyboard-driven
sorting/filtering to `tabular_data_preview`.

Split into small, isolated PRs for review safety. The feature is gated
to debug/test builds (`cfg!(any(test, debug_assertions))`) until PR 6
(copying + context menus) to avoid exposing selection without copy
support.

---

### Full Series Roadmap

**1/8 (This PR):** Single-cell focus & arrow navigation with viewport
reveal
**2/8:** Range selection (`Shift+Arrows`), edge jumps
(`Cmd/Ctrl+Arrows`, `Home/End`), and page jumps (`PageUp/Down`)
**3/8:** Mouse selection, Shift+Click extension, and drag-to-select
**4/8:** Select All (`Cmd/Ctrl+A`) across datasets
**5/8:** Multi-format copy engine (TSV, CSV, Markdown, JSON Lines) &
`CopySelected`
**6/8:** Context menu, copy format settings, toasts, and release
enablement
**7/8:** Row selection via row gutter click/drag
**8/8:** Keyboard sorting (`Alt+S`), filter popover (`Alt+F`), and
filter clear (`Cmd/Ctrl+Alt+Backspace`)


NOTE, that all work is done & running on my machine end to end. The
split is just code review organization buerocracy.

<summary>
👇 Demo of fully ready feature👇 
</summary>
<details>


https://github.com/user-attachments/assets/696554f9-ca3e-4b74-83d1-948292668334



https://github.com/user-attachments/assets/5ef5f1f1-4f15-4b01-b825-de592d8a1972



https://github.com/user-attachments/assets/40c0e57f-da7a-440a-9ee6-48af8abe116e


</details>

---

### Changes in this PR (1/8)

1. **Data-Space Coordinates (`CellSelection`):** Coordinates anchor to
`DataCellId { row: DataRow, col: AnyColumn }` so selection survives
background sorting/filtering without shifting rows.
2. **Single-Cell Navigation (`tabular_data::MoveFocusedCell`):** Arrow
navigation (`Up`/`Down`/`Left`/`Right`), initializing focus at `(0, 0)`
on first movement.
3. **Viewport Auto-Scroll & Peek Cushion:** Auto-scrolls focused cells
with a 20px horizontal peek buffer and 1-row vertical context cushion.
4. **Focus & Outline:** Renders focused cell border
(`theme.colors().border_focused`) and binds `"context": "TableView"`.
5. **Debug Gating:** Hidden in release builds via
`is_selection_enabled()` until copying lands in PR 6.

---

Release Notes:

- N/A

---------

Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
2026-10-03 01:03:39 +00:00
Arti 708c7eef55 file_finder: Implement SeedQuerySetting::Selection seed_query (#64946)
## Summary

UX parity with JetBrains IDEs: there, you can
- select a file name/path in the terminal/editor
- press the "open file finder" hotkey
- see search results for that file

On Zed's main branch, you have to:
- select a file name/path in the terminal/editor
- press ctrl+c / ctrl+shift+c (depending on the context)
- press the "open file finder" hotkey
- see the default list of files for an empty search
- press ctrl+v
- see search results for that file

The issue is little one but it is a "death by a thousand cuts" type of
straw for me.


https://github.com/user-attachments/assets/26de5bba-98c2-4a1f-8540-1e0e646301e8

The feature can be disabled in the `settings.json` with the
`file_finder.prefill_query_from_selection` flag set to `false` or in the
settings UI page for file finder.

## Testing

To test this, a reviewer can:
- open any project
- select a file name/path in the terminal/editor
- press the "open file finder" hotkey
- see search results for that file

Then switch the checkbox in the file finder setting page (or set
`file_finder.prefill_query_from_selection` to `false` in settings.json)
and:
- select a file name/path in the terminal/editor
- press the "open file finder" hotkey
- see the default list of files for an empty search

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


Zed already has a `seed_query` mechanism for `text_finder`, built on
`SeedQuerySetting::Selection` and
`SearchableItemHandle::query_suggestion`, which I reused as much as
possible.

`FileFinder::seed_query` basically duplicates
`TextFinder::active_item_query` code (except checking if the setting is
disabled).

I wanted to unify the functionality but did not know where the new
unified method would fit better and decided that some code duplication
is not as terrible as bad refactor (if any reviewer can tell me a proper
place to put the method to get selected text for search query I will be
very thankful).

Ran every existing test (- each passed) and asked LLM generate new ones
for this PR (reviewed them and can vouch that they make sense)

Release Notes:

- Improved the file finder to pre-fill the search query with the text
selected in the terminal/editor
- [GPUI] Added a method for retrieving the selected text from any
registered input handler

---------

Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
2026-10-03 00:28:21 +00:00
mpyuglgwkxcmodyrpo 7ea5428f0c agent: Improve custom bedrock model support (#64953)
## Summary

Improve custom model support for Amazon Bedrock (**not** Mantle). Add
the ability to specify existing model configuration settings in custom
models.

Specifying custom Amazon Bedrock Converse models is useful for a few key
reasons:

- Adding new models before Zed adds support 
- ex. Grok 4.6 was added 8/19, but is not yet added to the Zed agent
picker.
- Using application inference profiles to track individual usage
- Using fully custom models uploaded and hosted in Bedrock

Custom models should be as configurable as the provided models can be.
Currently, they are not. Thinking, tools, and image support cannot be
configured for custom models. This PR adds support for these settings.

Configuration Changes for objects under `language_models` -> `bedrock`
-> `available_models`:
- Added `supports_tools` bool value to indicate that the model supports
tool use
- Added `supports_images` bool value to indicate that the model supports
image recognition
- Added `thinking` key that can either be a bool to enable basic
thinking, or an object to describe additional thinking details:
- `adaptive` bool to indicate whether model thinking can have adaptive
levels (low, high, medium, etc.)
- `has_xhigh` bool to indicate whether the model supports the xhigh
adaptive thinking level. Unused if `adaptive` is false
- `budget_tokens` to specify how many tokens the model can use for a
thinking operation

The new configuration format is mostly backwards compatible with the old
format. i.e. **most** existing configurations will not break if this fix
is merged. The only exception is now custom model `name`s are completely
unmodified instead of potentially having a region prefix added to them.
The user is responsible for making sure the `us.` (or whatever region)
prefix is added to the model identifier. `allow_global` will have no
impact on these models and they will be used if specified even if they
are global models. I can change this behavior if it is desired. I think
custom should be fully custom, though. We can optionally bounce a model
specifier if it does not have a region prefix or has the `global` prefix
if `allow_global` is false.

I am open to feedback on the configuration keys and values. 

Misc changes:
- The default `default_temperature` value for custom models is now
`None` instead of 1.0. Some models do not support temperature and a
default of 1.0 is still a value that the Bedrock endpoint will reject.

## Testing

- Existing automated unit tests pass
- Newly added automated unit tests pass
- Tested manually with models currently unsupported in Zed (Grok
4.6/4.7, Kimi K3)
- Models show up, function properly, show thinking level settings (incl.
xhigh, if `has_xhigh` specified), can use tools, can add images
- Manually tested model with custom ARN (application inference profile)

## Self-review

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

Release Notes:

- Improved custom model support for Amazon Bedrock

---------

Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
2026-10-03 00:14:27 +00:00
tidely 199500e9be file_content: Fix stack overflow in encoding detection (#65102)
## Summary

Fix a stack overflow when searching a project in a macOS debug build.
When on a debug build, opening a project which hits the
`detect_encoding` code path and typing in a global search triggers an
illegal instruction violation. The regression was introduced in #64549

Allocate the encoding detector’s 64 KiB buffer using a `Vec`. The inline
array enlarged nested search futures and their debug-build stack frames
beyond the background worker’s available stack.

This hasn't hit stable yet, so I've omitted a release note. 

## Testing

- All tests pass
- Change is extremely trivial
- Project search no longer crashes with this patch

To verify manually on macOS, launch Zed with `cargo run`, open a Rust
project, press Cmd-Shift-F, and search for anything.

## 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)](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- N/A
2026-10-02 23:36:48 +00:00
mulham c83abe7d0e git_ui: Allow collapsing the commit editor and commit details (#63236)
## Summary

- The commit message editor in the Git panel is pinned to six lines and
its only two controls both make it *larger* — one fills the panel, the
other opens the modal. Anyone who commits from a terminal pays for an
input they never use, and the Changes list is what gets squeezed.
- In the Git Graph detail panel, the author metadata and the commit
message render at a fixed size above the changed-files list, so
shortening the panel (e.g. dragging the terminal up) hides the file list
entirely.

## Changes

**Git panel — collapsible commit editor**

- New `git::ToggleCommitEditor` action.
- A chevron beside the commit button hides the editor down to a thin
bar; the commit button row stays available.
- State persists per workspace via `SerializedGitPanel`, seeded from a
new `git_panel.commit_editor` setting (`expanded` | `collapsed`, default
`expanded`).
- Collapsing clears the fill state — a hidden editor cannot also fill
the panel.
- `activation_focus_handle` no longer focuses an editor that isn't
rendered.

**Git Graph — collapsible commit details**

- A disclosure folds the author metadata (avatar, refs, email, SHA,
provider link) down to a single author + short-sha line.
- A second disclosure folds the commit message body.
- The changed-files container is already `flex_1().min_h_0()`, so it
reclaims the freed space with no other layout change.

**Settings plumbing**

- `GitPanelCommitEditor` in `settings_content`, wired through
`GitPanelSettings`, `assets/settings/default.json`, the settings UI, and
`docs/src/reference/all-settings.md`.

## Test plan

- [x] `test_toggle_commit_editor_collapsed` added, covering the toggle,
persistence of the flag, and the fill/collapse exclusion.
- [x] Manually verified in a dev build: chevron hides and restores the
editor, Changes list expands into the freed space, action appears in the
command palette, state survives a restart, and the `collapsed` setting
seeds a new workspace.
- [x] Manually verified both disclosures in the Git Graph detail panel
with the panel shortened, including that the collapse state survives
selecting a different commit.

Release Notes:

- Improved the Git panel by allowing the commit message editor to be
collapsed, and the Git Graph commit details by making the metadata and
commit message sections collapsible.

### Evidance Test
| Expand | Collapse | Settings Git Panel |
| ------- | --------- | ------------------ |
| <img width="675" height="965" alt="Screenshot 2026-08-26 at 15 00 46"
src="https://github.com/user-attachments/assets/70c56d02-35fc-45ac-988c-24ccd6d1a19e"
/> | <img width="661" height="962" alt="Screenshot 2026-08-26 at 15 00
57"
src="https://github.com/user-attachments/assets/2c32fa5d-30fc-4f35-8323-afbc2a031210"
/> | <img width="1041" height="956" alt="Screenshot 2026-08-26 at 16 50
40"
src="https://github.com/user-attachments/assets/67f166b6-5cd9-4430-bba3-fa765715c557"
/> |

---------

Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
2026-10-02 17:25:11 +00:00
Ben Brandt 57af58b3ad acp_thread: Share v2 configuration options (#65093)
Use SDK v2 configuration options and values at the shared model/UI
boundary while keeping the existing backend-owned collection and v1
transport. This is preparation for v2 integration, **not v2 wire
enablement**.

- Explicitly adapt legacy options, including `id` → `configId`, `group`
→ `groupId`, category strings, descriptions, and option/group/value
metadata. Convert full snapshots before replacing cached state.
- Lower supported shared setter values to the original v1 wire shape;
reject unsupported values before an RPC or state mutation.
- Preserve select/boolean controls, grouped pickers, favorites,
persistent settings, defaults, and live updates. Retain unknown option
payloads without editable controls; stale controls validate current
kind/choices before acting.

Dedicated v1 modes and protocol selection remain unchanged. No
additional configuration store or persistent-settings format is
introduced.

## Review guide

- [Shared
interface](https://github.com/zed-industries/zed/blob/d7116d9eb95ee5082b368a00f308f4e060821908/crates/acp_thread/src/connection.rs#L339)
and [explicit
adapters](https://github.com/zed-industries/zed/blob/d7116d9eb95ee5082b368a00f308f4e060821908/crates/acp_thread/src/config_options.rs#L4).

Release Notes:

- N/A
2026-10-02 16:54:30 +00:00
Cameron Mcloughlin f37989fbdf gpui: Cross-platform headless windowing API and linux impl (#64969)
Adds a cross-platform API for GPUI apps to switch between windowed and
headless modes.

Release Notes:

- N/A
- [GPUI]: N/A

---------

Co-authored-by: Antonio Scandurra <me@as-cii.com>
2026-10-02 16:04:33 +00:00
Ben Brandt 23d10a4754 acp_thread: Append streamed tool-call content (#65090)
## Summary

Add a typed SDK v2 tool-content append path. `ToolCallContentChunk`
appends one complete item; `ToolCallUpdate.content` still replaces the
collection. No wire handler or protocol selection is added.

- Target exact/historical tool IDs without rebuilding the existing
snapshot. New IDs create minimal records with reported fields unset;
this is a lenient client policy.
- Reuse item preparation and registered terminal placeholders. Preserve
existing render entities, native diff ownership, tool
status/permissions/metadata/locations/raw values, and normal raw-output
fallback behavior.
- Emit updates for the actual row; only new rows use the existing
streaming-flush boundary.
- Retain item/body metadata. Delivery-scoped chunk `_meta` is not
promoted into aggregate state or stored as a separate history, matching
message chunks.

## Review guide

Production code is unchanged by the cleanup:

- [Append and fallback
refresh](https://github.com/zed-industries/zed/blob/a15b15ecc1f4feaaaf87123d9349e3d9a24d2079/crates/acp_thread/src/acp_thread.rs#L1574).
- [Shared single-item
preparation](https://github.com/zed-industries/zed/blob/a15b15ecc1f4feaaaf87123d9349e3d9a24d2079/crates/acp_thread/src/acp_thread.rs#L2949).
- [Exact-ID append and first-seen
defaults](https://github.com/zed-industries/zed/blob/a15b15ecc1f4feaaaf87123d9349e3d9a24d2079/crates/acp_thread/src/acp_thread.rs#L5332).

Coverage is now three focused regressions, reduced from seven and
approximately **1,000 → 300 test lines**:

1.
[Ordering/targeting](https://github.com/zed-industries/zed/blob/a15b15ecc1f4feaaaf87123d9349e3d9a24d2079/crates/acp_thread/src/acp_thread.rs#L13068):
historical ID, append vs replacement, clear/raw fallback, defaults,
metadata isolation, original Markdown, and row events.
2.
[Preservation](https://github.com/zed-industries/zed/blob/a15b15ecc1f4feaaaf87123d9349e3d9a24d2079/crates/acp_thread/src/acp_thread.rs#L13180):
real permission waiter, reported state, native diff identity, and
unrelated buffered text/new-row flush.
3. [UI
integration](https://github.com/zed-industries/zed/blob/a15b15ecc1f4feaaaf87123d9349e3d9a24d2079/crates/agent_ui/src/conversation_view.rs#L10077):
an existing expanded search automatically refreshes after older-tool
append, while row/entity identity and the later tool remain unchanged.

Broad content-variant, full diff-editor, and repeated render/search
matrices remain covered by existing tests rather than being repeated
here. Fixtures use SDK builders; no helper framework was added.

## Validation

- Full suites: **240 core**, **496 UI** (serial).
- Two core regressions: **100 seeds**; UI regression: **20 seeds**.
- Six-package `./script/clippy`, formatting and `git diff --check`
passed.
- Production text was verified byte-for-byte unchanged by this test-only
cleanup.

## Suggested .rules additions

GPUI testing guidance: `VisualTestContext::debug_bounds` needs a static
selector. Reuse allocated fixture selectors for runtime IDs; do not
borrow temporary `&format!(...)` strings.

Release Notes:

- N/A
2026-10-02 14:52:16 +00:00
Finn Evers 9dd6993e2e gpui_shared_string: Avoid intermediate string allocation when deserializing a SharedString (#65089)
## Summary

This PR improves how we deserialize SharedStrings. Since we moved to
`SmolStr` under the hood some time ago, which takes a string by `impl
AsRef<str>` in its constructor, we can get rid here of allocating a
string where possible in favor of using a stringvisitor during
deserialization. This provides us with some decent improvements.

## Testing

The benchmark results are the following:

| Case | `from_str` before | `from_str` after | Δ | 
|---|---:|---:|---:|
| short (≤23 B, inline) | 23.1 µs | 11.6 µs | −50% 
| short, escaped | 33.2 µs | 22.4 µs | −32% | 
| long (~66 B, heap) | 46.9 µs | 31.4 µs | −33% | 
| long, escaped | 307.6 µs | 267.6 µs | −13% | 

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

- N/A
- [GPUI] Improved memory usage and performance when deserializing
SharedStrings.
2026-10-02 13:48:20 +00:00
Bennet Bo Fenner 309f91f564 copilot: Move enterprise URI to top-level setting (#65082)
This PR is moving the `enterprise` URI to a top level `copilot` settings
because it is used for both Edit Predictions and Copilot Chat.
Previously it was listed under `languages > copilot > enterprise_uri`

Release Notes:

- N/A
2026-10-02 11:22:04 +00:00
Ben Brandt 3209c7d31f acp_thread: Add generic permission prompts (#65080)
Extend the request-owned permission model from merged #65039 to typed
ACP v2 permission requests and a minimal request-owned UI. This is a
shared-model/UI foundation, **not v2 wire enablement**.

- Retain the complete SDK request: title, description, subject, offered
options, unknown option kinds, and request/subject/option metadata.
Legacy tool permissions remain a separate variant in the same
authoritative pending-request store.
- Validate the owning session and nonempty, unique offered IDs before
insertion. Multiple requests for the same subject coexist under distinct
local request IDs; subjects never create or update tool history.
- Return the exact explicitly selected SDK option ID, including for
unknown kinds. Do not infer approval from unknown hints or apply legacy
tool-progress policy to generic choices. Selection and cancellation
target the exact session/request record.
- Render plain-text generic cards in the existing permission area
without transcript anchors or scroll-to-tool behavior. Root views
include child requests even without a spawning-tool anchor; standalone
child views remain session-scoped.
- Preserve legacy flat/dropdown/pattern controls, parameters,
grant-versus-action-choice behavior, and grouped request ordering. A
generic-first request blocks legacy shortcuts rather than allowing them
to skip to a later tool request. Generic records do not enter legacy
selection caches, authorization telemetry, tool counts, or scroll
summaries.
- Notify on registration/hydration and new permission requests so late
or unanchored child prompts do not depend on unrelated rendering events.
Bound long option controls and provide full-name tooltips.

## Review guide

Most added lines are regression tests. The production boundary stays in
the existing owners:

1. [Request
ownership](https://github.com/zed-industries/zed/blob/d2e2870906800e9c34244b4aff30fbc561ceb8d4/crates/acp_thread/src/acp_thread.rs#L1055),
[typed
insertion/selection](https://github.com/zed-industries/zed/blob/d2e2870906800e9c34244b4aff30fbc561ceb8d4/crates/acp_thread/src/acp_thread.rs#L5462),
and [canonical
settlement](https://github.com/zed-industries/zed/blob/d2e2870906800e9c34244b4aff30fbc561ceb8d4/crates/acp_thread/src/acp_thread.rs#L5708).
2. [Conversation
hydration/invalidation](https://github.com/zed-industries/zed/blob/d2e2870906800e9c34244b4aff30fbc561ceb8d4/crates/agent_ui/src/conversation_view.rs#L296)
and [legacy-only tool
counts](https://github.com/zed-industries/zed/blob/d2e2870906800e9c34244b4aff30fbc561ceb8d4/crates/agent_ui/src/conversation_view.rs#L521);
the shared pending selector retains its generic-first barrier.
3. [Generic cards and exact-ID
callbacks](https://github.com/zed-industries/zed/blob/d2e2870906800e9c34244b4aff30fbc561ceb8d4/crates/agent_ui/src/conversation_view/thread_view.rs#L3767),
including bounded controls with complete-label tooltips.
4. [Lifecycle
regressions](https://github.com/zed-industries/zed/blob/d2e2870906800e9c34244b4aff30fbc561ceb8d4/crates/acp_thread/src/acp_thread.rs#L20594),
[narrow-card
geometry](https://github.com/zed-industries/zed/blob/d2e2870906800e9c34244b4aff30fbc561ceb8d4/crates/agent_ui/src/conversation_view.rs#L15075),
and [rendered
late-registration/deduplication](https://github.com/zed-industries/zed/blob/d2e2870906800e9c34244b4aff30fbc561ceb8d4/crates/agent_ui/src/conversation_view.rs#L15389).

Release Notes:

- N/A
2026-10-02 11:07:39 +00:00
itsfuad 7362739f94 agent_ui: Fix elicitation radio indicator alignment (#63885)
## Summary

Addresses the selected radio dot alignment reported as the second issue
in #62955 (ask_user formatting issues), which is already closed.

Merged PR #63656 fixed long option wrapping by removing label
truncation. That fix was already present in this branch base. This PR
keeps option text rendering unchanged while fixing the remaining radio
alignment issue and extracting the radio behavior into a reusable UI
component.

Original Issue:
<img width="1672" height="844" alt="image"
src="https://github.com/user-attachments/assets/54422dec-f35a-4b83-b16c-831e8755cf50"
/>

After #63656:
<img width="769" height="386" alt="image"
src="https://github.com/user-attachments/assets/f659f518-2b4a-47cc-8e2d-c9d46bbdbe10"
/>


After:
<img width="777" height="385" alt="Screenshot From 2026-09-07 18-05-16"
src="https://github.com/user-attachments/assets/71ee9343-9623-46bc-8be8-09667fab89b6"
/>


## Implementation

- Add a reusable `ui::RadioButton` component that owns the full
option-row hit target, click handling, focus-visible styling,
configurable tab index, accessibility role/state, and theme-derived
radio styling.
- Keep the elicitation form responsible for selection state and the
selection callback while moving the radio control mechanics into
`crates/ui`.
- Paint the outer radio circle and selected dot from the same
pixel-snapped bounds instead of independently laid-out elements.
- Derive the dot using equal whole-device-pixel insets so the outer
circle and selected dot remain concentric when rounded device-pixel
diameters have different parity.
- Preserve the original `size_3()` visual radio inside the 20px control
slot, while the full row remains clickable.
- Provide an explicit accessible label for each radio option and expose
the selected state through `Role::RadioButton` / `aria_selected`.
- Preserve the existing elicitation row spacing, hover styling,
long-option layout, and keyboard navigation behavior.

## Scope

This PR does **not** re-enable the `ask_user` tool or change its default
profile settings. The tool remains opt-in following #63036. Subagent
question visibility and broader radio-group behavior such as
arrow-key/roving-tab-index navigation are outside this change.

## Validation

- `cargo check -p ui -p agent_ui` passed.
- `cargo test -p agent_ui form_choices_are_keyboard_accessible --
--nocapture` passed.
- `rustfmt --edition 2024 --check
crates/ui/src/components/radio_button.rs crates/ui/src/components.rs
crates/agent_ui/src/conversation_view/elicitation.rs` passed.
- `git diff --check` passed.
- Built and ran the updated application locally.
- Manually verified the single-select UI with short and long options:
the selected dot is centered, the visual radio retains its original
size, long option text wraps correctly, and the row layout remains
intact.
- Other display scales have not been visually verified.

Release Notes:

- Fixed selected radio indicator alignment in agent elicitation forms.

---------

Co-authored-by: MrSubidubi <finn@zed.dev>
2026-10-02 10:37:42 +00:00
Yue Fei 90731bdec0 editor: Fix movement mismatch between minimap thumb and cursor (#62087)
# Objective

Fixes #44824

This bug results from an incorrect mathematical derivation of the
`pixels_per_line` calculation formula. The complete derivation is too
lengthy to include here, so it is provided in a separate comment below.

This PR does the same thing as #60080, but it is a refined version of
it.

## Solution

Replace the previous incorrect calculation formula with the correct one.

## Testing

These changes are manually tested on my computer and all worked as
expected.

## Self-Review Checklist:

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

## Showcase

This recording shows the behavior in short document environment:


https://github.com/user-attachments/assets/2e5e7aec-ccf2-47c3-a046-e7f668bdb6c0

While this one shows the behavior in long document environment:


https://github.com/user-attachments/assets/e5809c81-4cfb-45f9-8ec7-051a487bd6f7

It's apparent that the minimap thumb moves closely with the cursor in
both environments.

---

Release Notes:

- Fixed movement mismatch between minimap thumb and cursor.

---------

Co-authored-by: Finn Evers <finn@zed.dev>
2026-10-02 10:08:12 +00:00
Ben Brandt c5b6d4386e acp_thread: Scope permission lifetimes to requests (#65039)
Give each pending permission request a stable local identity and a
single lifetime owner. Existing v1/native permissions are the real
consumers; this prepares generic permission support without adding v2
wire handling or generic cards.

- `AcpThread` owns ordered pending request records, options,
authorization kind, and response senders. Tool calls retain only a link
to the current request; UUIDs are local and never become agent-visible
IDs.
- Creation and settlement emit state-owned notifications. Response tasks
only deliver outcomes, so dropping a waiter cannot keep resolved
requests in UI bookkeeping or prevent activity/sleep state
reconciliation.
- SDK cancellation and internally generated UI actions capture the exact
request ID and owning session. Replacing a request for the same tool
cancels its predecessor; late cleanup or captured controls cannot affect
the successor.
- Validate offered option IDs and derive permission kind from the record
rather than trusting action data. Preserve native dropdown/pattern
parameters and the permission-grant versus action-choice continuation
policy.
- Settle detached requests on terminal status, even when presentation
preparation fails, and clean up records on refusal/rewind/removal.
Legacy cancellation with no local running turn now settles pending
permissions without changing unrelated tool state or sending a new
no-turn wire cancellation.
- Keep session-bucket/per-session presentation ordering, but validate
lookups/counts against canonical pending records. Late registration
seeds those records rather than rescanning tool history.
- Give dropdown/pattern selections one shared `Conversation` owner.
Embedded child controls, displayed selection, authorization, and
exact-ID cleanup now use the same cache, preventing orphan UUID
selections after child resolution/supersession.

## Review guide

1. [Request identity/ownership
types](https://github.com/zed-industries/zed/blob/54b3ea39493f8adb2d4c1177e839d2eb2f76125d/crates/acp_thread/src/acp_thread.rs#L1052),
then [request APIs and
settlement](https://github.com/zed-industries/zed/blob/54b3ea39493f8adb2d4c1177e839d2eb2f76125d/crates/acp_thread/src/acp_thread.rs#L5396-L5583).
Check sender ownership, replacement, offered-choice validation, and
exact-ID idempotence.
2. [Tool update
detachment](https://github.com/zed-industries/zed/blob/54b3ea39493f8adb2d4c1177e839d2eb2f76125d/crates/acp_thread/src/acp_thread.rs#L5101)
and [legacy
cancellation](https://github.com/zed-industries/zed/blob/54b3ea39493f8adb2d4c1177e839d2eb2f76125d/crates/acp_thread/src/acp_thread.rs#L6135).
Status remains authoritative on presentation failure; idle cleanup is
deliberately narrow.
3. [SDK
adapter](https://github.com/zed-industries/zed/blob/54b3ea39493f8adb2d4c1177e839d2eb2f76125d/crates/agent_servers/src/acp.rs#L5876)
and [real SDK cancellation
regression](https://github.com/zed-industries/zed/blob/54b3ea39493f8adb2d4c1177e839d2eb2f76125d/crates/agent_servers/src/acp.rs#L4731).
The test requires the old RPC's `RequestCancelled` error, not merely a
superseded permission outcome.
4. [Conversation ordering/selection
owner](https://github.com/zed-industries/zed/blob/54b3ea39493f8adb2d4c1177e839d2eb2f76125d/crates/agent_ui/src/conversation_view.rs#L285),
[action
addressing](https://github.com/zed-industries/zed/blob/54b3ea39493f8adb2d4c1177e839d2eb2f76125d/crates/agent_ui/src/conversation_view/thread_view.rs#L3099),
and [optional action
fields](https://github.com/zed-industries/zed/blob/54b3ea39493f8adb2d4c1177e839d2eb2f76125d/crates/agent_ui/src/agent_ui.rs#L346).
5. [Rendered embedded-child
regression](https://github.com/zed-industries/zed/blob/54b3ea39493f8adb2d4c1177e839d2eb2f76125d/crates/agent_ui/src/conversation_view.rs#L13858)
and [new core boundary
tests](https://github.com/zed-industries/zed/blob/54b3ea39493f8adb2d4c1177e839d2eb2f76125d/crates/acp_thread/src/acp_thread.rs#L19396).
These cover actual controls, outcome params, UUID-cache cleanup, failed
replacement, last-handle release, stale actions, and request recreation.

Most of the diff is regression coverage and migration of existing
assertions/readers; no second pending lifecycle store is introduced. The
UI index and selections are presentation-only state.

Release Notes:

- N/A
2026-10-02 09:29:20 +00:00
Daniel Strobusch cd8c467418 Add completions and schema validation for agent profile tool settings (#65036)
## Summary

List built-in tools in the settings schema so profile tool keys are
suggested and unknown keys are flagged. Test that the schema covers the
tools in the default write and ask profiles.


## Testing

Tested manually on local build. 

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

Signed-off-by: Daniel Strobusch <1847260+dastrobu@users.noreply.github.com>
2026-10-02 08:41:14 +00:00
andrew 28d5832adb markdown_preview: Add heading_font_weight setting (#64421)
Headings in the Markdown preview are hardcoded to semibold (600). Users
who set a lighter UI font, or who simply prefer lighter headings, have
no way to change this.

This adds `markdown_preview.heading_font_weight`, applied to H1 through
H6 in the preview. It defaults to `600`, so existing rendering is
unchanged unless the setting is set.

```jsonc
{
  "markdown_preview": {
    "heading_font_weight": 500
  }
}
```

The value flows through `ThemeSettings` alongside the existing preview
typography settings, so the generic `markdown` crate gains no dependency
on `markdown_preview`. Because notebook Markdown cells share the preview
typography, they follow the setting too. Bold text inside headings and
table header cells keep their own weights. The setting is also exposed
in the settings editor under Markdown Preview Font, and documented in
the visual customization docs.

## Before / after

| Default (`600`) | `"heading_font_weight": 500` |
| --- | --- |
| <img width="2000" height="1299" alt="heading-weight-600-default"
src="https://github.com/user-attachments/assets/403d29bb-34ed-4cb1-b333-920ec5ee65f0"
/> | <img width="2000" height="1299" alt="heading-weight-500"
src="https://github.com/user-attachments/assets/9fbdd7f9-2d56-4815-a39e-fd1325ba7cd2"
/> |


## Testing

- New tests in `crates/markdown` assert every preview heading level
resolves to `600` by default and to the configured weight when set, and
that the weight does not leak into editor or agent Markdown.
- Verified manually in a dev build with `SF Pro` at weights 500 and 600;
the open preview re-renders on settings save.

Release Notes:

- Added `markdown_preview.heading_font_weight` to configure the font
weight of headings in the Markdown preview.
2026-10-02 08:35:39 +00:00
Mansoor Ahmed c9daddfa0a git_ui: Show file counts in git panel section headers (#65028)
The section headers in the git panel (Staged / Unstaged, Tracked /
Untracked, and Conflicts) didn't say how many files were in each
section. With a long list of changes you had to scroll or collapse
sections to get a sense of what was staged versus not. VS Code shows a
small count next to each group, and this brings the same thing to Zed.

Each section header now shows its file count in a small chip next to the
"stage all" checkbox. The chip is hidden when a section is empty, so the
pinned empty Staged/Unstaged headers stay clean.

A couple of notes on the implementation:

- The count comes from the same per-section lists that
`update_visible_entries` already builds to render the rows, so the
number always matches what's on screen. The existing `tracked_count` /
`new_count` fields couldn't be reused here: there's no equivalent for
Staged/Unstaged, and a partially staged file shows up in both of those
sections.
- In tree view the count is the number of files, not files plus
directories.
- The badge reuses the existing `Chip` component, which the panel
already uses for tags in the history view.

I added assertions to the existing grouping tests to cover the counts
for both the staging and the status grouping.

## Showcase

### Staged / Unstaged

<table width="100%">
<tr>
<td width="50%" valign="top">

**Before**

<img width="358" height="605" alt="image"
src="https://github.com/user-attachments/assets/d23c7051-abf7-470a-9194-9e3ea7ae2a7e"
/>

</td>
<td width="50%" valign="top">

**After**

<img width="360" height="665" alt="image"
src="https://github.com/user-attachments/assets/38e5528d-0d73-4f1d-ab30-2cd0f00b8ef1"
/>

</td>
</tr>
</table>

### Tracked / Untracked

<table width="100%">
<tr>
<td width="50%" valign="top">

**Before**

<img width="360" height="631" alt="image"
src="https://github.com/user-attachments/assets/d234321e-7f3b-4215-b9ed-34a6da8d6904"
/>

</td>
<td width="50%" valign="top">

**After**

<img width="359" height="553" alt="image"
src="https://github.com/user-attachments/assets/02b702f9-89b9-4af3-876f-06ed6c1c8320"
/>

</td>
</tr>
</table>

Release Notes:

- Added file counts to section headers in the git panel
2026-10-02 08:15:29 +00:00
Gautam Manchandani 981b224a46 Fix forward Delete key icon (#65037)
<img width="2940" height="1720" alt="keymap-dark"
src="https://github.com/user-attachments/assets/f4c28b4f-6a33-4479-a24f-c95d64a790c3"
/>
Closes #64964.

Use a dedicated forward Delete icon (⌦) instead of Backspace (⌫). Add a
regression test for distinct icons.

Release Notes:

- Fixed identical Backspace and Delete icons in the keymap editor.
2026-10-02 08:11:03 +00:00
Zhaokang Jiang 651d693d42 Make Git panel file actions work with multiple selections (#64640)
# Objective

Make Git panel file actions apply to the current multi-selection. View
File and several context-menu actions currently act on only the focused
row.

## Solution

- Open every selected file, file diff, and tracked file history.
- Copy selected paths as newline-separated text, preserving explicitly
selected directory paths.
- Add multiple selected untracked files to `.gitignore` or
`.git/info/exclude`.
- Show plural menu labels and avoid processing a partially staged path
twice when it appears in two sections.
- Keep single-file actions and the existing stage/discard behavior.

## Testing

- `cargo test -p git_ui --lib` — 164 passed on Windows.
- `cargo fmt --all -- --check` — passed.
- `git diff --check` — passed.
- New regression tests cover multi-file tabs, diffs, histories, path
copying, ignore/exclude writes, and duplicate status rows.


Release Notes:

- Improved Git panel file actions for multiple selected files.

---------

Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
2026-10-02 08:09:25 +00:00
Finn Evers 35bba8eef7 Allow builtin language servers to be disabled by default (#65049)
## Summary

This addresses the concern mentioned in
https://github.com/zed-industries/zed/pull/65030#pullrequestreview-5380076060

Release Notes:

- N/A
2026-10-02 07:47:07 +00:00
Viraj Bhartiya 2a97fbf22b agent_ui: Keep the Awaiting Confirmation label on a single line (#64952)
## Summary

Closes #62772

The "Awaiting Confirmation" label below a pending tool call animates an
ellipsis by changing its text (`Awaiting Confirmation`, `.`, `..`,
`...`). When the text is close to the row's width, it wraps onto a
second line whenever the dots are drawn and goes back to one line when
they aren't. The row keeps changing height, so the tool call
confirmation above it bobs up and down.

This renders the label with `single_line()` so it never wraps and the
row height stays fixed.

This replaces #64887. That PR reserved the full `...` width, so the
label stopped bobbing but stayed wrapped onto two lines. As
@ChristopherBiscardi pointed out, the wrapping itself is the bug.

## Screenshots

The agent panel at its 300px minimum width with `"ui_font_size": 26`
(the easiest way to put the label right at its wrap point), captured
across one animation cycle.

**Before**: the row grows to two lines when the dots appear:


![Before](https://raw.githubusercontent.com/virajbhartiya/zed/pr-assets/pr-assets/confirm_before.png)

**After**: the label stays on one line in every frame:


![After](https://raw.githubusercontent.com/virajbhartiya/zed/pr-assets/pr-assets/confirm_after.png)

## Testing

1. Set `"ui_font_size": 26` and `"agent_ui_font_size": 26`, and shrink
the agent panel to its minimum width.
2. Ask the agent to do something that needs tool confirmation.
3. Watch the "Awaiting Confirmation" row as the dots cycle. It no longer
changes height.

The screenshots come from a stub agent with a pending permission
request, rendered in Zed's visual test harness on macOS. `cargo clippy
-p agent_ui --all-targets -- --deny warnings` and `cargo fmt --check`
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).
- [ ] Tests cover the new or changed behavior.

Release Notes:

- Fixed the agent panel's "Awaiting Confirmation" row jumping up and
down while its ellipsis animates.
2026-10-02 03:49:24 +00:00
Ian Chamberlain 57bfce2945 git_ui: Enable splitting MultiDiffView (directory zed --diff) (#64967)
## Summary

Enable split diffs for `zed --diff`, where the left and right sides are
directories.
This simply reuses the existing split diff that's already used for
single-file diffs, git UI, etc.

I believe this will make the Zed diff experience more consistent for use
cases like `git difftool`, `jj diff --tool` etc.

See #50046 for a similar change that made this work for single-file diff
views.


### Before

<img width="1624" height="975" alt="image"
src="https://github.com/user-attachments/assets/db8c0592-8bea-4b8f-9ccc-d94456fb6208"
/>

### After

<img width="1624" height="976" alt="image"
src="https://github.com/user-attachments/assets/c074cc5f-bdf7-4747-9ef5-4f77b3e42ee6"
/>

<img width="1624" height="976" alt="image"
src="https://github.com/user-attachments/assets/a97026a8-312d-4a51-a9f7-24343640237a"
/>


## Testing

1. `cargo build`
2. `zed --zed target/debug/zed --diff $left $right` (where `$left` and
`$right` are directories)

For the screenshots above, I used `jj` configuration like this. It's a
little awkward to setup because the debug build of Zed looks for grammar
files in `crates/grammars/src` to properly highlight everything

```toml
[merge-tools.zed-tester]
program = "bash"
diff-invocation-mode = "dir"
diff-args = [
  "-c",
  '''
    dir=$PWD
    cd /path/to/zed/checkout
    zed-preview --zed ./target/debug/zed --wait --diff "$dir/$1" "$dir/$2"
  ''',
  "",
  "$left",
  "$right"
]
```

Usage with this config: `jj show $revision --tool zed-tester` or `jj
diff -r $revisions --tool zed-tester`

## 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).
- No new UI components here, just plugging existing ones together. UX
should match what already existed for other usages of these components

- [x] Tests cover the new or changed behavior.
- In particular, added a test for the same scenario as #60914 to ensure
that it works for this view

Release Notes:

- Enable side-by-side view for multibuffer `zed --diff` of directories
2026-10-01 22:51:18 +00:00
Marcos Alcantara 20d29fc6bc Rewatch a directory that was deleted and recreated (#61372)
# Objective

Addresses the delete-then-recreate cause reported under #53901
(@Akizay's reproduction) — a different root cause from the macOS
FSEvents fd-saturation case in #61072, so this intentionally does not
use a closing keyword.

Supersedes #64151 (rescan stale empty directories on expand), which
recovers from the same stale watch later in the UI.

When a directory is deleted and quickly recreated while it is being
repopulated — e.g. a build or test step that clears an output directory
and then rewrites it — most of the newly-written files never appear in
the project panel (nor do buffers/git status reflect them) until the
workspace is reloaded. @Akizay reproduced this on Linux with a small
Python script that `rmtree`s a directory and immediately recreates it
with 20 files + 20 subdirectories; only the first one or two show up.

## Root cause

Proven empirically on Linux/inotify (see Testing): the failure is a
stale watch registration in the `fs` crate, not fd budgets and not an
LSP.

1. Each watched directory has its own inotify watch (inotify is not
recursive). `FsWatcher` tracks these in a `registrations` map keyed by
path.
2. When the directory is deleted, the kernel silently invalidates its
inotify watch (`IN_IGNORED`), but `FsWatcher`'s `registrations` entry
lingers, because the delete and the recreate coalesce within one
`FS_WATCH_LATENCY` (100ms) debounce window, so the worktree processes
the path as still-present (metadata exists again) and never unwatches
it.
3. When the worktree rescans the recreated directory and calls
`watcher.add(path)`, both `FsWatcher` and the shared per-backend
registration state still mark the path as watched, so no new OS watch is
installed. Files written into the new directory produce no events until
an unrelated rescan.
4. Separately, `scan_dir` established the directory's watch only *after*
enumerating its contents (`read_dir`), leaving a TOCTOU window even when
a fresh watch is created.
5. The same stale state happens when a watched directory is renamed. Its
inotify watch, and the watches on its watched subdirectories, follow the
moved directory, so a directory recreated at the old path goes
unwatched. It also happens when an inotify queue overflow drops the
removal event.

This matches @Akizay's observation that inserting a `sleep` longer than
`FS_WATCH_LATENCY` between the delete and the recreate fixes it: with
the delete processed in its own window, the worktree unwatches the path,
so the later `add` re-registers cleanly.

## Solution

- `fs`: the shared registration state for each path gets a `stale` flag.
On native non-recursive (Linux) watches, `dispatch` sets it before
callbacks run:
  - for `Remove` or rename events on a registered path;
  - on a rename, also for every registered path under it;
  - for every path on a queue overflow.

The next `add` for a stale path calls `unwatch`, then `watch`, and
clears the flag. One repair covers every subscriber that shares the
watch. A directory that stays deleted costs only a hash lookup per
event; it is cleaned up through the existing `remove`.
- `fs`: backend `watch`/`unwatch` calls are now made while holding the
per-backend state lock. A concurrent add can't treat a path as watched
before its new watch exists, and a concurrent final remove can't
interleave with a repair. Backend callbacks only enqueue events, so this
can't deadlock.
- `worktree`: `scan_dir` installs the directory's watch before
`read_dir`, so a child created during enumeration still produces an
event.

Polling and macOS/Windows native watches are recursive and unchanged.

Known limitations:

- A stale watch is repaired only when something calls `add` for that
path again. The worktree scanner does this when it rescans the
directory.
- A poll watcher's first registration walks its tree while holding the
poll backend's state lock. Poll events and other poll adds wait until it
finishes; no events are lost.

Disclosure per the AI policy: I investigated and developed this with an
LLM agent (Claude Code / Opus 4.8), reviewing and directing each step;
the measurements below are from real runs I can defend in review.

## Testing

- `fs_watcher::tests::removed_or_renamed_path_is_rewatched_once` (Linux
only, fake backend). Two subscribers share a directory, and its
subdirectory is watched too. The test covers a removal, an overflow, a
rename of the parent directory, and the same rename on a
case-insensitive path. It asserts the backend's full `watch`/`unwatch`
calls after a repair. Each case fails without its part of the fix.
- `test_new_directory_scan_does_not_miss_event_before_adding_watcher`
(worktree, Linux only). A FakeFs hook creates a file without an event
while the new directory's watch is being installed. The test fails if
`scan_dir` reads before watching.
- `test_root_rescan_keeps_root_watcher_registered` is updated. On Linux
the overflow rescan now reinstalls the root watch before reading the
root, so it expects 2 root `watch` calls. On macOS and Windows it still
expects 1.

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Fixed files created in a directory that was deleted and immediately
recreated (for example by a build or test step that clears and
repopulates an output directory) not appearing until the workspace was
reloaded

---------

Co-authored-by: Ben Kunkle <ben@zed.dev>
2026-10-01 21:21:35 +00:00
Anthony Eid 36b6d0951f gpui: Stop sealing empty intervals on idle frame skips (#65057)
## Summary

Follow-up to #64958. macOS (display link), Windows (`VSyncProvider`) and
X11 (refresh timer) deliver a frame request on every refresh while a
window is visible. Since frame skips became interval boundaries, each
idle refresh:

- sealed an empty snapshot that the hang monitor thread had to build and
discard, and
- flushed folded sub-floor task polls into the journal via the
platform-signal and skip records. Flushed polls reach the sealer even
when end-of-turn idle handling discards folded-only work, so idle
wake-ups could again accumulate toward a later frame budget, which is
what that rule exists to prevent.

Changes:

- `FrameSkipped` boundaries follow the same rule as idle boundaries:
they're recorded only when an event was retained since the last
boundary.
- `PlatformSignal` and `ReentrantFrameSkipped` are published as point
records that leave folded polls folded.
- The sealer no longer seals empty intervals.
- Throttled and no-render skips still seal real work, so GPUI's own
frame-rate limits (inactive windows, thermal pressure) aren't counted as
dropped frames.
- Cleanups: the throttle carries a `FrameRateLimit` enum instead of
`(Duration, bool)` with an underscore-named binding, `#[repr(u8)]` is
removed from `FrameRequestSource`, and `PlatformFrameSignal::record`
uses `expect(unused_variables)` in profiler-disabled builds instead of
`let _ = (at, source);`.

## Testing

- New `idle_refreshes_seal_nothing_and_keep_polls_folded`: refreshes
with folded polls and no retained work publish only platform signals and
seal nothing.
- Updated skip tests to give skips retained work. A late signal without
work now seals nothing.
- `cargo test -p gpui --features profiler --lib` (438 passed),
profiler-disabled frame-signal and window tests, `./script/clippy -p
gpui`, Windows (`--no-default-features`) clippy, wasm32 check.

Release Notes:

- [GPUI] Fixed idle frame requests sealing empty hang-detection
intervals and flushing folded task polls on every refresh
2026-10-01 20:45:11 +00:00
Conrad Irwin 506beb34de gpui: Record debug selectors only in debug builds (#65056)
Since #65043, `gpui/test-support` is safe to enable in every build, and
downstream projects (Delta) do so to avoid compiling GPUI twice. One
exception remained: with the feature on, `debug_selector` allocates its
`String` on every element construction, and paint copies it into the
frame's debug-bounds map every frame, even in release builds. Its docs
already promised it was a no-op in release.

Selectors are now recorded only in GPUI's own tests and in debug builds
with `test-support`. `VisualTestContext::debug_bounds` returns `None` in
optimized test builds; Zed doesn't run tests that way.

Release Notes:

- [GPUI] Fixed `debug_selector` allocating and recording bounds every
frame in release builds with `test-support` enabled
2026-10-01 20:03:55 +00:00
Anthony Eid cd4fc8de4c gpui: Journal platform frame requests and skipped frames (#64958)
## Summary

Pass captured platform frame request timing to `on_request_frame` and
emit foreground journal records. This PR provides timing data; it does
not classify platform waits or change latency histogram/reporting
policy.

`RequestFrameOptions` carries an optional captured time and a
native-callback/local-schedule source. A per-window atomic preserves the
earliest coalesced request timestamp and its matching source until
main-thread delivery. Journal records include window identity, captured
time when available, foreground handling time, and source. No request
IDs or second journal stream are introduced.

## Completed frame skips (retained for review)

Keep completed GPUI decisions not to render as sealing boundaries, with
no-render-needed, inactive-throttle, and thermal-throttle reasons. They
seal at foreground completion without satisfying or clearing pending
demand. Hang serialization uses `sealed_by: "frame_skipped"`.

Platform frame requests do not seal or count as foreground work.
Reentrant deferrals remain non-sealing raw diagnostic records with their
own window/time payload; they cannot be represented as completed skip
reasons or sealing skip boundaries. Raw point diagnostics are not copied
into snapshots. Hang qualification still uses foreground execution
durations and occupancy; infinite foreground hang detection remains
follow-up work.

The skip-sealing portion is intentionally retained for review and can be
split out if requested. The signal-to-present histogram, refresh
estimation, platform-wait filtering, and Frame Duration Report changes
are deferred. The complete prior checkpoint is preserved on
`platform-frame-latency-followup`; it is not a second PR yet.

## Platform sources

- **macOS:** CoreVideo’s supplied current host timestamp is converted to
an `Instant` using paired host-clock/local-clock samples, with
receipt-time fallback for invalid timestamps. Capture happens before
registry locking/coalescing; synchronous `displayLayer` and key-window
draws use call time. `WindowFrameSource::stop()` clears stale signals
after detaching the subscription.
- **Windows:** VSyncProvider time immediately after waiting, before
redraw invalidation. Compositor-paced waits are tagged `NativeCallback`;
failed or short waits followed by the existing fallback sleep are tagged
`LocalSchedule`. Coalescing retains the earliest timestamp and its
matching source together; hidden/minimized slots are cleared. Wait and
redraw behavior are unchanged.
- **Wayland:** compositor milliseconds converted against CLOCK_MONOTONIC
with wrapping subtraction and a 60-second plausibility bound;
receipt-time fallback. Demand pings retain enqueue time; retries retain
scheduled deadlines.
- **X11:** scheduled calloop refresh deadline; expose requests have no
captured time.
- **Web:** no captured timestamp yet, but requests are still journaled
with foreground handling time.

Captured-time option fields remain available regardless of the profiler
feature so independently featured backends share one API shape. Built-in
backends collect timestamps only with `gpui/profiler`: disabled capture
does not evaluate clock/conversion closures, the accumulator has no
timestamp storage or atomic operations, and callback delivery and actual
scheduling clocks remain unchanged.

Wayland's protocol does not guarantee the clock epoch. Windows fully
covered-window behavior and X11 compositor gating beyond the timer
remain limitations of these sources. Live compositor/display-off/lock
workflows remain unverified. Skip-boundary changes touch `journal.rs`
and `hang.rs`. This PR will merge before the parallel hang-watchdog
work; that follow-up PR will resolve its conflicts against these
changes.

## Verification

Latest feature-gating checks: the profiler-disabled capture regression
passed; enabled coalescing and window integration tests passed; macOS
and GPUI/Web Wasm compiled with profiling both disabled and enabled. An
optimized probe built from the shared implementation confirmed disabled
capture/accumulator paths contain no calls or atomic instructions.
Clippy, formatting, and whitespace checks passed. Latest-head CI passed
Linux, Windows, and macOS tests and Clippy, along with Wasm and style
checks.

Latest type/guard cleanup: seven focused journal, hang, and window tests
passed, along with the profiler-disabled GPUI library check, Clippy,
formatting, and whitespace checks. The consecutive profiler guards are
grouped without shortening the foreground-turn guard lifetime.

- Previous extracted checkpoint: `cargo test -p gpui --features profiler
--lib -- --test-threads=1`: **431 passed**.
- Focused TestPlatform tests exercise request/source emission and
pending demand surviving throttling, observing callback execution and
draw counts. No wall-clock sleeps are used by the new window tests.
- `corgi check -p gpui_macos --lib`: passed.
- `./script/clippy -p gpui -p gpui_macos -p input_latency_ui`: passed,
including repository hygiene checks.
- GPUI + Web Wasm check with profiler and repository CI
build-std/atomics flags: passed.
- Formatting and `git diff --check`: passed.

Corgi's parallel suite passed 436 of 437 tests but encountered the
previously observed hang-monitor shutdown channel timing failure. That
test passed in the serial Cargo suite and was not changed or disabled.

The preceding checkpoint passed Linux, Windows, macOS, and Wasm CI. CI
also passed on the current head, `3641f14ab0`. Local cross-target checks
remain constrained by missing Linux system libraries and Windows SDK
tooling on the macOS host.

## Suggested .rules additions

When manually driving platform frame requests in GPUI tests, account for
test-mode automatic draws during effect flushing. For throttle-routing
tests, configure a comfortably long throttle interval instead of relying
on wall-clock sleeps or short scheduling deadlines.

Release Notes:

- [GPUI] Added captured platform frame request timing and foreground
journal records, including sealing boundaries for completed decisions
not to render.
2026-10-01 19:52:10 +00:00
Danilo Leal 7bbd162ddf ui: Add ability to customize context menu spacing (#65044)
## Summary

This PR adds a `spacing` method to the context menu, adding the ability
to use the `ListItemSpacing` enum to customize the size of each
individual menu item.

## 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-10-01 19:37:35 +00:00
Conrad Irwin 95cd535a5f gpui: Make test-support safe to enable in every build (#65043)
Projects that depend on GPUI rebuild it, and everything above it,
whenever they switch between running their app and running their tests:
`cargo test` turns on `test-support` through dev-dependencies, and
`cargo build` doesn't. Turning `test-support` on in every build would
remove that split, but today the feature changes runtime behavior, so it
can't ship in a production binary. This PR makes it additive where it
mattered.

- **Leak detection is opt-in.** `gpui/test-support` no longer turns on
`leak-detection`, which takes the entity map's write lock on every
handle create and drop. It's now enabled by the `leak-detection` feature
(as `zed/track-project-leak` already does) or by setting
`GPUI_LEAK_DETECTION=1` when building. Without it:
  - `leak_detector_snapshot()` and `assert_no_new_leaks()` are no-ops;
- `WeakEntity::assert_released()` still panics when the entity is alive,
but can't list the live handles.
- **`util::paths::home_dir()`** returns the fixed fake path
(`/Users/zed`) only in `util`'s own tests, not whenever
`util/test-support` is on. No test outside `util` depended on the fake
path.
- **`is_test()` on GPUI contexts.** `App::is_test`, `AsyncApp::is_test`
and `BackgroundExecutor::is_test` (in gpui and scheduler) report whether
the executor is a `TestScheduler`, in every build. Code that must behave
differently under tests should use these instead of `cfg(feature =
"test-support")`, so compiling the feature into an app doesn't change
its behavior. For code with no executor, such as expensive invariant
checks, `scheduler::test_scheduler_created()` reports whether the
process has created a `TestScheduler`, which test harnesses do before
the test body runs.
- **Metal `framebuffer_only(false)`** (needed for offscreen capture) now
only applies in debug builds, so optimized builds that compile
`test-support` keep the faster presentation path.

**Open question:** CI doesn't set `GPUI_LEAK_DETECTION`, so with this
change leak checks outside gpui's own unit tests are skipped in CI. If
we go ahead, the test jobs should set it. I've left that out until we
agree on the approach.

This PR is mainly to see what CI says about crates whose tests read
`home_dir()` (`project`, `worktree`, `workspace`, …), which now see the
real home directory.

Release Notes:

- [GPUI] Made the `test-support` feature safe to enable in production
builds: leak detection is now opt-in via the `leak-detection` feature or
`GPUI_LEAK_DETECTION`, and `App::is_test` reports whether code runs
under the test scheduler
2026-10-01 16:33:50 +00:00
Finn Evers 1399a804bd Make it possible to disable language servers in the extension manifest (#65030)
## Summary

This PR enables extension authors to disable language servers from the
`extension.toml` as opposed to requiring a change to Zed's default
settings.

With this in, we no longer need to ship default enabled servers for a
given language and can instead resort to extension authors disabling
those in their extension. This gives extension authors more control and
also finally removes the need to link Zed version releases to extension
releases in cases where the extension wants to add a new language
server.

## Testing

Aside from the added tests, also ran a local build and tested this
against the kotlin extension. Worked as I would expect it to.

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

- Added the possibility for language server extensions to configure
which language servers are enabled/disabled by default. Visit
https://zed.dev/docs/extensions/languages.md#opt-in-language-servers for
more information.

---------

Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
Co-authored-by: zed-zippy[bot] <234243425+zed-zippy[bot]@users.noreply.github.com>
2026-10-01 14:59:56 +00:00
Tom Houlé 17d3378bb9 cloud_api_types: Add settings update notifications (#65040)
Add SettingsUpdated to the shared Cloud WebSocket protocol so
account-settings consumers can refetch canonical state.

Release Notes:

- N/A
2026-10-01 13:49:27 +00:00
Finn Evers 06afd454ec Remove leftover code from agent server extensions (#65031)
## Summary

This PR removes some leftover code from agent extensions that is no
longer in use.

Release Notes:

- N/A
2026-10-01 11:53:36 +00:00
Michał "DualFroz" Fox 4e76d6ef82 openai_subscribed: Keep loading slow model catalogs in the background (#64925)
## Summary

The authenticated ChatGPT model catalog (`/backend-api/codex/models`)
can take ~30s to respond for some accounts. Zed aborted the request
after 5s, fell back to the built-in model list, and account-specific
models disappeared from the model selector.

Just raising the timeout would make credential loading and sign-in block
for that long, since both await model discovery. Instead, they still
wait at most 5s, but the request keeps running in the background for up
to 60s and replaces the available models once it completes.

Closes #64173

## Testing

- Added `test_slow_model_catalog_does_not_block_initial_load`: the
initial load finishes after 5s with the built-in models, and a catalog
response arriving 30s later replaces them.
- `cargo test -p openai_subscribed`, `./script/clippy -p
openai_subscribed`
- Not tested against the live endpoint.

## 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). (N/A, no UI
changes)
- [x] Tests cover the new or changed behavior.

Release Notes:

- Fixed ChatGPT Subscription models disappearing when the model catalog
takes longer than 5 seconds to load.
2026-10-01 11:41:13 +00:00
Smit Barmase 71456c40f3 gpui: Hide disabled bindings from the which-key popup (#64935)
The which-key popup and the pending keystrokes indicator listed every
binding that starts with the pending keys, including ones disabled with
`null` or `zed::Unbind`:

```json
"cmd-k p": "editor::CopyPath",
"cmd-k p": null               // user keymap: CopyPath still showed as `p` after `cmd-k`
```

Key dispatch doesn't change. `Keymap::possible_next_bindings_for_input`
now checks what dispatch would run for each binding's full keystrokes,
and hides the binding if it isn't one of them. That applies the same
rules dispatch uses: a `null` in the `Workspace` context doesn't hide an
`Editor` binding, and a `null` in a base keymap doesn't hide your own
user bindings.

The check calls `resolve_bindings_for_input`. That's the existing body
of `bindings_for_input`, moved out so it can run over a list of bindings
the caller passes in. The popup uses the same code as dispatch, so the
two can't drift apart. It passes only the bindings that extend the typed
keys, not the whole keymap, so each check stays cheap.

Release Notes:

- Fixed the which-key popup and pending keystrokes indicator showing
keybindings that were disabled with `null` or `zed::Unbind`.
- [GPUI] Fixed `possible_bindings_for_input` returning bindings disabled
with `null` or `zed::Unbind`.
2026-10-01 10:15:21 +00:00
Viraj Bhartiya 74c134a3c1 git_ui: Don't offer git init for single-file worktrees (#64948)
## Summary

Closes #62008

When a single file is opened as the project (for example `zed -n
~/demo/plain.txt`), the worktree root is the file itself. The Git panel
still showed **Initialize Repository**, and clicking it always failed
with a raw `Not a directory (os error 20)` toast. That's because `git
init` was run with the file as its working directory.

This change:
- ignores single-file worktrees when choosing where to run `git init`.
If only single-file worktrees are open, `git: init` shows the existing
"Unable to initialize a git repository / Open a directory first" prompt
instead of the OS error.
- hides the **Initialize Repository** button in the Git panel when no
directory worktree is open. The "No Git Repositories" label stays.
- replaces the `worktrees.first().unwrap()` in `git_init` with a slice
pattern.

When directory and single-file worktrees are open together, the
directory ones can still be initialized as before.

## Screenshots

`plain.txt` opened on its own as the project, with the Git panel open.

**Before**:


![Before](https://raw.githubusercontent.com/virajbhartiya/zed/pr-assets/pr-assets/git_before.png)

**After**:


![After](https://raw.githubusercontent.com/virajbhartiya/zed/pr-assets/pr-assets/git_after.png)

## Testing

Added `test_git_init_ignores_single_file_worktrees`. It opens a single
file as the project, runs `git_init`, and checks that the prompt appears
and that no `.git` directory is created. The test fails without the fix
and passes with it. All `git_ui` tests pass.

Manual steps:
1. `mkdir ~/demo && echo hello > ~/demo/plain.txt`
2. `zed -n ~/demo/plain.txt`
3. Open the Git panel. It shows "No Git Repositories" with no
**Initialize Repository** button.
4. Run `git: init` from the command palette. It shows "Open a directory
first" instead of `Not a directory (os error 20)`.

## 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 Git panel offering to initialize a repository when a single
file is opened as the project, which always failed with "Not a
directory".
2026-10-01 06:12:24 +00:00
Dom Porada f8c2cc8440 Fix selection loss while an agent thread is loading (#64252)
## Objective

Fix the bug where selected context is lost if “Add Selection to Thread”
runs before a new agent thread finishes loading. This can leave the
message empty, particularly with slower-starting external agents such as
Claude ACP.

This addresses the [loading bug
mentioned](https://github.com/zed-industries/zed/pull/62957#issuecomment-5408347793)
in #62957.

## Solution

Preserve selected context until the destination thread’s message editor
is ready, then add it without sending the message or taking focus from
the source. This fixes the existing “Add Selection to Thread” behavior
without introducing another action.

## Testing

GPUI regression tests pass on macOS for context delivery during delayed
startup, with additional authentication, draft lifecycle, and retry
coverage.

Recommended manual check: on macOS with the default keymap, temporarily
add [this
entry](https://github.com/porada/domfiles/blob/ad86e7d0a38cd477070dec7f12a1ade4a6dce504/home/.config/zed/keymap.json#L27-L33)
to your keymap:

```json
{
  "context": "!AcpThread > (Editor && mode == full)",
  "bindings": {
    "ctrl-enter": [
      "workspace::SendKeystrokes",
      "cmd-? cmd-n cmd-? cmd->"
    ]
  }
}
```

Make sure Claude ACP is set as the default for new threads. Select code
in the editor and press `ctrl-enter`. After the thread loads, confirm
that the selected context appears in the new message and the message
remains unsent.

## 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
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

---

Release Notes:

- Fixed the bug where selected context can get lost when added before an
agent thread finishes loading.

---------

Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
2026-10-01 01:49:50 +00:00
Anthony Eid 40180d9c40 gpui_apple: Share dispatcher and Metal renderer with iOS (#64990)
Prepares GPUI's shared Apple code for the upcoming iOS backend. macOS
behavior is unchanged except for the test-only screenshot path noted
below.

## Changes

- **Dispatcher:** moves `MacDispatcher` from `gpui_macos` into
`gpui_apple` as `AppleDispatcher`, and `MacActivity` as `AppleActivity`.
`is_main_thread` uses the typed `NSThread::isMainThread_class()` instead
of a raw `msg_send`. `gpui_macos` drops its now-unused `async-task`,
`libc`, and `mach2` dependencies.
- **Metal renderer:**
- Adds a safe `MetalRenderer::from_layer(&CAMetalLayer)` for layers
owned by a platform view (UIKit creates a view's backing layer itself).
Layer setup is shared with `new` through `configure_layer`.
- Removes `gpui_apple`'s dependencies on `cocoa` and `objc` 0.2. Layer
setters the `metal` crate doesn't bind now use typed `objc2-quartz-core`
methods; drawable sizing uses `CGSize`.
- iOS always uses shared storage, since managed storage doesn't exist
there (including in the simulator on Intel hosts). The atlas parameter
is renamed `supports_shared_storage` to reflect that.
- `render_scene_to_image` (tests and benchmarks only) now uses shared
storage on Apple Silicon, matching the atlas, and synchronizes whenever
the texture is managed. Intel Macs keep managed textures.
- **Surfaces:** `gpui`'s CoreVideo surface API (`gpui::surface`,
`SurfaceSource::Surface`, `Window::paint_surface`) is now available on
iOS as well as macOS, so the shared renderer no longer needs platform
stubs.
- **Build script:** chooses the Metal SDK from `CARGO_CFG_TARGET_OS` and
`CARGO_CFG_TARGET_ENV` (`macosx`, `iphoneos`, or `iphonesimulator`), so
`x86_64-apple-ios` builds use the simulator SDK. Other targets, such as
Mac Catalyst, fail with a clear error.
- **Cargo:** `gpui_apple` builds for macOS and iOS; `dispatch2` and
`objc2-quartz-core` become workspace dependencies.

## Verification

- `clippy` is clean and tests pass for `gpui`, `gpui_apple`,
`gpui_macos`, and `gpui_platform` on macOS; `gpui_macos` builds with
`runtime_shaders`.
- `cargo clippy -p gpui -p gpui_apple` is clean for
`aarch64-apple-ios-sim` and `x86_64-apple-ios`, including the Metal
shader build with the simulator SDK.
- Not verified at runtime on iOS; nothing on iOS uses these APIs until
the iOS backend lands.

Release Notes:

- [GPUI] Improved the shared Apple Metal renderer and dispatcher so they
can be used by an iOS backend, and made CoreVideo surfaces available on
iOS
2026-09-30 22:13:38 +00:00
Diogo Azevedo bb7751c379 lmstudio: Support splash models (#64847)
## Summary

LM Studio reports Splash models with `"compatibility_type": "splash"`.
`CompatibilityType` rejects the value, `/api/v0/models` fails to parse,
and Zed lists no LM Studio models at all. This adds a `Splash` variant.

## Testing

Tested on macOS 27 with LM Studio 0.4.45, a Splash model and an MLX
model installed. **Before**: no models. **After**: both models listed.

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

- Fixed LM Studio models not appearing when a Splash model is installed.
2026-09-30 22:12:16 +00:00