Commit Graph

40711 Commits

Author SHA1 Message Date
tidely ead5672e16 agent: Fix compaction being billed as un-cached input tokens (#64938)
## Summary

Compaction currently bills the entire context window as input tokens
instead of cached input tokens, because tool definitions change during
compaction requests. Compaction here is separate from native provider
compaction.

Closes #59528

The fix is only able to be applied to providers which have a way of
disabling tools without changing the tool definitions. This notably does
not include Anthropic.

This PR adds a compaction strategy enum, which describes whether a
provider supports disabling tools without causing a cache miss. The new
variant checks whether the model supports `tool_choice: none` and
includes it in the request, while keeping the tool definitions the same.

A provider may support `tool_choice: none`, but still bust the cache, or
have models which don't support it. So we need both the enum and
`tool_choice: none` check.

## Testing

I've added tests for checking request prefix equality during compaction,
where this new fix is applied.

## 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 compaction being billed as un-cached input tokens
2026-11-04 13:36:23 +00:00
Dino ad54befbc6 workspace: Ensure panel is activate before opening dock (#66472)
## Summary

When handling a `PanelEvent::Activate` event, the dock where the panel
lives was being opened before the panel from which the event was emitted
had been activated. This ends up calling the `Panel::set_activate`
method for whatever panel was active on the dock before the event was
handled, which could lead to weird cases where the panel from which the
`PanelEvent::Activate` event was emitted ended up having its focus
stolen by another panel.

For example, if the dock's previous active panel was the terminal panel,
calling `Panel::set_activate` would start spawning a terminal session
which could finish loading after the new panel had been activated and
would end up stealing the focus back to itself.

Closes #66197

## Testing

Besides manually testing this, as shown in the screen recordings below,
a test was added to ensure this behavior was fixed when handling the
`PanelEvent::Activate` event but, in order for us to be able to assert
whether a panel's `set_active` method was called,
`TestPanel::activation_history` was introduced.

### Showcase

<details>
  <summary>Before</summary>


https://github.com/user-attachments/assets/1762362f-65fc-49ae-b7ed-9b925e179710


</details>

<details>
  <summary>After</summary>


https://github.com/user-attachments/assets/163b410e-13dd-4f07-8371-01b48f7e3076


</details>


## Self-review

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

Release Notes:

- Fixed an issue where using `pane: reveal in project panel` after
closing the last terminal tab would unexpectedly reopen the terminal
panel
2026-11-04 11:11:39 +00:00
Finn Evers 8a41a5cc04 crates_io_client: Add GitHub Trusted Publishing configuration endpoints (#66473)
As a next step, this PR adds the trusted publishing endpoints to the
crates.io API client.

Also slightly improves our pagination handling for crates.

Release Notes:

- N/A
2026-11-04 09:13:14 +00:00
Piotr Osiewicz ba36af2050 Revert "Reduce waits for navigation, suggestions, and file comparisons (#66487)" (#66517)
This reverts commit 7e7311ad20.

Defer this change until after the release so it has time to bake rather
than landing immediately before it.


## Summary

What problem does this solve, how, and why does this change matter?
Use "Closes #123" for each issue resolved.
Include artifacts produced when testing: before/after screenshots, GIFs,
videos, benchmarks.

## Testing

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

## Self-review

- [ ] 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

Co-authored-by: Amp <amp@ampcode.com>
2026-11-04 08:38:40 +00:00
morgankrey dd34370114 Add organization management permission and follow organization changes after account reloads (#66494)
This PR does two things for organizations in Zed Cloud:

1. It adds one yes/no value, `can_manage_organization`, to the
organization data that Zed and Delta receive from Cloud. It is true when
the signed-in user is an owner or admin of that organization.
2. It fixes Zed so that, when the user loses access to their selected
organization, AI features and edit predictions switch to the new
organization right away instead of after a restart.

## Why

**The new value.** Delta will show a "Manage Organization" link, which
opens the organization's page in the dashboard, only to owners and
admins of a team organization. Cloud now sends this value
([zed-industries/cloud#4489](https://github.com/zed-industries/cloud/pull/4489)).
Delta reads Cloud's account data through `cloud_api_types`, so the crate
must describe the new value first.

**The fix.** The same Cloud change makes Cloud send a "user updated"
message when someone's role changes, when they are removed from an
organization, when they accept an invitation, or when they create an
organization in the dashboard. Zed already reloads the user's
organizations when that message arrives. Before, Cloud never sent it for
these changes, so Zed did not notice them until a restart.

Now Zed notices, but one step was missing. If the user was removed from
their selected organization, the reload selects a different
organization. It did not send Zed's "organization changed" signal. That
signal is what makes Zed get a new AI token for the selected
organization. Without it, AI features and edit predictions kept using
the old organization until the token expired or Zed restarted.

## What changed

- `cloud_api_types`: `OrganizationUiPermissions` gets
`can_manage_organization`, next to the existing
`can_install_github_app`. It is true for owners and admins, and false
for billing managers and members. It is also true for the owner of a
personal organization. Zed does not read it.
- `client`: `UserStore::update_authenticated_user` now emits
`Event::OrganizationChanged` when a reload replaces the selected
organization. The first load after sign-in does not emit it, as before.

## Data impact

- The new field defaults to false when the server does not send it, so
older servers and older clients keep working.
- After a removal, Zed now requests one new AI token for the newly
selected organization. Nothing else changes when the selected
organization stays the same.

## Limits

- When "user updated" arrives, Zed also starts an AI token refresh for
the organization that is selected at that moment. If the user was just
removed from it, that one request fails and Zed logs an error. The token
refresh triggered by the new signal then succeeds.

## Testing

- `cargo test -p client --lib`: 23 passed. The new test reloads the
account twice: an unchanged reload sends no signal, and a reload after
removal sends exactly one and selects the remaining organization. It
failed before the fix.
- `./script/clippy -p client`: clean.
- `cargo test -p cloud_api_types`: 13 passed.

Release Notes:

- Fixed AI features and edit predictions continuing to use an
organization after you were removed from it.
2026-11-03 22:49:20 +00:00
morgankrey 7e7311ad20 Reduce waits for navigation, suggestions, and file comparisons (#66487)
# Objective

Reduce waiting when navigating code, loading details for code
suggestions, and comparing files. Zed currently starts some independent
file reads and requests only after the previous one finishes.

## Solution

- Load up to 16 definition or reference results at once. Keep their
original order. Repeated results for the same file share one read and
one open copy of the file.
- Request details for up to 16 code suggestions at once. Repeated item
indexes produce one request. Successful items still update if one
request fails. Keep the checks that each language server supports the
request.
- Read both sides of a file comparison together. Load up to 16
comparison pairs at once, while keeping their display order.
- Add controlled-delay tests. Saved file contents and the text ranges
returned by navigation stay the same.

## Testing

On current `main` at `8a47b35109`:

- 748 tests passed across `project`, `git_ui`, and `git_ui_core`. Four
tests were already ignored. Each suite ran one test at a time.
- Seven timing and behavior tests passed across 100 task execution
orders each: 700 runs. They check result order, repeated files and
suggestions, the request limit, errors, and cleanup.
- Required `./script/clippy` passed for all three packages, with all
targets and all features. Its dependency check also passed. The check
used no debug symbols and `profile.release.opt-level=0` to limit build
storage.
- Formatting and `git diff --check` passed.

The original checkout measured the following controlled delays. The port
to current `main` passes the same 40 ms checks:

| Operation | Before | After |
| --- | ---: | ---: |
| Go to definition across three unopened files | 120 ms | 40 ms |
| Find references across three unopened files | 120 ms | 40 ms |
| Load details for three code suggestions | 120 ms | 40 ms |
| Open one file comparison | 80 ms | 40 ms |
| Open three file comparisons | 240 ms | 40 ms |

Each independent read or request has a deliberate 40 ms delay. These
results prove reduced waiting in these cases. They do not establish a
whole-application speed improvement. Remote network performance and the
best concurrency limit for each machine remain unmeasured.

The earlier checkout also passed all five checks in a clean-built macOS
app. Those built-app checks predate this port. They are separate from
the current-main checks above.

Reviewers can run the focused tests with:

```sh
ITERATIONS=100 cargo test -p project -p git_ui -p git_ui_core --features project/test-support concurrently -- --nocapture
```

## Self-Review Checklist

- [x] Reviewed the changes for correctness and cleanup of completed or
failed work
- [x] Added tests for the changed behavior and measured waiting time
- [x] Kept result order and bounded active work

## Suggested .rules additions

Proposed text for the project test guidance, for review in a separate
rules change:

> In GPUI tests that check the release of invisible worktrees, drop the
final buffer handles inside `cx.update(...)`, then check the remaining
worktrees. `run_until_parked()` alone does not flush deferred entity
releases.

Release Notes:

- Improved responsiveness when navigating code, loading completion
details, and comparing files.
2026-11-03 22:41:41 +00:00
Young Seo Kim b7a6e5cdc0 call_hierarchy: Add gap between call hierarchy name and detail (#66144)
## Summary

Closes #64379

### 1: Space between signature and detail

Add `gap_1` in `render_match`.  

Before:
<img width="908" height="115" alt="Screenshot 2026-10-26 at 5 39 36 PM"
src="https://github.com/user-attachments/assets/f4d7d582-dd0c-459d-85c8-24744e463f10"
/>

after:
<img width="596" height="119" alt="Screenshot 2026-10-26 at 5 40 09 PM"
src="https://github.com/user-attachments/assets/9d863061-8246-40a0-b8f7-5660db91fdf6"
/>

### 2: Showing detail in tooltip + bug where tooltip would not show

needs_tooltip was computed from the width of the label text alone (e.g.
func helper), ignoring the separate detail (the package path). So even
when the rendered row (func helper path/to/go/repo/package) was wider
than the modal, the tooltip was never attached.

Fixes: 
- Width measurement: when the label doesn’t already contain the detail,
measure label + detail instead of just the label.
- Tooltip content: pass the detail into CallSignatureTooltip and render
it when the label doesn’t already contain it. Complete signature labels
(e.g. Rust’s fn helper(&self) -> i32) already include the detail, so it
isn’t appended twice.

Go example: 
<img width="1232" height="344" alt="image"
src="https://github.com/user-attachments/assets/a648054b-19eb-44d6-b465-315ccf14af44"
/>

Rust example:
<img width="733" height="142" alt="Screenshot 2026-10-26 at 11 59 51 PM"
src="https://github.com/user-attachments/assets/b854dd54-ce1f-4ef1-9849-bc6c5ae8413d"
/>

Tooltip now correctly shows on hover and includes detail while not
duplicating in the case the label already has it.


## Testing

all tests in `call_hierarchy` pass and I've added two tests:
- Added a regression test that the tooltip appends the separate detail
for name-only labels (e.g. Go package paths).
- Added a regression test that a complete signature label (e.g. Rust)
does not get its detail appended twice.

## Self-review

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

- Improved call hierarchy item details: added spacing between the name
and detail, and fixed the hover tooltip to show the full detail
(including package paths) when the row is truncated

---------

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
2026-11-03 21:30:48 +00:00
Smit Barmase ce6c5413f1 ui: Open submenus and popovers on the side that has room (#66496)
Follow up of https://github.com/zed-industries/zed/pull/66482

Wide submenus could open on top of their own menu, and popovers near the
window bottom got pushed up over their button. The side was picked while
rendering, before the menu's real size was known, so submenus guessed
200px wide and popovers never switched sides at all.

This adds `Anchored::attach(target, corner)` to GPUI, which picks the
side during layout using the real size and moves the element to the
other side of the target when it doesn't fit. Submenus and `PopoverMenu`
use it.

`DropdownMenu` now opens left-aligned under its button, and settings row
dropdowns opt into right alignment.

Left out on purpose:
- Pickers can switch between above and below as the list shrinks while
you type. Using the side that fits seems better than a stale one.

Before:
<img width="300"
src="https://github.com/user-attachments/assets/9a45aba2-6149-4835-8aa5-c2e8ae49c9b2"
/>


After:

<img width="300"
src="https://github.com/user-attachments/assets/148e205d-dd6b-4c59-9ed4-5ad37054725e"
/>

<img width="300"
src="https://github.com/user-attachments/assets/88a24ac6-e1c5-4e92-b9be-26f813b1b576"
/>


Release Notes:

- Fixed wide submenus and popovers covering the menu or button they open
from.
- [GPUI] Added `Anchored::attach` to place an element next to a target
and flip it to the other side when it doesn't fit.
2026-11-03 20:28:13 +00:00
Danilo Leal b61f33f8b6 ui: Support persistent submenu refresh (#66336)
Allow submenus to refresh their contents without closing the menu. This
supports updates to checkmarks, counts, labels, enabled states, and
removed entries.

- Retain submenu builders and use consistent confirmation behavior for
mouse and keyboard input.
- Add opt-in parent refresh, using stable submenu IDs to preserve an
open child when its trigger changes label or position.
- Repair keyboard selection after entries disappear. Close only the
child when it has no selectable entries or its trigger becomes disabled
or is removed.

## Self-review

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

Release Notes:

- N/A
2026-11-03 19:12:27 +00:00
Kirill Bulatov 57dfd54ade Fix Vim visual-block hang at wrapped EOF (#66118)
Closes https://github.com/zed-industries/zed/issues/66116

Release Notes:

- Fixed Vim visual-block hang at wrapped EOF
2026-11-03 17:49:05 +00:00
Kirill Bulatov 8a47b35109 Do not panic on wrong grammar results (#66474)
Closes https://github.com/zed-industries/zed/issues/65051

Adjust the code to not panic if an underlying grammar returns an error.
This does not fix the slim extension per se, instead just not showing
any highlights at all.

To fix Slim extension, it has to update to a never tree-sitter grammar
that contains the fix.

Release Notes:

- Fixed a panic when underlying tree-sitter highlights fail
2026-11-03 13:37:20 +00:00
Ben Brandt d36a706614 acp: Support background work in ACP v2 (#66446)
Implements the background work additions to the ACP v2 spec
([RFD](https://agentclientprotocol.com/rfds/v2/background-work)).

- **`paused` tool calls:** `paused` is now its own `ToolCallStatus`. The
tool call card shows a pause icon with no spinner. Before this, `paused`
displayed as in progress.
- **Background list:** `AcpThread::background_work()` returns the
`background` list from the agent's latest state update. If the update
leaves it out, background work is unknown rather than empty. While the
session is idle and the agent reports background work, the label next to
the message editor shows "N tasks in background".
- **Stopping one tool call:** while a tool call advertises
`capabilities.cancel` and hasn't finished, its card has a Stop button
that sends `tool_call/cancel`. `AcpThread::cancel_tool_call` refuses
locally otherwise, because Clients must not send it unadvertised.
- **Stopping an agent-run terminal:** the terminal card's Stop button
also appears for agent-run terminals that advertise cancel and haven't
exited. It sends `terminal/cancel`, and its tooltip says the output
stays available.

Release Notes:

- N/A
2026-11-03 11:36:55 +00:00
Ben Brandt 601a7cc8ac acp: Track subagent working directories (#66440)
Implements the `cwd` and `additionalDirectories` fields that the
[subagents RFD](https://agentclientprotocol.com/rfds/subagents) adds to
`subagent_update`. Zed previously dropped them.

- `SubagentAssociation` stores both fields as nullable patches: omitted
leaves a field unchanged, `null` clears it, and a value replaces it.
- A field the parent hasn't reported is inherited from the parent's own
working directories, and the two fields inherit independently. Each ACP
subagent's effective directories become its `work_dirs`. When a parent's
directories change, nested subagents are updated too. Native subagents
are unchanged.
- v1 updates now carry both fields. A relative path is ignored with a
warning, the same way v2 ignores a malformed field.
- In v1, a subagent's `terminal/create` without a `cwd` runs in the
subagent's effective `cwd`, as the RFD requires. Root sessions are
unchanged.

Release Notes:

- N/A
2026-11-03 11:36:40 +00:00
Finn Evers 4ebf3eac14 crates_io_client: Add endpoints for listing, getting, and updating crates (#66438)
As a next step, this adds endpoints to the API client for crates.io to
query a list of crates as well as patch a crate and get crate info. Also
follows the OpenAPI spec available from crates.io.

Release Notes:

- N/A
2026-11-03 11:35:14 +00:00
Finn Evers ccb25cbc63 crates_io_client: Add crates.io API client (#66437)
Adds a `crates_io_client` tooling crate for the crates.io REST API:

- `RealCratesIoClient` authenticates with an API token and follows the
crates.io data access policy (https://crates.io/data-access).
- Errors distinguish missing permissions (401/403), missing resources
(404), and other upstream failures.
- `SimulatedCratesIoClient` (behind `test-support`) serves in-memory
responses.

For testing this, this PR also adds the `GET /api/v1/site_metadata` as a
first endpoint.

Release Notes:

- N/A
2026-11-03 11:14:40 +00:00
Lukas Wirth 0294cfb58e gpui_windows: Preserve native tab advances (#66468)
## Summary

Fix zero-width tabs in GPUI text on Windows by preserving DirectWrite’s
native tab advances.

DirectWrite represents tabs as zero-glyph drawing runs. GPUI previously
skipped those runs and accumulated only glyph advances, losing tab
spacing. Query each tab’s native hit-test width and include it in the
accumulator, with an invisible space-glyph entry for caret/index
mapping.

Keep the original text, DirectWrite’s native tab-stop policy, and GPUI’s
existing logical-order glyph placement. This does not introduce a
four-space policy or attempt to unify tab stops across platforms.

## Attribution

Follow-up to #66455 by @leafyoung, which identified the zero-width tab
issue and proposed a fix. This takes a different implementation approach
using native layout advances.


Release Notes:

- [GPUI] Fixed zero-width tabs in text on Windows by preserving native
DirectWrite tab advances and caret positions.

Co-authored-by: Yang Ye <yangye@techntea.com>
2026-11-03 10:11:37 +00:00
Kirill Bulatov 8e8f54c67e Actualize all-settings.md contents (#66410)
Update stale defaults and add missing entries from default.json

Release Notes:

- N/A

---------

Co-authored-by: Finn Evers <finn@zed.dev>
2026-11-03 10:09:54 +00:00
Ahmed Tajelsir 504abf602a feat: config to toggle edit prediction button in the status bar (#66450)
## Summary

Resolves https://github.com/zed-industries/zed/discussions/26095


https://github.com/user-attachments/assets/fca26dcc-e526-4e69-b611-4b3cdcc91066

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

Release Notes:

- Added an `edit_predictions.button` setting to toggle the edit
prediction button in the status bar
2026-11-03 09:14:29 +00:00
Smit Barmase 37568ad7dc ui: Support embedded views in context menu submenus (#66461)
Needed for: https://github.com/zed-industries/zed/issues/66458

I ran into this while adding branch mode to the git panel, where I
needed a searchable picker inside a context menu submenu. This lets a
submenu host a focusable view like that.

What changed:
- While a submenu is open, the parent menu no longer pulls focus away
from content inside it, such as a search field.
- `ContextMenu::embedded_view(view)` adds a view without the menu's row
padding. A menu that only holds embedded views also drops the list
padding.
- `ContextMenu::focus_content(handle)` is optional. It sends a submenu's
focus to that handle when the submenu opens by hover, the arrow keys, or
Enter, and after a click on a part of the content that can't take focus.
Without it, menus behave as before. The git panel's base branch picker
uses this to focus its search field.

Left out on purpose:
- Accessibility roles for embedded views. I don't know much about this
area, and I think it can be skipped for now.

<img width="350"
src="https://github.com/user-attachments/assets/8436653c-12fc-48dd-953d-bf0ee88fe8bc"
/>

Release Notes:

- N/A
2026-11-03 08:44:49 +00:00
Andri Soone 504a7f2cf2 Allow mouse wheel zoom in terminals and diff views (#66296)
## Summary

I like to use the mouse wheel zoom functionality on the code to change
the size in Zed. It's very useful when switching between screens of
different sizes for example.

Unfortunately it only works when a file is opened, not in the diff view
or the terminal, and diff view is pretty much the only view I use
nowadays. So whenever I want to change the font sizes, I have to click
"Open file" to zoom there.

This has been annoying me for months so I fixed it with the help of
Claude Opus 5.5 High.

The agent diff and terminals in the agent panel still don't zoom on
purpose (decision made in #53598 apparently).

### Before


https://github.com/user-attachments/assets/eb47fae2-d82f-4bfc-adbe-3a3c7223bacb

### After


https://github.com/user-attachments/assets/84cd86ae-d589-457b-8ab0-733cfb60177f

## Testing

I tested on macOS 27.0.1 (26A434) and Zed 1.27.0 (37faef81f7).

### Reproduction steps
- Enable `mouse_wheel_zoom` in settings.
- Open any file diff and the terminal view.
- Do Cmd + Scroll (or Ctrl + Scroll on non-Macs) in the code and
terminal.
- Previously, they didn't change the font sizes. After this commit they
do.

## 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 support for mouse-wheel font zoom in diff views and terminals.

---------

Co-authored-by: dino <dinojoaocosta@gmail.com>
2026-11-02 22:26:26 +00:00
Piotr Osiewicz 00b86477f8 debugger: Allow configuring the default panel size (#66435)
Closes #66412

Add `debugger.default_width` for left/right docking and
`debugger.default_height` for bottom docking, along with controls in the
Settings Editor. Both default to 300 pixels, preserving the existing
default size.

## Testing

- All 22 debugger panel tests and 76 Settings Editor tests pass.
- Built and visually checked the Settings Editor on macOS with defaults
of 300/300 and custom values of 495/275 after relaunch.
- Rust formatting, documentation formatting, and `git diff --check`
pass.

Release Notes:

- Added support for configuring the debugger panel’s default size via
`debugger.default_width` and `debugger.default_height`.

Co-authored-by: Amp <amp@ampcode.com>
2026-11-02 17:27:20 +00:00
Michal Matczuk f4d40a2ccb git_ui: Drag files from the git panel to the terminal (#66423)
Files in the git panel's Changes list can now be dragged, just like
entries in the project panel.
Dropping a file on a terminal inserts its absolute path, and dropping it
on a pane opens it.

The rows reuse the project panel's `DraggedSelection` payload, so
existing drop targets accept them without changes.
When the dragged row is marked, the drag carries all marked files and
directories, and the preview shows the entry count.
Deleted files have no project entry and are not draggable.

<!-- Add a GIF of dragging files from the git panel to the terminal. -->

## Testing


https://github.com/user-attachments/assets/0d63ce06-057b-432b-97aa-747f6e8d09dd

## 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 support for dragging files from the git panel to the terminal
and editor panes.
2026-11-02 16:48:58 +00:00
Piotr Osiewicz f73feed9de http_client: Remove anyhow reexports (#66430)
## Summary

What problem does this solve, how, and why does this change matter?
Use "Closes #123" for each issue resolved.
Include artifacts produced when testing: before/after screenshots, GIFs,
videos, benchmarks.

## Testing

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

## Self-review

- [ ] 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] http_client no longer re-exports anyhow types.

---------

Co-authored-by: Amp <amp@ampcode.com>
2026-11-02 15:51:56 +00:00
Ben Brandt 4ec98df500 acp: Update agent-client-protocol to 5.0.0 (#66425)
Upgrades `agent-client-protocol` from 3.6.0 (schema 1.13.0) to 5.0.0
(schema 1.15.1), and brings Zed's v1 and v2 ACP clients in line with the
spec and schema changes made since then.

## SDK 5 port

- Schema types move from `schema::v1`/`schema::v2` to
`v1::schema`/`v2::schema`, builders to `Client.v1()`, and v2 handle
types to `agent_client_protocol::v2`.
- `agent_client_protocol::Error` is now the SDK's own type, not the v1
schema error. Zed uses it at the SDK boundary, and `ProtocolErrorInfo`
also recognizes it so auth-required detection keeps working.
- Foreground dispatch helpers are generic over the protocol marker, and
v2 request IDs come straight from the handles.
- SDK 5 only matches transport-closed errors that the SDK itself
produced, so peers can't forge them. A test that built one by hand now
covers only the local disconnect case. The `agent_servers` tests still
cover real transport loss.

## Spec changes

- `session/close` and `session/delete`: a `-32002` response counts as
success, on both v1 and v2.
- Permission and elicitation requests that name an unknown session get
`-32002` with `data.sessionId` instead of `-32603`. The v2 migration
guide makes this required for Clients too.
- v2 `usage_update.cost` is a patch field: omitted leaves it unchanged,
`null` clears it. A v1 update without a cost still leaves it unchanged.
- A `plan_update` whose type Zed can't render (`file`, `markdown`, or an
unknown type) still replaces the plan with that `planId`, so the old
entries stop showing.
- A diff `patch` with an unrecognized `format` renders from `changes`,
as if `patch` were omitted.
- v2 never sends an empty prompt.
- On v2, `session/cancel` no longer answers pending permission requests
locally. They stay open until the agent cancels them with
`$/cancel_request`, because requests for background work survive a
cancel. v1, including v1 subagents, keeps answering them with
`cancelled`.

## Follow-ups

These are left for separate PRs:
- Background-work UI: the `paused` status, the `background` list, and
cancel buttons for tool calls and terminals. Until then, `paused`
displays as in progress, which the spec allows.
- Subagent `cwd` and `additionalDirectories`.
- The new unstable methods: `auth/status`, `session/set_title`,
`session/status`, `session/archive`.

Release Notes:

- Improved compatibility with the latest Agent Client Protocol,
including handling of missing sessions, plan updates, diff formats, and
cancellation of permission requests.
2026-11-02 15:26:50 +00:00
buvidk1234 e38d4ec980 Fix active repository selection after removing remote worktrees (#66299)
Removing a project folder containing the active Git repository from a
remote workspace could leave the Git panel showing “No Git Repositories”
and an “Initialize Repository” button, even when other Git repositories
remained open.

Select a remaining repository when the active repository is removed.
Preserve the current selection when removing another repository, and
clear it when the last repository is removed.

Testing:
- Added a regression test covering removal of an inactive repository,
the active repository, and the last repository.
- Confirmed the regression test fails before the fix and passes
afterward on Windows.
- Passed the existing remote worktree add/remove/re-add test.

Release Notes:

- Fixed the Git panel showing “No Git Repositories” after removing the
active repository's project folder from a remote workspace while other
repositories remain open.

---------

Co-authored-by: dino <dinojoaocosta@gmail.com>
2026-11-02 14:55:47 +00:00
buvidk1234 7a349ce42d Fix remote windows merging during session restoration (#66289)
## Summary

When two windows on the same remote host open directories `[A, B]` and
`[B, C]`, restarting Zed merges them into a single workspace containing
`[A, B, C]`.

During restoration, the shared directory `B` causes the second saved
workspace to match and reuse the first restored workspace.

Disable workspace matching and explicitly open a new window for each
saved remote workspace, preserving the original directory sets `[A, B]`
and `[B, C]` in separate windows.

## Testing

- Manually verified that `[A, B]` and `[B, C]` remain in separate
windows after restarting on Windows.
- Passed 6 related regression tests on Windows/MSVC with
`--test-threads=1`.
- Formatting and whitespace checks passed.

Release Notes:

- Fixed remote workspaces sharing a directory being merged into one
workspace after restarting Zed.

---------

Co-authored-by: dino <dinojoaocosta@gmail.com>
2026-11-02 12:52:59 +00:00
Zhehoo Morgen 1e47770804 debugger: Fix CodeLLDB schema validation for build-inferred configurations (#64133)
## Summary

Fix the false CodeLLDB schema warnings reported in the linked issue.

- Allow configurations with `build` to omit `request`.
- Apply launch/attach target checks only when `request` is present,
preserving target requirements for explicit requests even when `build`
is provided.

No debugger runtime behavior changes.

Closes #64132

## Validation
I created a tiny project with debug configuration following the
guidance, and turns out the build with the fix does not report issues
any more. Thus I consider that the fix is working properly.
### Before:
Zed reports 3 issues
<img width="1022" height="720" alt="Image"
src="https://github.com/user-attachments/assets/d42e5656-0b6c-4c25-b3ce-c991305902ba"
/>

### After:
Zed reports no issues
<img width="1500" height="642" alt="Image"
src="https://github.com/user-attachments/assets/0bf4d05f-6e58-410e-8ae6-450763a2a48c"
/>

Release Notes:

- Fixed false missing-property warnings for CodeLLDB debug
configurations using build-based target inference.

---------

Co-authored-by: dino <dinojoaocosta@gmail.com>
2026-11-02 12:45:55 +00:00
Riddhi Gupta 0967dd028c Fix C++ lambda specifier highlighting (#66406)
## Summary
Closes #66169

Fixed missing syntax highlighting for C++ lambda specifiers and the
defined preprocessor operator.

- Added lambda_specifier to the C++ keyword captures so mutable and
static lambda specifiers are highlighted correctly
- Highlighted defined as a preprocessor keyword
- Highlighted the identifier inside defined(...) as a macro constant
- Add a regression test to verify that all four tokens receive the
expected captures.

## Testing

- cargo test -p languages: 109 passed, 0 failed
- cargo test -p languages
test_cpp_highlights_query_captures_lambda_and_defined_keywords: passed
- cargo fmt --all -- --check: passed.

Manually tested on Windows using a locally built Zed instance:
<img width="512" height="471" alt="zed_test"
src="https://github.com/user-attachments/assets/f4ae3b5b-5e3e-4eb9-9d96-caf8923a37a0"
/>

## 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 missing syntax highlighting for C++ lambda specifiers and the
defined preprocessor operator
2026-11-02 12:37:09 +00:00
Gaauwe Rombouts 9e23c1f43e docs: Load c15t from the hosted CDN (#66413)
Replace the vendored c15t v2 bundle with the Inth-hosted c15t v3 script.

Release Notes:

- N/A
2026-11-02 12:29:02 +00:00
Yossi Eliaz 6569db7470 remote: Accept shell-quoted ssh executable in SSH command lines (#66360)
## Why

Remote Projects accepts either a bare destination or a full `ssh ...`
command. Commands that tools print with every token shell-quoted (for
example `'ssh' '-p' '64042' 'user@127.0.0.1'`) work in a shell but Zed
rejects them with `unsupported argument`. The goal is that any valid SSH
command pasted into **Connect New Server** parses the same way whether
or not its tokens are quoted.

Closes #61101

## Summary

`SshConnectionOptions::parse_command_line` stripped a literal, unquoted
`ssh ` prefix from the raw string before tokenizing. With a quoted
`'ssh'`, the prefix didn't match, so after tokenizing `ssh` became the
hostname and the real destination was rejected as an extra argument.

This change tokenizes first and then drops a leading `ssh` token when
more tokens follow. A lone `ssh` is still treated as a hostname, as
before.

## Testing

- Added `test_parse_command_line_with_ssh_executable` covering unquoted,
single-quoted (including an identity path with spaces), and
double-quoted `ssh` executables, plus `ssh` used as a host. It fails on
`main` with `unsupported argument: "user@127.0.0.1"` and passes with
this change.
- `cargo test -p remote`: 56 passed
- `cargo fmt -p remote -- --check`
- `./script/clippy -p remote`

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

AI disclosure: this change was AI-assisted. I reviewed the diff and the
test.

Release Notes:

- Fixed Remote Projects rejecting SSH commands whose `ssh` executable is
shell-quoted.
2026-11-02 12:01:06 +00:00
Som 1e77078b3a zed: Don't let a second launch overwrite the session ID (#66364)
## Summary

Closes #65166

When launching `Zed.exe` on Windows while an instance is already open,
the second process spawns `Session::new`, which immediately writes a
fresh session ID to `kv_store`, before hitting the single-instance check
and exiting. As the issue traces, on the next cold start Zed looks up
workspaces under that orphaned ID and restores nothing.

This moves `Session::new` below the single-instance check so only the
primary instance records a session ID. Nothing before the check uses
`session` or `session_id` (both the crash handler and `app.run` come
after).

*(Note: This only fixes the secondary-launch overwrite, not the
`app_will_quit` timeout in the issue logs.)*

## Testing

No unit test added since the ordering is inline in `main()` behind the
instance mutex (happy to factor out the startup sequence for a test if
you'd like).

Tested manually on Windows 11 (debug build with
`ZED_RELEASE_CHANNEL=nightly` so the single-instance check runs,
`ZED_UPDATE_EXPLANATION` set, and a temp `--user-data-dir`):
1. Opened a workspace, launched `zed.exe` 3 more times, and checked
`kv_store.session_id` in `db/0-nightly/db.sqlite` after each.
- **Before:** Overwritten on every extra launch while the active
workspace kept the initial ID.
- **After:** Stayed `b09be725-a782-4231-9686-90b43ba1c2a1` across all 3
launches.
2. Force-killed the instance (`taskkill /F`) and relaunched: wrote a new
ID (`91a430ae-3040-472c-b8cb-e873867d0ffe`) and restored the workspace
as expected. I haven't tested an orderly quit (Ctrl+Q) and relaunch.

Not run on Linux or macOS, which go through the same check block.

Local `cargo fmt --all -- --check` and debug `cargo clippy -p zed
--all-targets -- --deny warnings` pass.

## 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). (No UI
changes.)
- [ ] Tests cover the new or changed behavior. (See Testing.)

Release Notes:

- Fixed launching Zed on Windows while it was already running causing
the previous session not to be restored.
2026-11-02 11:55:20 +00:00
yskim bc6fc11740 gpui_windows: Keep child windows above GPUI content (#66368)
## Summary

> On Windows, a WebView2 attached as a child window inside a GPUI window
isn't visible. Because of this, I can't work with Claude/Codex
artifacts.

Windows GPUI 창 안에 webview2를 자식 창으로 붙이면 안보인다. 그래서 claude/codex의 아티팩트를 조작할
수 없다.

> The cause analysis and test notes below were investigated and written
up together with an AI assistant (Claude). I checked the before/after
screens myself.

아래 원인 분석과 테스트 기록은 AI(Claude)와 함께 조사하고 정리한 내용이다. 전후 화면은 내가 직접 확인했다.

> **AI-generated (Claude):**
>
> **Cause.** `DirectComposition::new` creates the composition target
with `CreateTargetForHwnd(hwnd, true)`. Per the [`CreateTargetForHwnd`
docs](https://learn.microsoft.com/en-us/windows/win32/api/dcomp/nf-dcomp-idcompositiondevice-createtargetforhwnd),
a window is composed bottom to top as: the window's own content, the
non-topmost composition tree, child windows, the topmost composition
tree. GPUI creates its DirectComposition windows with
`WS_EX_NOREDIRECTIONBITMAP`, so everything it draws lives in the
composition tree. With `topmost = true` that tree is drawn over every
child HWND, and a WebView2 hosted with wry's `build_as_child` is covered
completely. With `false` the tree goes below child windows.
>
> The target is created only in `DirectComposition::new`, which runs at
startup and again when recovering from a lost device, so this one line
covers both paths.
>
> The workaround today is `GPUI_DISABLE_DIRECT_COMPOSITION=1`. It
switches every window to an HWND swap chain and gives up transparent,
blurred and Mica backgrounds. Related: #34374 (suggested hosting the
webview as a composition visual instead), #54433 (contained this same
one-line change inside a larger WebView feature PR, closed for scope).
#62379 keeps `true` and doesn't change this.
>
> **Trade-off.** Child HWNDs now draw above GPUI-drawn menus, popovers
and tooltips, as they did before the DirectX renderer. Zed itself
doesn't create child windows, so Zed's own rendering is unaffected.
>
> **Testing.** Windows 11 26100, NVIDIA GTX 1080, WebView2 156, debug
builds of main @ ba63a022c9.
>
> - Minimal GPUI + wry window (adapted from
[huacnlee/gpui-wry-example](https://github.com/huacnlee/gpui-wry-example)):
the WebView2 is hidden on main and visible with this change. It's also
visible on main with `GPUI_DISABLE_DIRECT_COMPOSITION=1`.
> - Zed with `background.appearance` set to `opaque`, `transparent`,
`blurred` and `mica_backdrop`, captured at two window sizes and compared
with main: no visible difference.
> - Lost device, using a real GPU timeout (`dxcap -forcetdr`): GPUI logs
`DirectX device lost detected (0x887A0007)` and then `DirectX devices
successfully recreated`, and Zed keeps rendering. Forcing only GPUI's
recovery path (without a real timeout) keeps the WebView2 visible.
> Caveat: after a real GPU timeout, a WebView2 page that isn't
repainting stays blank until its bounds change (resizing the window
brings it back), while an animating page keeps showing. With
`GPUI_DISABLE_DIRECT_COMPOSITION=1` the static page survives the
timeout; why is not yet clear.
> - [Herdr UI](https://github.com/penso/herdr-gpui) (a GPUI app, on
gpui-pre 0.3.6 = zed@bcf6582) with the same one-line patch: its browser
tab shows the page instead of a blank area (penso/herdr-gpui#826). The
original report there is on an AMD Radeon 780M.

| main (`true`) | this PR (`false`) |
| --- | --- |
| <img width="480" alt="main: WebView2 area is blank"
src="https://github.com/user-attachments/assets/45a98c8d-9ef8-46ea-8f7b-8d01547db5ee"
/> | <img width="480" alt="this PR: WebView2 is visible"
src="https://github.com/user-attachments/assets/533948d9-595b-4507-ad36-311b7c793de8"
/> |

| Herdr UI, before | Herdr UI, after |
| --- | --- |
| <img width="480" alt="Herdr UI before: browser tab is blank"
src="https://github.com/user-attachments/assets/08089173-f2be-4e05-ae2c-2a2ad270b3b2"
/> | <img width="480" alt="Herdr UI after: page is visible"
src="https://github.com/user-attachments/assets/850f394d-51a9-477c-993c-4a21cc6f90ae"
/> |

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

- [GPUI] Fixed child windows (such as a WebView2 hosted with wry) being
covered by GPUI content on Windows.

---------

Co-authored-by: yskim <20632260+yskim3271@users.noreply.github.com>
2026-11-02 09:42:01 +00:00
max1ab 1d76f828ee Fix SVG images in remote Markdown previews (#66404)
## Summary

<img width="3024" height="1898" alt="zed-svg-ssh-after"
src="https://github.com/user-attachments/assets/d35454cc-9d27-4165-900a-00990f483e4e"
/>

Closes #64517

Fixes SVG images failing to display in remote Markdown previews by
adding content-based SVG support to ImageStore and using the existing
GPUI renderer.

## Testing

- Integration tests and Clippy passed.
- Manually verified with a macOS client connected to a Linux SSH
project.
- To verify: open a remote Markdown file containing `![](image.svg)` and
confirm the SVG displays in the preview.

## 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 SVG images failing to render in Markdown previews for remote
projects.
2026-11-02 09:16:49 +00:00
M0_kii b41a8b60a4 Fix Windows shell detection for uppercase executable names (#66387)
## Summary

Zed was detecting `CMD.EXE` as PowerShell because the filename check was
case-sensitive. This fixes shell detection on Windows while keeping Unix
behavior unchanged.

## Testing

- Built and ran Zed on Windows. A task using `"shell": {"program":
"CMD.EXE"}` and `"command": "echo zed-shell-case-probe"` printed
`zed-shell-case-probe`.
- Added regression tests covering 22 Windows and Unix cases.
- `cargo fmt --all -- --check` and `./script/clippy.ps1 -p util
--locked` passed.
- `cargo test -p util --locked`: 128 unit tests and 2 doctests passed; 1
doctest ignored.
- Workspace doctests: 150 passed, 22 ignored.
- Full Windows workspace suite: 10,809 tests run, 26 skipped. Initially
10,798 passed, 3 failed, and 8 timed out. Nine setup-related cases
passed on retry after preparing the extension fixture, fetching the
remaining locked dependencies, and setting `CRITERION_HOME` to avoid
Criterion's runtime Cargo metadata lookup.

Two failures remain in unchanged tests, so the full suite is not
entirely green locally:

-
`extensions_ui::extension_suggestions::tests::test_suggestion_returns_after_failed_install`:
one pending installation where zero is expected; also fails in
isolation. This path downloads an extension through the fake HTTP
client, outside shell detection.
- `gpui_windows::window::tests::test_double_click_interval`: the test
assumes a 700 ms gap resets the click count, while this machine's
double-click interval is 760 ms.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI checklist: not applicable (no UI changes).
- [x] Tests cover the new or changed behavior.

Release Notes:

- Fixed Windows shell detection for executable names containing
uppercase letters.
2026-11-02 08:09:07 +00:00
Anthony Eid decd2399b1 gpui: Keep subscriptions for entities read by reused cached views (#65952)
When a cached view was reused, entities it read outside its recorded
scope lost their subscriptions, so notifying them no longer redrew the
window. Two cases:

- **Deferred draws.** `deferred(...)` elements are prepainted and
painted at window level after the element tree, outside the cached
view's recorded reads. Each deferred draw now records its own reads
alongside its reusable ranges and restores them when it's replayed.
- **Paint-phase reads.** A cached view recorded the entities read during
render, layout and prepaint, but not during paint, so a model read only
in a paint callback (for example a `canvas`) was dropped on reuse. Paint
reads are now added to the view's recorded set.

In both cases one set covers every phase and is restored when the
prepaint is reused, since the window only consumes it at the end of the
draw.

It also changes how scoped reads are recorded.
`detect_accessed_entities` used to clone every entity read so far in the
frame and diff against it afterwards, which cost O(frame reads) per
cached view (and now per deferred draw), and dropped entities that
something earlier in the frame had already read. Reads are now recorded
in a stack of scopes: each read goes into the innermost scope, and a
scope's reads are added to its parent when it ends. Each scope now gets
exactly its own reads, at a cost proportional to those reads.

Restoring a recorded set now skips entities released since it was
recorded. Previously the window subscribed to them again after `App` had
removed their subscriptions, leaking those entries for as long as the
cache kept being reused.

Tests cover a canvas paint read under a reused cached panel, with and
without a deferred draw around it, and with the panel itself deferred.
Each fix's case fails without it. A unit test covers nested scopes,
entities read before a scope began, and released entities. A unit test
covers nested scopes recording entities read before them.

Known limitation (unchanged): notifying a non-view entity read by a
cached view redraws the window but doesn't mark that view dirty, because
`mark_view_dirty` only resolves views through the dispatch tree.

Release Notes:

- [GPUI] Fixed entity notifications failing to redraw windows when the
entity was read by a deferred draw or a paint callback inside a reused
cached view.

---------

Co-authored-by: Lukas Wirth <lukas@zed.dev>
2026-11-02 02:57:05 +00:00
Anthony Eid 26abd1c959 gpui_platform: Extend benchmarks and add a two-revision comparison script (#66316)
Extends the GPUI benchmarks in `gpui_platform` and adds
`script/gpui-bench-compare` for quick before/after comparisons. No
runtime behavior changes. The only new GPUI APIs are
`bench-support`-only: `Window::rendered_scene()` and
`BenchWindowContext::simulate_resize`.

## Benchmarks

- **`RandomizedTree/mixed` and `CachedTree/mixed`:** the general
benchmark. Each iteration applies a fixed, seeded sequence of changes to
a freshly built tree, one per frame: restyles, resizes, structural
edits, reorders, pointer moves, scroll events, focus moves and window
resizes, while some entities animate. Every iteration does exactly the
same work.
- **Single-change groups:** element style, leaf bounds, root layout,
insert/remove, reorder and hover. They explain where a difference in the
mixed workload comes from.
- **`CachedTree`:** the same workloads with entities wrapped in
`.cached()`.
- **`TextPanels`, `Scroll` and `LayoutChurn`:** text updates and first
frames, three scrolling workloads, and entity/ID/text churn.
`LayoutChurn` also prints a heap check before timing.
- **`Primitives`:** seeded random quads, shadows, underlines, paths and
text, plus fixed overlap patterns, painted through a window and directly
on `Scene`.
- **The randomized tree fixture:** now draws paths, shadows, scroll
containers, text, hover styles and optional animations.

The benchmarks don't check their output; that's left to the fixture's
tests. On macOS and Linux, frames include GPU submission through the
headless renderer. Text benchmarks are skipped on Windows and on macOS
without `font-kit`, because neither has a real headless text system.

## Comparison script

`script/gpui-bench-compare BASE NEW` builds both revisions once and
alternates short runs of 25 core cases. It reports foreground
instructions per frame, wall time and run-to-run spread, in about 3
minutes. It also accepts `--filter`, `--full`, `--repetitions` and
`--slow`. Both revisions must include this PR.

## Validation

- A/A runs: within ±0.15% on the mixed cases and ±0.34% or better on the
core suite.
- All 193 `--test` cases pass (`SEED=0 ITERATIONS=1`,
`bench-support,font-kit,inspector`).
- The fixture's tests and `./script/clippy` pass.
- A full `cargo bench` takes about 13 minutes on an M-series Mac. I
haven't run it on Linux.

## Follow-ups

- Add hiding the root to `CachedTree/mixed` once the `.cached()`
visibility bug is fixed.
- Add text edits, keyboard input, scale changes, overlays, virtual
lists, images and drag and drop to the mixed workload.
- Add images and SVG icons to the `Primitives` random case.
- Measure GPU time, memory and upload bandwidth next to CPU
instructions.
- Cover hover and animation in the fixture's render-equivalence test.
- Bring the window-painted `Primitives` random case into the core suite
once GPU noise is separated out.

Release Notes:

- [GPUI] Added a mixed-workload benchmark, plus cached-view, hover,
text, scrolling, layout-churn and primitive benchmarks, and
`script/gpui-bench-compare` for quick instruction-count comparisons
between two revisions
2026-11-02 02:46:28 +00:00
Ben Brandt f816e1f926 gpui: Render macOS window screenshots offscreen (#66344)
`MetalRenderer::render_to_image` rendered a window's screenshot into the
layer's next drawable. Since macOS windows began presenting through a
`CAMetalDisplayLink`, the display link owns the layer's drawables, and
calling `nextDrawable` raises `CAMetalLayerInvalidOperation:
-nextDrawable should not be called when using CAMetalDisplayLink`, which
aborts the process. Every caller of `Window::render_to_image` on a live
macOS window crashed on its first screenshot, which broke automated UI
testing in apps built on GPUI.

This renders the screenshot into a texture of its own instead. It moves
the offscreen path that `render_scene_to_image` already used for
headless rendering into a shared `render_offscreen` helper, including
the blit that managed textures need on Intel Macs, and has
`render_to_image` call it at the layer's drawable size. Nothing is
presented, so taking a screenshot no longer touches what the display
link draws.

Tested by taking automation screenshots of a running GPUI app on macOS,
which aborted before this change and succeed with it.

Release Notes:

- [GPUI] Fixed a crash when capturing a macOS window with
`Window::render_to_image` while a display link drives its layer

---------

Co-authored-by: Anthony Eid <hello@anthonyeid.me>
2026-11-01 22:52:58 +00:00
Lukas Wirth c408f8efc4 gpui: Improve borrow and window error diagnostics (#66358)
## Summary

- Preserve the attempted borrow location and existing App borrow origin
in fallible borrow errors, using a compact anyhow result without a
redundant standard borrow error.
- Propagate caller locations through window-update wrappers and share
diagnostic formatting between returned errors and panics.
- Add operation and window context to all 34 log_err sites in window.rs.
Context formatting runs only on failure.

## Validation

- cargo nextest run -p gpui app::test:: — all 5 existing tests passed.
- Formatting checks passed for the changed Rust files.
- No test changes are included in this PR.
- The original Delta reentrancy trigger was not reproduced; this
improves diagnostics, not the underlying reentrancy behavior.

Release Notes:

- [GPUI] Improved App borrow and window-operation errors with caller
locations, borrow origins, and operation context.
2026-11-01 20:27:09 +00:00
Chris Stone d94f32a1d9 Terminal header corners (#66367)
## Summary

The terminal tool header in the agent panel paints its own background,
but the card it sits in clips its contents to a rectangle, so the
header's square corners poke out past the card's rounded corners. The
command block inside the header also painted its own copy of the header
background with square corners, which showed at the bottom of collapsed
cards.

This change rounds the header's top corners for standalone terminal
cards, and its bottom corners too when nothing is rendered below it
(i.e. the card is collapsed and not awaiting confirmation). The command
block no longer paints its own background inside the card, since the
header already paints the same color behind it. When the card is
expanded or showing a confirmation prompt, the header's bottom corners
stay square so it joins the content below it.

Follow-up to #64328, which fixed the same issue for the terminal
output's bottom corners.

The issue is barely visible in the bundled themes, because their
`element.background` (which the header is based on) is the same or
nearly the same as `panel.background`:

**Stock One Dark:** the corner mismatch is nearly invisible.
<img width="603" height="208" alt="Terminal tool card in stock One Dark"
src="https://github.com/user-attachments/assets/1392f06e-3d31-4906-8e32-13b482a1e5c3"
/>

It's clearly visible in themes where those colors differ, which is
common in theme extensions. To make it obvious, give the header a
contrasting background with a theme override:

```json
"theme_overrides": {
  "One Dark": { "element.background": "#ff5555" }
}
```

### Before

**With the override:** the header's square corners show past the card's
rounded corners.
<img width="600" height="202" alt="Terminal tool card with a red header
background, square corners showing past the card"
src="https://github.com/user-attachments/assets/8d4e0701-d3cc-4bd2-9046-bab139a1459a"
/>

**Collapsed card:** the bottom corners are square too.
<img width="605" height="122" alt="Collapsed terminal tool card with
square corners showing past the card"
src="https://github.com/user-attachments/assets/4c186b96-c899-4cba-bf79-898015d7cb5a"
/>


### After

**Same card with the fix:** the header follows the card's rounded
corners.
<img width="640" height="202" alt="Terminal tool card with a red header
background, corners matching the card"
src="https://github.com/user-attachments/assets/7dbaffb1-668a-4e88-a81e-40952f8174f4"
/>

**Collapsed card with the fix:** all four corners are rounded.
<img width="641" height="122" alt="Collapsed terminal tool card with all
four corners rounded"
src="https://github.com/user-attachments/assets/33f19131-3e06-4d6f-a9ea-7c96f41e512e"
/>

## Testing

Tested manually on Windows.

With the theme override above, run a terminal command in the agent panel
and check:

- Collapsed card: all four header corners are rounded and match the
card.
- Expanded card: top corners are rounded; bottom corners are square
where the header meets the output.
- Card awaiting confirmation: top corners are rounded; bottom corners
are square.

## 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. (Not added: this is a
purely visual styling change, verified manually with the screenshots
above.)

Release Notes:

- Fixed square corners showing on terminal tool cards in the agent panel
with themes whose element background differs from the panel background.
2026-11-01 07:50:34 +00:00
Om Chillure a4b39c38e0 markdown_preview: Stop rounding image corners (#65474)
## Summary

Closes #65311

Images in the Markdown preview were always drawn with rounded corners,
because `MarkdownElement` applied `.rounded_md()` to every image. Badges
such as shields.io looked different from how GitHub and browsers render
them.

The rounding was added on purpose for images in the agent panel
(#56427), so this PR doesn't remove it everywhere. It adds a
`rounded_images` field to `MarkdownStyle`, which defaults to `true`. The
preview style overrides set it to `false`. Other uses of
`MarkdownStyle`, including the agent panel, look the same as before.

If reviewer prefer that images stay square everywhere, the alternative
is to drop the `.rounded_md()` call and the new field. That's simpler
but also changes the agent panel. I can change current apporach to this
if needed.


### Before
<img width="1920" height="1080" alt="Screenshot from 2026-10-11
17-55-18"
src="https://github.com/user-attachments/assets/6e96bfd2-b516-4c8e-815e-fb49b7a394af"
/>

### After
<img width="1920" height="1080" alt="image"
src="https://github.com/user-attachments/assets/07d7ca1b-69ff-4a5d-a66b-1a2026c6e561"
/>


## Testing

- `cargo check -p markdown -p markdown_preview` passes.
- `cargo test -p markdown`: all 186 existing tests pass. No new test was
added because this is a visual change.


To manual test, create a Markdown file containing:

![license](https://img.shields.io/badge/license-MIT-blue?style=flat-square)

Open the Markdown preview. The badge should have square corners. Then
paste an image into the agent panel and check that it's still rounded
there.


## 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 images in the Markdown preview being rendered with rounded
corners.
2026-11-01 00:33:56 +00:00
Kunall Banerjee ba63a022c9 recent_projects: Show remote picker scrollbar (#63909)
Make overflowing remote lists discoverable and size the scrollbar
accurately from the first layout, matching the Recent Projects picker.

Closes #63856.

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [ ] 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 (the
impact on [large remote
lists](https://github.com/zed-industries/zed/blob/84d9a73c1957a8181c8ae017e703d1d56a18426a/crates/gpui/src/elements/list.rs#L196-L201)
was not tested)

---

Release Notes:

- Fixed a missing scrollbar in the Open Remote picker, making additional
remote servers easier to discover
2026-10-31 04:59:47 +00:00
A Badly Drawn Wobbler 14b7b0ef37 gpui_linux: Replace kde-blur protocol with ext-background-effect protocol (#53746)
Replaces the `kde-blur` protocol (which is now deprecated and being
[removed from
kde](https://invent.kde.org/plasma/kwin/-/commit/7f9e0aa1cd2c2ab4fea1097800893b6f780089eb))
with the new
[ext-background-effect](https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/staging/ext-background-effect/ext-background-effect-v1.xml)
protocol (which is supported by niri, new KDE releases, and more
compositors over time)

# Current questions
- Currently, the PR completely removes the old KDE blur and replaces it.
Should we keep the old kde-blur implementation and use it as a fallback?
- Since the protocol technically supports adding new capabilities and
types of background effects, should zed track if the compositor supports
the protocol, and only try blurring then? The protocol seems to imply
that you can still use
[set_blur_region](https://wayland.app/protocols/ext-background-effect-v1#ext_background_effect_surface_v1:request:set_blur_region),
but the compositor will do nothing
- Since the protocol is generic, should it be checked when resizing to
see if the window should be blurred before updating the blur region?
Currently it doesn't do it, since it's implied (a note has been added to
the code)
- I wonder if this could be expanded to where popovers (such as
diagnostic popovers) can become their own wayland surfaces, and thus
also be blurred (so a transparent warning popover/diagnostic can
properly blur the text underneath for readability, rather than it having
to be opaque). That sounds like a major refactor/out of scope though,
not even sure if it's possible (I'd love to work on it though, if the
team has any pointers on how to get started)

I'm keeping this PR as a draft until those points are figured
out/commented on

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)
- [/] Tests cover the new/changed behavior
- I do not know how to test this, and the old implementation wasn't
tested
- [/] Performance impact has been considered and is acceptable
	- I don't see how this would affect performance

Release Notes:

- [GPUI] wayland: deprecate kde-blur protocol, implement and default to
ext-background-effect

---------

Co-authored-by: Alexander Bachmann <a.t.bachmann@gmail.com>
Co-authored-by: Tom Houlé <tom@tomhoule.com>
2026-10-30 15:09:02 +00:00
allison 70b1b91b73 search: Fix project search focus/action context (#50882)
Closes #45114 

Changed the Project Search buttons to use local click handlers instead
of dispatching window actions and cleaned up some logic and duplicated
code.


https://github.com/user-attachments/assets/c924dc85-e6d1-4d9a-a331-78b86206aace

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

Release Notes:

- Fixed Project Search buttons affecting the wrong pane when clicked in
an unfocused split

---------

Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
Co-authored-by: MrSubidubi <finn@zed.dev>
2026-10-30 12:27:35 +00:00
Smit Barmase 422b53cff8 git_ui: Keep the open commit highlighted in the History tab (#66226)
Closes #65488
Supersedes #65772
Supersedes #65774

After opening a commit from the History tab and clicking into the commit
view, its row had no marker. History rows only showed the focus border,
and only while the panel had focus during keyboard navigation.

History now highlights the commit open in the active tab, matched by
sha, and clears it when another tab is active. The keyboard cursor
follows the open commit and no longer starts on HEAD. The focus border
now only shows after keyboard input instead of flashing on click.


https://github.com/user-attachments/assets/4be21893-9055-4a32-a58c-a9eeaa08fbc7

Release Notes:

- Fixed the History tab in the git panel losing the highlight on the
open commit when you click into the commit view.
2026-10-30 10:34:45 +00:00
Leon Lux 915290734a Support creating Pull Requests on Codeberg via Zed UI (#66182)
## Summary
Currently, trying to create a pr via zeds ui fails with the error:
```
Unable to construct pull request URL
```

This PR fixes this by providing an implementation of
`GitHostingProvider::build_create_pull_request_url` to the Forgejo git
hosting provider.

## Testing
Tested by adding a unit test that verifies the generated pull request
url matches the expected structure. Verified that it works end-to-end by
creating a PR on codeberg via a build of this pr.

## Self-review

- [X] I've reviewed my diff for quality, security, reliability, and
performance.
- [ ] ~~UI changes follow the checklist~~ (N/A, no UI changes)
- [X] Tests cover the new or changed behavior.

Release Notes:
- Fixed creating pull requests from Zed for Forgejo remotes (including
Codeberg).
2026-10-30 09:59:44 +00:00
Albert Bogusz bfd1dd484b git_ui: Fix vertically misaligned author cells in Git graph (#66187)
## Summary

Ever since avatars were added to the author column in #59839, the avatar
and name have sat lower than the other columns. The author cell was
forced to the full row height, making it taller than its neighbours. It
now sizes to its content.

As the cell no longer has a fixed height, the author label is always
rendered (even when empty) so the cell's height and the avatar's
position don't shift when commit data finishes loading.

## Testing

| Before | After |
|--------|-------|
| <img width="381" height="304"
src="https://github.com/user-attachments/assets/b5c90dcf-4076-4d85-9d20-53cba25e0e11"
/> | <img width="381" height="304"
src="https://github.com/user-attachments/assets/bdc0df20-0dc3-4a03-a687-dcb475f8a978"
/> |

## 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 author names and avatars being vertically misaligned in the Git
graph.
2026-10-30 09:58:16 +00:00
Anthony Eid 99e70ee4a0 gpui: Time animations with the executor clock (#66317)
Animations and springs measured elapsed time with `Instant::now()`,
which tests can't control, so tests that advance the fake clock between
frames stepped them by however much real time passed. This made
`test_spring_animation_preserves_velocity_when_retargeted` fail
intermittently. They now use the executor's clock, as synced animations
already do: the platform's monotonic clock in production, and the test
clock in tests.

Release Notes:

- [GPUI] Fixed animations measuring time with the wall clock instead of
the executor's clock, which made animation tests nondeterministic.
2026-10-30 06:51:23 +00:00
Anthony Eid 8fa085e397 gpui: Repaint cached views when inherited opacity changes (#65951)
A clean `cached()` view under a parent whose opacity changes kept
painting with the old opacity, because the cached view's reuse key
didn't include inherited opacity.

This adds inherited opacity to the reuse key, and passes a div's opacity
down during prepaint as well as paint, since the reuse decision happens
in prepaint. Children's prepaint now sees the inherited opacity; the
cache key is the only thing that reads it there.

Prepaint can only predict the opacity paint will apply: an ancestor's
hover or drag-over style depends on the frame's hit test, which isn't
known until paint. So the key records the opacity that was actually
painted, and if reused output ends up painted under a different opacity,
the view redraws on the next frame. Opacities are compared by bits, so a
NaN opacity doesn't disable the cache.

Tests cover a wrapper's opacity changing (fails on main), hover opacity
on mouse enter and leave, and a hover that starts without a mouse move
because the wrapper grew under the pointer.

While an ancestor's opacity animates, cached views under it re-render
every frame. Applying the alpha at replay instead could avoid that and
is left as a follow-up.

Release Notes:

- [GPUI] Fixed cached views retaining stale paint opacity when an
ancestor's opacity changes.
2026-10-30 05:27:01 +00:00
Marshall Bowers d401423073 collab: Remove extension endpoints served by Cloud (#66308)
<!-- Your description goes here. -->

---

> [!NOTE]
> Everything below this line is commentary from Claude.

This PR removes the extension endpoints from Collab that are fully
handled by Cloud's `extension_api`:

- `GET /extensions/updates`
- `GET /extensions/:extension_id`

It also removes the database queries that only those endpoints used
(`get_extensions_by_ids`, `get_extension_versions`,
`get_extensions_where`), plus the already-unused
`get_extension_version`.

The download endpoints (`/extensions/:extension_id/download` and
`/extensions/:extension_id/:version/download`) remain, since Cloud
proxies download requests to Collab. The periodic blob store sync also
remains, as Cloud does not sync extensions from the blob store.

The extension DB test now exercises `get_extension` (used by the
download endpoint) instead of the removed `get_extensions_by_ids`, so
the version constraint filtering is still covered.

Release Notes:

- N/A

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 23:05:59 +00:00
runsonmypc e20d19d32f gpui_wgpu: Configure the window surface once at creation (#66002)
## Summary

When the first window is created, adapter selection tests each adapter
by configuring the surface at 64x64 with the first format and alpha mode
the surface reports. The renderer then configures the same surface again
at the window's size with its preferred format. On the NVIDIA
proprietary driver on X11, each swapchain creation waits on the X server
for several refreshes, so the second configure adds a few hundred ms
before the first frame.

This makes the adapter test use the configuration the renderer will use
(same format, alpha mode, present mode and size), and skips the
renderer's own configure when the context was just created against that
surface. Every candidate adapter is still tested by configuring the
surface, so hybrid-GPU selection works as before. Windows that reuse an
existing context, device recovery with an existing context, and the web
path still configure in the renderer.

Time from exec to first presented frame, `gpui` `hello_world` example
(1000x1000 window), release-fast, 22 alternating runs each:

| | min | median | max |
|---|---|---|---|
| main | 720 ms | 946 ms | 1053 ms |
| this PR | 403 ms | 528 ms | 701 ms |

The removed configure took 218-534 ms (median 316 ms) in those runs.
Machine: Pop!_OS 24.04, GNOME on Xorg, RTX 4070 with driver 580.159.03,
4K and 1440p monitors. Other work was running on the machine at the
time, so absolute numbers are noisy, but every patched run was faster
than every unpatched one. On the same machine's integrated AMD GPU (Mesa
RADV, `ZED_DEVICE_ID=0x164e`) each configure takes about 2-5 ms, so
there is no measurable change.

## Testing

- Ran `hello_world` on X11 with the NVIDIA GPU and the integrated AMD
GPU: the first frame renders correctly, and window captures after
resizing are pixel-identical to main's on both GPUs. Resizing and
maximizing reach `update_drawable_size` with the new sizes, as on main.
- Logged the configure calls made while creating the window: main makes
two (64x64 `Bgra8UnormSrgb` in adapter selection, then 1000x1000
`Bgra8Unorm` in the renderer), this PR one (1000x1000 `Bgra8Unorm`). The
startup resize and transparency updates don't reconfigure on either
branch, because the size and alpha mode are unchanged.
- `cargo test -p gpui_wgpu`, `./script/clippy -p gpui_wgpu`, `cargo
fmt`.
- Not tested: Wayland, multiple windows, device recovery.

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

Release Notes:

- Improved window startup time on Linux with NVIDIA GPUs.
- [GPUI] Improved window startup time on Linux with NVIDIA GPUs.
2026-10-29 20:37:34 +00:00