mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-27 11:02:33 +01:00
d46358213a6db8b2b45ea37f4cac8aae9e5d01ee
40981 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
d46358213a |
linux_sandbox: Fix network checks in sandbox (#67370)
Tweaks the unused linux_sandbox sandbox so network availability checks work. Release Notes: - N/A |
||
|
|
d9089f4eac |
ui: Re-render spinner labels only as often as their glyph changes (#67261)
## Summary `SpinnerLabel` and `LoadingLabel` request a frame on every display refresh, though their text changes only 4–17.5 times a second. Each frame re-renders every view above the label: in the agent panel, `ThreadView`, `ConversationView`, `AgentPanel`, and `Workspace`. So while a turn waits on the model, a confirmation, or a subagent, Zed renders at the display's refresh rate, or at 30 fps when the window doesn't have focus. Both labels now render only when their text changes: - `Animation::with_steps`, like CSS `steps()`, advances an animation in equal steps and re-renders it when the next step starts. It counts steps in integers on the animation's clock, so each step renders on time however long Zed has run, and synced animations step, and render, together. - `SpinnerLabel` takes one step per glyph on the shared clock, so all spinners render together. `LoadingLabel` takes four steps a second after its reveal. CPU time of the Zed process while a thread waits, in ms per second, main → this PR: | State | 60 Hz | 120 Hz | 144 Hz | 240 Hz | Unfocused, 120 Hz | |---|---|---|---|---|---| | Waiting for the model | 168 → 48 | 272 → 48 | 319 → 48 | 417 → 49 | 92 → 43 | | Awaiting confirmation | 189 → 87 | 312 → 86 | 337 → 88 | 470 → 88 | 98 → 83 | | One subagent | 177 → 52 | 304 → 52 | 320 → 52 | 437 → 52 | 93 → 45 | | Three subagents | 187 → 56 | 327 → 56 | 318 → 55 | 467 → 57 | 97 → 50 | | Streaming a response | 281 → 266 | 370 → 333 | 379 → 324 | 543 → 335 | 147 → 155 | While waiting, Zed draws 13 frames a second, 14 to 15 with subagents and 24 awaiting confirmation, instead of one per refresh, and GNOME Shell's CPU time falls from 30–45 to 6–13 ms per second. Unfocused windows, which GPUI already caps at 30 fps, draw 11–21. A hidden window draws nothing either way. Measured on a release build with a project and a Rust file open, on a headless GNOME Shell 50 whose virtual monitor refreshes at each rate, with an RTX 4080 and a Ryzen 7 9800X3D. A mock OpenAI-compatible provider holds the thread in each state. CPU time is from `/proc`, all threads, over 6-second windows; medians of 4 runs per variant, alternating variants (3 unfocused, at 120 Hz). A run counts only if everything else on the machine used under 180 ms/s of CPU, because other work changes Zed's own CPU time. [Harness](https://github.com/ptweezy/zed/tree/bench-spinner-real/bench/spinner_real) and [records](https://github.com/ptweezy/zed/tree/bench-spinner-real/bench/spinner_real/results/2026-11-22). On `windows-latest` (4 vCPUs, no GPU, so Zed renders in software), the same harness measured 845 → 188 ms/s while waiting for the model, 939 → 353 awaiting confirmation, 894 → 203 with three subagents, and 1,066 → 847 while streaming. `macos-latest` VMs stopped delivering frames whenever Zed paused its display link, including for the cursor blink, so they're left out. ## Testing - `test_spinner_renders_only_as_often_as_its_glyph_changes` steps a window with a `SpinnerLabel` at 100 Hz for one second and checks that it renders 10 times, once per glyph change. It renders 100 times without steps. - `test_synced_steps_render_once_each` mounts a synced animation of seven steps a second, 30 ms into a step and 300 days into the shared clock, and checks that it renders once as each step starts. It doesn't pass when steps are counted in floats or a step's length is rounded to nanoseconds. - `test_steps_finish_and_repeat_on_time` checks that a one-shot animation of four steps ends on time, that its cap doesn't delay the animation chained after it, and that a repeating one wraps. - `test_sooner_step_replaces_the_pending_one` switches a repeating animation from one step a second to ten and checks that the next step renders on time, and once. - All four pass with `SEED` 0–99. - `cargo test -p gpui -p ui -p agent_ui -p which_key` passes. - `./script/clippy -p gpui -p ui` passes. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - Improved CPU usage while the agent waits on a model response, a tool confirmation, or a subagent - [GPUI] Added `Animation::with_steps`, which advances an animation in equal steps and re-renders it only when it steps |
||
|
|
c31063a050 |
rust: Adopt trim_{prefix,suffix} (#67367)
## Summary
Remove verbose syntax pattern by adopting `trim_{prefix,suffix}`, which
sometimes saves clones or other work.
`value.strip_suffix(pattern).unwrap(value)` ->
`value.trim_suffix(pattern)`
`value.strip_prefix(pattern).unwrap(value)` ->
`value.trim_prefix(pattern)`
I also found a common pattern of `.starts_with` before `strip_prefix`,
which the latter already checks for implicitly.
## Testing
Tests pass, no behavior changes.
## Self-review
- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.
Release Notes:
- N/A
- [GPUI] N/A
|
||
|
|
10113795df |
anthropic: Support per-message reasoning effort (#67365)
Changing Claude’s reasoning effort mid-conversation used to change the top-level effort for the entire request. That can invalidate cached prompt prefixes and make previously signed thinking blocks unusable on models that bind them to the request prefix. On supported Anthropic routes, this keeps the original top-level effort stable and sends later changes as inline system updates. The new effort applies to subsequent turns without rewriting earlier ones, so Claude can reuse the cached prefix and preserve prior thinking blocks when the rest of the prefix is unchanged. Release Notes: - N/A |
||
|
|
de3827f6e9 |
Keep local settings of remote worktrees on project updates (#67269)
Closes https://github.com/zed-industries/zed/issues/62911 Follow-up to https://github.com/zed-industries/zed/pull/44913 Release Notes: - Fixed indentation settings in .editorconfig stopping to work after doing cmd/ctrl-hover in the buffer |
||
|
|
42033befe6 |
Do not notify settings observers when removing a worktree without settings (#67268)
Closes https://github.com/zed-industries/zed/issues/67182 Follow-up to https://github.com/zed-industries/zed/pull/44913 Release Notes: - Fixed overly spammy notifications when removing worktrees without settings |
||
|
|
5dea5cab32 |
compliance: Explicity install default provider (#67360)
With the introduction of the crates IO client into the xtask dependency graph, the crypto provider for the compliance client broke because we now pulled in both ring and awc_lc_rs. Thus, fixing this here by picking an explicit default. Fixing this through dependencies would be very brittle and prone to break again, as well as this being more explcit at what it does. Thus, went with this path. Release Notes: - N/A |
||
|
|
0ad670e6ea |
ci: Use edge snapcraft version (#67308)
## Summary #16957 was merged without pinning the edge version of snapcraft. The old patchelf in the current stable version of snapcraft leaves staged libraries' PT_NOTE segments stale when it relocates note sections (https://github.com/canonical/snapcraft/issues/6410). As a result, Mesa's build-id lookup walks those segments and segfaults inside vkCreateDevice, making the published amd64 snap exit silently on some machines, as reported in #67283. I knew this in https://github.com/zed-industries/zed/pull/66941#issuecomment-6947574551 , but did not update the CI accordingly before the PR was merged. Closes #67283 ## Testing To build locally: ``` sudo apt update && sudo apt install -y gettext-base # envsubst, used by script/snap-build sudo snap install lxd && sudo lxd init --auto sudo adduser "$USER" lxd # logout might be needed # edge risk contains fix for snapcraft#6410 (bundled patchelf 0.19.3) sudo snap install snapcraft --classic --channel=latest/edge ./script/snap-build 1.29.2 # any version string; produces zed_1.29.2_amd64.snap sudo snap install --dangerous ./zed_1.29.2_amd64.snap ``` ## 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 builds of snap package |
||
|
|
3a5180211a |
Bump Rust to version 1.100 (#67115)
## Summary Bumps Rust to version 1.100 which has some fantastic goodies. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - N/A - [GPUI] N/A |
||
|
|
f00a94318c |
gpui_wgpu: Fall back to textures on GL without shader storage (#67323)
## Summary GPUI binds instance storage buffers in both the vertex and fragment shader stages. On native OpenGL adapters that lack storage support in either stage, wgpu rejects the bind group layout and the window opens blank. Use GPUI’s existing texture-backed instance data path when a native OpenGL adapter lacks `VERTEX_STORAGE` or `FRAGMENT_STORAGE`. Closes #65765 ## Testing - All 42 `gpui_wgpu` unit tests passed on macOS. Formatting and Clippy checks passed. - In a hardware smoke test, the same renderer change presented 1080p frames and redrew after input on a device with a Mali-G52 running OpenGL ES 3.2. To reproduce, open a GPUI window on a native OpenGL adapter that reports either storage capability as missing and verify that the scene renders without pipeline validation errors. Release Notes: - [GPUI] Fixed blank windows on native OpenGL adapters that lack vertex or fragment shader storage support. --------- Co-authored-by: John Tur <john-tur@outlook.com> |
||
|
|
c671f77ffd |
sum_tree: Insert keyed items in place (#67332)
## Summary `SumTree::edit` and `insert_or_replace` built a new tree on every call. They sliced off the items before the first key, appended the new items, then appended the rest. A slice re-appends whole subtrees one sibling at a time, on every level, and clones their summaries. When an edit only inserts and its keys are distinct, it now descends to the leaves that take the items and changes them in place, splitting the nodes that overflow. It clones a node only if another tree shares it. `insert_or_replace` takes the same path. Edits that remove items or repeat a key still slice. The worktree scanner calls `edit` twice per directory while it holds `BackgroundScanner::state`. Initial scan with `Worktree::local` and `RealFs` in a headless app, one scan per process, warm file cache, Ryzen 7 9800X3D (16 threads), median of 41 alternating runs per variant (31 for Firefox): | Tree | Entries | Before | After | |---|---|---|---| | Linux checkout | 120,916 | 263.0 ms | 150.4 ms | | Firefox checkout | 532,906 | 1.78 s | 871.3 ms | | Zed checkout | 5,339 | 31.7 ms | 21.5 ms | After was faster in every run. CPU time fell 12–13% on Linux and Firefox and stayed within 2% on Zed. Pinned to 4 cores, the Linux scan takes 227.1 ms instead of 311.7 ms. Both versions found the same entries in every run, and peak memory didn't grow. GitHub-hosted runners (4 vCPUs, 3 on macOS), shallow clones, same harness, before → after, with the runs where after was faster in parentheses: | Tree | `ubuntu-latest` | `ubuntu-24.04-arm` | `macos-latest` | `windows-latest` | |---|---|---|---|---| | Linux | 810.5 → 698.3 ms (30/31) | 1.04 → 0.75 s (31/31) | 1.43 → 1.24 s (46/51) | 7.64 → 7.48 s (21/21) | | Firefox | 5.18 → 4.22 s (15/15) | 7.03 → 4.58 s (15/15) | 16.02 → 13.92 s (16/21) | 34.88 → 33.47 s (9/9) | | Zed | 75.4 → 64.9 ms (30/31) | 92.3 → 65.5 ms (31/31) | 85.5 → 74.2 ms (41/51) | 587.4 → 577.0 ms (16/21) | The scanner starts one worker per CPU, so the runners have less lock contention to remove. On `windows-latest`, file system calls dominate. Time per inserted item, before → after. Release build pinned to one core, median of 7 alternating rounds: | Call | Time per item | |---|---| | `edit`, 19 adjacent items into a tree of 120,000 | 340 → 41 ns | | `edit`, 1 item into 100,000 | 5,809 → 314 ns | | `edit`, 1 item at the end | 3,152 → 259 ns | | `insert_or_replace` into 1,000,000 | 5,148 → 541 ns | | `edit`, 100,000 scattered items into 1,000,000 | 598 → 181 ns | | `edit`, 1,000,000 items into an empty tree | 17.3 → 16.0 ns | When a snapshot shares every node, so each insert clones the nodes on its path, the first four take 63, 793, 733, and 1,128 ns. On the four runners, x86_64 and aarch64, the first four take 80–94% less time and the scattered batch 58–73% less. The load into an empty tree ranges from 7% faster to 13% slower (`windows-latest`). [Harness](https://github.com/ptweezy/zed/tree/bench-sum-tree-insert-in-place/bench/sum_tree_insert_bench). ## Testing - `test_inserts_in_place` is new. It applies random batches of inserts, single `insert_or_replace` calls, and removals to a tree and a `BTreeSet`. It checks the items, the replaced items, every node's summary and height, and that earlier clones of the tree don't change. Without removals, it also checks that no node underflows. - It fails for each of 19 mutations of the new code, such as a stale summary, a wrong bound for a child, a split inserted out of order, or a shared node changed without a clone. - `test_edit` now repeats a key whose two items are in different leaves. It fails if that batch takes the in-place path. - `cargo test -p sum_tree -p text -p multi_buffer -p language -p git -p editor`, `cargo test -p worktree --features test-support`, and `cargo test -p project --features test-support --test integration` pass. - The randomized `text` and `worktree` tests also pass with `ITERATIONS=300` and `ITERATIONS=100`. - `./script/clippy -p sum_tree` passes. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - Improved how fast large projects are scanned when they are opened |
||
|
|
ac22c37e86 |
agent_servers: Retry ACP initialization with v1 after a v2 decode failure (#67357)
Google Antigravity ACP 1.5.2 responds to a v2 `initialize` request with `protocolVersion: 2` but uses the v1 fields `agentInfo` and `agentCapabilities`. It returns a usable v1 response when asked for v1 directly. If Zed receives a matching JSON-RPC success response but cannot decode the initialization result, close the first connection and retry once on a fresh v1 process. This applies to any agent, without checking for Antigravity-specific fields. An error returned by the agent, an invalid envelope, or an exit without a reply does not by itself trigger the new retry. If v1 also fails, preserve both diagnostics. Release Notes: - N/A |
||
|
|
d5b6a7f1ec |
git_ui: Match git graph selection colors (#67320)
## Summary Clicking a commit's text focuses the table, but the Refs and Graph columns check only the graph's focus handle, so they paint the unfocused selection color. They now check both handles, as the table rows do. Closes #65249 ## Testing - To reproduce, open the Git Graph and click a commit's description. - Tested on Linux. The whole row uses the focused color after clicking the Description, Date, or Graph column, and the unfocused color after focusing search. - `test_selected_row_color_matches_across_columns` fails without this change. - `cargo test -p git_ui --lib` and `./script/clippy -p git_ui` pass. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - Fixed Git Graph selection colors not matching across columns https://github.com/user-attachments/assets/96d64a5b-7c0b-4121-a2b0-c08ffe28505c |
||
|
|
78edf1df97 |
agent_ui: Search threads by their displayed title (#67317)
## Summary Thread history search matches `ThreadMetadata::title`, but rows show `display_title()`, which prefers the user-set title. Renamed threads don't match their displayed title and still match their old one. Search and the project picker prompt now use `display_title()`. Closes #61761 ## Testing - To reproduce, rename a thread that isn't open, then search for the new title. Renaming an open Zed Agent thread also updates `title`, so it doesn't show the bug. - `test_filter_matches_displayed_title` fails without this change. - `cargo test -p agent_ui --lib` and `./script/clippy -p agent_ui` pass. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - Fixed thread history search not finding renamed threads https://github.com/user-attachments/assets/cdc517cd-9080-4cfd-a94c-ef1b03caa4a4 |
||
|
|
9d1a1bf541 |
dev_container: Run initializeCommand when restarting a container (#67315)
## Summary Restarting a stopped dev container skips `initializeCommand`. Zed now runs it before the restart, as the [spec](https://containers.dev/implementors/json_reference/#lifecycle-scripts) requires. Closes #66381 ## Testing - `test_runs_initialize_command_before_restarting_container` fails if the command is skipped or runs after the start. - `cargo test -p dev_container` and `./script/clippy -p dev_container` pass. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - Fixed dev containers skipping `initializeCommand` on restart |
||
|
|
b77f61f3e3 |
icons: Remove unused icons (#67229)
## Summary Removes eight unused icons and their `IconName` variants. | Icon | Last used for | Removed in | Replacement | |---|---|---|---| | `Attach` | Rules indicator in the thread view | #52440 | `Paperclip` (same glyph) | | `BookCopy` | "Duplicate Rule" button in the rules library | #58067 | None (rules library is gone) | | `DatabaseZap` | Cache indicator in text threads | #52757 | None (text threads are gone) | | `Indicator` | Change count in the old project diff | #24299 | Knockout decorations (#20516) | | `TextSnippet` | Selection creases in text threads | #52757, #54774 | `Reader` | | `ToolCopy` | `copy_path` tool in agent1 | #40495 | Icons by tool kind | | `ToolNotification` | `project_notifications` tool in agent1 | #40495 | `Bell` (same glyph) | | `TriangleRight` | Run button for slash commands in text threads | #52757 | `PlayFilled` (same glyph) | Other unused icons are left in place, since they may still be needed. ## Testing - `./script/clippy` - `cargo test -p icons`, which checks that every variant has an SVG and every SVG has a variant ## 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 |
||
|
|
9bf75d5434 |
git_ui: Preserve selected commit across graph refreshes (#63322)
Fixes #61299 ## Problem The Git graph tracked its selection using `selected_entry_idx`. When a repository event such as `HeadChanged`, `BranchListChanged`, or `StashEntriesChanged` invalidated and reloaded the graph, the selected row index and commit details were retained. Adding a new commit inserts a row at the beginning of the graph. The retained index then points to a different commit, while the details panel still contains data loaded for the previously selected commit. This causes the graph to highlight the new `HEAD` while showing the previous commit's details. ## Fix - Capture the selected commit's SHA before invalidating the graph. - Clear stale row, hover, diff, message, expanded-directory, and asynchronous task state during invalidation. - After graph data reloads, resolve the saved SHA to its new row index and select it again. This keeps both the highlighted row and details panel attached to the same commit even when rows are inserted above it. - Clear any pending restored selection when the user explicitly selects a row, cancels the selection, closes the details panel, or switches repositories, so a refresh cannot override newer user intent. ## Testing Added a GPUI regression test that: 1. Selects the middle commit in a three-commit graph. 2. Inserts a new `HEAD` commit and triggers a repository scan. 3. Verifies that the selected commit follows its SHA to the new index, its details remain correct, and stale hover state is cleared. 4. Verifies that explicit selection and cancellation clear pending selection restoration. Also manually reproduced the issue in Zed Dev and confirmed that the selected row and details remain aligned after adding new commits. Commands run: - `cargo test -p git_ui test_selection_follows_commit_after_head_changes -- --nocapture` - `./script/clippy -p git_ui` - `cargo fmt --all -- --check` Release Notes: - Fixed Git history selection changing when new commits are added. --------- Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com> |
||
|
|
d551a5fd50 |
Fix hashing of signed zero in Pixels, RenderGlyphParams and DocumentColor (#67346)
## Summary
`Pixels`, `RenderGlyphParams` and `DocumentColor` implement `Eq`, but
their
`PartialEq` compares `f32` numerically while their `Hash` hashes
`f32::to_bits()`. `0.0` and `-0.0` compare equal and hash differently,
so a
lookup with an equal key can miss. `RenderGlyphParams` is the live glyph
raster cache, and `DocumentColor` is the key of the `HashSet` that
deduplicates language server colours.
Closes #67334
All three `Hash` impls now drop the sign of zero before hashing, through
one `gpui_util::canonical_float_bits` helper.
`Pixels` ordering now treats `0.0` and `-0.0` as equal too, as it did
before
|
||
|
|
2fc98e1e9b |
agent_ui: Render ACP v2 descriptions as Markdown (#67306)
ACP v2 allows Markdown in descriptions for authentication methods, slash commands, config options and their values, permission requests, and subagents. Render those descriptions with Zed's existing Markdown renderer. Show the subagent description when its card is expanded. Links display their destinations as text and images display their alt text. In permission prompts, only the description is formatted: the title, command, working directory, and choices stay literal. Native agents, ACP v1, and elicitation forms are unchanged. Release Notes: - N/A |
||
|
|
d3bba51492 |
Update ACP SDK to 5.5.1 and align Zed with schema 1.21.2 (#67291)
Update the published ACP Rust SDK from `5.4.0` to `5.5.1` and the schema from `1.19.0` to `1.21.2`. This follows the [protocol and schema changes since 1.19.0](https://github.com/agentclientprotocol/agent-client-protocol/compare/v1.19.0...v1.21.2), not just the [SDK API changes](https://github.com/agentclientprotocol/rust-sdk/compare/v5.4.0...v5.5.1). ACP v2 is in Preview; Zed still negotiates it only with `acp-beta` enabled. - **v1 plans and subagents:** Advertise the stable capabilities without `acp-beta`. Keep legacy checklists working. Let users stop a parent's work after the prompt RPC has returned, without treating the response as the end of its children's work. - **Session ownership and replay:** Historical child state, cancel permissions, and configuration from a v1 load are not current. Detach descendants when their parent is released. Don't show disconnected work as running, a repeated idle snapshot as another child completion, or an unknown stop reason as a success. - **v2 patches and forms:** Preserve compaction status when omitted and reset it to `in_progress` on `null`. Apply usage metadata as a top-level key patch independent of cost. Preserve the agent's field order in elicitation forms and their answers. - **v2 rendering:** Treat tool titles as plain text. Join adjacent text items across snapshots and chunks before rendering Markdown, while retaining each item's metadata and annotations. Keep v1 and native tool-title behavior unchanged. - **Recovery:** A lost prompt response does not prove the message failed. Tell users that the agent may already have acted on the input, including after reconnect. Do not resend it automatically. The client already correlates prompt echoes by message ID, scopes cancellation to foreground work, and enforces the v2 auth and MCP capability checks. The SDK handles tighter wire validation. This PR does not add Markdown rendering to description fields or introduce a keyed Retry action; those are separate UI decisions. Release Notes: - ACP agents can now show markdown plans and subagents. |
||
|
|
11c07191f2 |
gpui_web: Fix keyboard occlusion and refocus on iOS (#67259)
## Summary Keep the canvas at its keyboard-free height while software keyboard input is enabled, so browsers that resize the page expose keyboard occlusion consistently. Preserve that height while the keyboard closes to avoid measuring a partially collapsed viewport, and refocus the hidden text input without blurring on iOS so tapping an editor reopens a dismissed keyboard. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - [GPUI] Fixed keyboard-aware layouts and reopening dismissed software keyboards in Chrome on iOS. |
||
|
|
aee0381dee |
copilot_chat: Offer the default model when none is marked for the picker (#67260)
Copilot Free accounts see no Copilot Chat models (the model list stays empty). GitHub's `/models` response for a Copilot Free account marks every model `model_picker_enabled: false`. That happens with both Zed's and VS Code's `Editor-Version`. `get_models` requires that flag, so it drops every model. When no usable chat model is marked for the picker, `get_models` now offers only the account's default chat model (`is_chat_default`). Accounts where GitHub does mark models for the picker get exactly the list they got before. I reproduced the issue against GitHub with a Copilot Free account, using the same OAuth client, headers and requests Zed sends. All 39 chat models had `model_picker_enabled: false`. 7 had an `enabled` policy, but only the default model, `gpt-4.1`, accepted requests. The others returned `model_not_supported` on every endpoint they list (`/chat/completions`, `/responses`, `/v1/messages`). Release Notes: - Fixed GitHub Copilot Chat showing no models for Copilot Free accounts. |
||
|
|
b699054057 |
Preserve OpenAI-compatible chat completion errors (#67246)
Llama sends error code as integers: `"code":500` Release Notes: - N/A |
||
|
|
9935ef714a |
gpui: Expose the desktop font scaling factor on Linux (#66828)
Closes #66824 GPUI apps on Linux ignore the desktop's text scaling setting, because GPUI reads other settings from the desktop portal but not `text-scaling-factor`. This reads it and exposes it as `App::text_scale_factor()`, with `App::on_text_scale_factor_change` for updates. Apps apply it to their own font sizes, using it in Zed is a follow-up. It stays `1.0` on X11, where GNOME already folds the factor into `Xft.dpi`. Release Notes: - [GPUI] Added `App::text_scale_factor` and `App::on_text_scale_factor_change`, which report the desktop's text scaling setting on Linux Wayland. --------- Co-authored-by: Björn Harrtell <141030+bjornharrtell@users.noreply.github.com> Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com> |
||
|
|
f621145963 |
bedrock: Add support for Claude Sonnet 5.5 and Claude Haiku 5.5 (#67212)
## Summary Closes #67109 Adds support for Anthropic's Claude Sonnet 5.5 and Claude Haiku 5.5 to the Amazon Bedrock BYOK provider: - Registered `ClaudeSonnet5_5` and `ClaudeHaiku5_5` models with standard and `-thinking` aliases. - Configured model IDs (`anthropic.claude-sonnet-5-5`, `anthropic.claude-haiku-5-5`) and cross-region inference profiles (`global`, `us`, `eu`). - Set 1,000,000 context token count and 128,000 output token limit. - Handled Bedrock-specific constraints: - Sonnet 5.5 rejects forced tool use (`tool_choice: Any`), rejects `thinking: {"type": "disabled"}` (maps to `thinking: {"type": "between_tools"}` when thinking is suppressed), and omits sampling temperature. - Haiku 5.5 allows forced tool use, explicitly opts out of default adaptive thinking with `thinking: {"type": "disabled"}` when thinking is suppressed, and omits sampling temperature. ## Testing Ran automated test suites: - `cargo test -p bedrock --features serde/derive` (34 passed, 0 failed) - `cargo test -p language_models --lib --provider::bedrock` (40 passed, 0 failed) - Verified formatting with `rustfmt --check`. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] Tests cover the new or changed behavior. Release Notes: - Added support for Claude Sonnet 5.5 and Claude Haiku 5.5 in Amazon Bedrock. --------- Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com> |
||
|
|
f126950f9d |
Stop two clients from fighting over one remote server (#67336)
Opening a remote project while its workspace was still reconnecting
started a second client with the same `workspace-{id}` server
identifier. The new proxy killed the old server, the old client's
reconnect attached to the new server, and each reconnect killed the SSH
master that both clients shared, so neither connection settled. The new
client then waited out the full 60s initial timeout although its proxy
had already exited with 255.
- `open_remote_project` now focuses a workspace that is reconnecting and
waits for the reconnect to end, instead of starting a second client.
- A new `RemoteClient` stops any older live client with the same
identifier and cancels its reconnect loop, which covers the entry points
that skip workspace matching.
- The initial connection fails as soon as the proxy exits, instead of
after the 60s timeout.
Release Notes:
- Improved remote server reconnect for the same workspace
|
||
|
|
d31d1074a0 |
gpui: Fix focus, key equivalent and mouse issues with native views (#67316)
## Summary Follow-up to #67311, fixing issues a review found in GPUI's native view support after it merged. All of them affect only windows that show a native view. - **A native view that declines keyboard input could recurse without end.** AppKit answers `YES` to `makeFirstResponder:` even when the view declines, leaving the window itself as first responder, and GPUI then asked the same view again from inside the request. The window now checks where first responder ended up, gives keyboard input to the GPUI view when the native view didn't take it, and doesn't ask that view again until it takes input itself or GPUI's focus moves. Reconciling makes at most two requests. - **With two native views, a key equivalent could be performed by the one without keyboard input.** The window asked its superclass, which searches the whole view hierarchy. It now offers the key equivalent to the view that holds first responder, and native views sit in a container that declines key equivalents so AppKit's own search no longer reaches them. - **A native view painted more than once left an invisible input blocker.** Every occurrence inserted a blocking hitbox, though only one is shown. Only the first-painted visible occurrence blocks now, and the scene keeps the first occurrence in paint order rather than draw order. - **A pending multi-key binding stayed armed across a key the view consumed.** With `cmd-k o` bound, `cmd-k`, then `x` typed into the page, then `o` still fired the binding. A key that doesn't continue the pending binding now ends it the way its timeout does. - **Mouse presses were attributed to a native view from GPUI geometry alone, and tracked with one flag.** A press on an AppKit control placed over a native view was also forwarded to GPUI, and with two buttons held the first release cleared the flag for both. The window now asks AppKit's hit test which view receives the press, and tracks owed releases per button. Not changed: native views are still missing from the window's accessibility tree, because AccessKit's adapter on the content view replaces its accessibility children. Moving the adapter to the GPUI view would change accessibility for every window, and the GPUI view covers the window, so hit-testing would likely still land in AccessKit's tree. That needs its own change and a VoiceOver pass. ## Testing - `cargo test -p gpui -p gpui_macos --lib` passes (457 and 18 tests). New or extended unit tests cover the declined-view policy, per-button release tracking, the repeated native view's hit-testing and scene position, and the pending-binding behaviour; each failed against the previous code. - The AppKit behaviours relied on (first responder after a declined request, the key-equivalent search skipping a declining container, the hit-test recipient) were confirmed with an offscreen probe. - Not yet run in an app with a real `WKWebView`: page shortcuts, reserved bindings, two native views, and a click on a control over a page. ## 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: - N/A - [GPUI] Fixed a native view that declines keyboard input causing unbounded recursion. - [GPUI] Fixed key equivalents reaching a native view without keyboard input, an unshown repeat of a native view blocking mouse input, a pending multi-key binding surviving a key the native view used, and mouse presses on controls over a native view being forwarded to GPUI. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com> |
||
|
|
29de395fea |
workspace: Support relative search using ./ and ../ prefix (#57638)
Introduce support in `workspace: open files` to resolve relative path prefixes starting with `./` (or `.\` on Windows) and `../` to the current or parent directory of the currently opened buffer. If no file is associated with the active buffer or it cannot be detected, the path defaults to the workspace project root. [workspace-open-dot-for-current-directory.webm](https://github.com/user-attachments/assets/e18828ab-8c91-4e8a-aef8-171a6ccbaa2b) Release Notes: - Added support for starting search from the active buffer's directory in the `workspace: open files` prompt by typing `./` or `../` for the parent directory. --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
5e3cf96193 |
google_ai: Add long decode support (#67327)
Release Notes: - Added long decode support for Google BYOK models Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
f4fe0be1f8 |
gpui: Composite native views into the scene on macOS (#67311)
## Summary Adds `NativeView` to GPUI: an element that places a platform view (an `NSView` on macOS) in a window and composites it with the rest of the scene, so that GPUI content can be drawn both under and over it. Delta uses this to show a `WKWebView` in a pane tab with GPUI dialogs and toolbars drawn over the page. What it covers on macOS: - **Compositing.** The native view sits behind the window's Metal layer, and the renderer cuts a hole in the scene where the view shows, so GPUI elements painted after it appear above it. The window's layer is non-opaque only while a scene shows a native view. - **Keyboard input.** Keys go to a focused native view first. An embedder can reserve actions that must keep working whatever the view does with keys, including the first key of a multi-key binding. AppKit controls beside a native view keep their own input. - **Pointer.** GPUI elements over a native view block clicks to it, and the native view chooses the cursor while the pointer is over an unobscured part of it. - **Accessibility.** VoiceOver can reach a native view that is shown. Other platforms get the element and a no-op implementation: `NativeView::new` reports that the window cannot show native views. Also included is a small `div` fix that the embedder needed: an item a scroll handle is asked to scroll to before the handle's first frame is now scrolled to once it has been laid out. ## Testing - Two examples: `cargo run -p gpui --example native_view` and `--example native_view_appkit_field`, which show native views with GPUI drawn over them. - The test platform's window records native view placement, with unit tests for the placement, input-routing policy and reserved-action logic. - Exercised through Delta's browser tabs on macOS 26: typing, shortcuts, splits, zoom, dialogs drawn over the page, and hiding and showing tabs. - Not exercised by hand: the black-flash, stale-cursor and VoiceOver fixes in the last two commits. ## 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: - N/A - [GPUI] Added `NativeView`, an element that composites an `NSView` into a window's scene with GPUI content drawn over it. Only macOS supports it for now; `NativeView::new` returns an error on other platforms. - [GPUI] Fixed `ScrollHandle::scroll_to_item` being ignored when called before the handle's first frame. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com> Co-authored-by: zed-zippy[bot] <234243425+zed-zippy[bot]@users.noreply.github.com> |
||
|
|
8ad65dee1c |
google_ai: Generate globally unique tool call IDs (#67314)
Release Notes: - N/A |
||
|
|
3b71d0c834 |
sandbox_linux: More permissive mkdir (#67313)
Many tools call `mkdir -p`, which calls the `mkdir` syscall. Previously, we would require write access to `mkdir` even in the case where a directory already existed. This meant that `mkdir -p` would ask for permission even when it wouldn't modify the FS state. While this technically does leak information about whether directories exist, this was already an intentional design decision (i.e. we do not trap `stat` for performance reasons). Release Notes: - N/A |
||
|
|
2f808b3c2d |
text: Resolve min and max anchors without walking the rope (#67280)
## Summary A singleton multibuffer has one excerpt, from its buffer's min anchor to its max anchor. Multibuffer coordinate conversions, such as `offset_to_point` and `Anchor::to_point`, resolve both ends with `BufferSnapshot::summary_for_anchor`. For the min anchor, it seeks a rope cursor to sum an empty range. For the max anchor, it seeks a rope cursor to the end and adds up subtree summaries on the way, though the rope's root already stores the total. `summary_for_anchor` now returns zero for the min anchor and the root summary for the max anchor, as `summaries_for_anchors_with_payload` already does. Time per call on a singleton multibuffer, averaged over 10,000 random positions. Release build pinned to one core, Ryzen 7 9800X3D, median of 5 alternating runs: | Call | 1k lines | 10k lines | 100k lines | |---|---|---|---| | `offset_to_point` | 176 → 61 ns | 229 → 75 ns | 289 → 105 ns | | `point_to_offset` | 187 → 67 ns | 235 → 84 ns | 299 → 116 ns | | `clip_point` | 180 → 71 ns | 229 → 87 ns | 290 → 117 ns | | `Anchor::to_point` | 349 → 241 ns | 453 → 306 ns | 560 → 379 ns | After was faster in every run. ## Testing - `test_summaries_for_unordered_anchors` and its `_across_chunks` variant already resolve the min and max anchors with `summary_for_anchor`. They fail if either case returns the wrong summary, including when the two are swapped. - `cargo test -p text -p rope -p multi_buffer -p editor` passes. - `./script/clippy -p text` passes. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - N/A |
||
|
|
167f53b58f |
terminal_view: Memoize the minimum contrast check per color pair (#67254)
## Summary `layout_grid` calls `cell_style` for every visible non-blank cell, and `cell_style` runs `ensure_minimum_contrast` for each default or ANSI foreground (`terminal.minimum_contrast` defaults to 45). Each call is a full APCA evaluation: two HSL-to-RGB conversions and 8–10 `powf` calls. Colors below the threshold, such as One Dark's red and bright black (SGR 90 gray), also run a binary search of up to 20 more evaluations. A grid has only a few distinct color pairs, so `layout_grid` now caches the result per foreground and background pair. It also skips the check when `minimum_contrast` is 0, so that setting doesn't pay for a hash lookup per cell. `layout_grid` runs whenever `TerminalView` is notified: for each batch of PTY output (every 4 ms while output streams), on each mouse move over the terminal, and on cursor blink. Contrast checks for one frame, outside Zed in a release build, with `ensure_minimum_contrast` copied from `ui`, One Dark's terminal colors and the default `minimum_contrast` of 45. Ryzen 7 9800X3D, median of 5 runs of 200 frames each: | Grid | Before | After | |---|---|---| | Bottom panel, 2k cells | 0.32 ms | 0.02 ms | | Full window, 15k cells | 2.41 ms | 0.13 ms | | Full window, 15k cells, 30% gray | 4.51 ms | 0.14 ms | Cells use the default foreground (Lc 56, unchanged) except 5% red (Lc 39, adjusted). In the last row, 30% are bright black (Lc 22, adjusted). ## Testing - `test_cell_style_caches_contrast_per_color_pair` is new. It runs `cell_style` over named and indexed color pairs, forwards and then backwards through one cache, at `minimum_contrast` 0, 45, and 90. It checks each color against an uncached `ensure_minimum_contrast` call. It also checks that a miss stores the result, a hit returns the stored color, and the cache stays empty at 0. It fails if the cache is removed, recomputes on a hit, or is keyed on the foreground alone. - `cargo test -p terminal_view` passes. - `./script/clippy -p terminal_view` passes. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - Improved terminal rendering performance |
||
|
|
4f5e323e25 |
Wire up crates.io client in GPUI publishing xtask (#67278)
This PR does the initial wire-up of the crates.io client in the GPUI
xtask. Namely, it
- does the initial checking of whether a crate is already published or
not and
- whether the published crate needs updates, or to be more precise
- whether trusted publishing is configured and
- whether the required list of owners is set
As well as some tests for this behavior.
Release Notes:
- N/A
|
||
|
|
852edce6f8 |
Unify git merge URL, both for command and output toast action (#66408)
Until now the command `git: create pull request` created its own (very nice) url to create a pull request while the the toast action after pushing used the url the git log provided (which is much less precise) This PR routes the toast action through the same PR link creation as the command (and only falls back to the git log url if something failed) --- 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 ~Closes #ISSUE~ Release Notes: - Unified behavior of Merge/Pull Request button on push toast with command-palette action: it now also prefers the internal builder above the remote provided url --------- Co-authored-by: MrSubidubi <finn@zed.dev> |
||
|
|
54fff2ff5b |
component: Remove no-op grow and vertical options (#67220)
## Summary `ComponentExampleGroup::grow()` and `vertical()` set fields that `render` never reads, so all 28 calls did nothing. Removes the fields, the builders and the calls. Also removes the unused `sorted_previews` and `empty_example`. **Most of the diff is rustfmt reflowing `GitPanel`'s preview. With whitespace hidden, it's +28/−77.** ## Testing - `./script/clippy` - To check by hand, open the component preview: the affected examples should render unchanged. ## 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 |
||
|
|
3463950447 |
Bump bundled macOS git to 2.56.1 and verify its checksum (#67264)
Closes #67230 Release Notes: - Bumped bundled macOS git to 2.56.1 |
||
|
|
0a514d7ef5 |
Remove actions that do nothing (#67227)
## Summary Removes 26 actions that nothing handles, dispatches, or binds. They showed up in the keymap editor and keymap file suggestions, but running or binding one did nothing. - `agent`: `FocusUp`, `FocusDown`, `FocusLeft`, `FocusRight` - `channel_modal`: `SelectNextControl`, `ToggleMemberAdmin`, `RemoveMember` - `collab`: `ToggleUserMenu`, `ToggleProjectMenu`, `SwitchBranch` - `collab_panel`: `MoveSelected` - `git`: `FilterRemotes`, `LeaderAndFollower` - `git_onboarding`: `OpenGitIntegrationOnboarding`, the namespace's only action - `git_panel`: `OpenMenu` - `menu`: `EndSlot` - `project_search`: `NextField` - `search`: `CycleMode` - `terminal`: `ScrollHalfPageUp`, `ScrollHalfPageDown`, `SearchTest` - `vim`: `InnerObject`, `SelectRegister` - `workspace`: `ReloadActiveItem` - `zed`: `DebugElements`, `ResetDatabase` Deprecated aliases such as `editor::AcceptPartialCopilotSuggestion` stay, since they keep old keymaps working. ## Testing - `./script/clippy` - `cargo test -p zed -p agent_ui -p collab_ui -p git_ui -p search -p terminal -p title_bar -p vim -p workspace -p menu -p zed_actions`, including `test_action_namespaces` ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - Improved the keymap editor and keymap file suggestions by removing 26 actions that did nothing |
||
|
|
a68d67e058 |
Remove write-only fields and dead test plumbing (#67228)
## Summary Removes fields that are written but never read, and test plumbing that never does anything. No behavior changes. - `FakeFs` gave every fake git repository a sender for git events and spawned a task to drain the receiver, but nothing ever sent one. Removes the channel, the task, and `FakeGitRepositoryState::event_emitter`. - Removing that task reorders the seeded test scheduler and exposes a race in `test_suggestion_returns_after_uninstall`, which already fails for 28 of 200 seeds on `main`. The extension store could start watching `installed/` before the test created it, then poll on a timer the test never reaches. `init_test` now creates the directory first. `test_suggestion_returns_after_failed_install` passed only because the directory was missing, so it now injects its install failure. - Zed always left `bedrock::Request`'s `stop_sequences`, `top_k`, and `metadata` empty, and the Bedrock client never sent them. Removes them, `bedrock::Metadata`, and a test assertion on `top_k`. - Nothing read `FakeLspAdapter::prettier_plugins`, since Prettier plugins come from language settings. Removes it and its setup in six tests. - Removes four more fields that nothing read: `ToolchainMetadata::new_toolchain_placeholder`, `ParameterInfo::label_range`, `PointForPosition::column_overshoot_after_line_end`, and `CaptureInput::input_device`. - Removes Mistral's unused `ContentPart` alias and two optional `editor` dependencies that no feature enables. ## Testing - `./script/clippy` - `cargo test -p fs -p bedrock -p language_models -p editor -p language -p language_core -p languages -p project -p repl -p livekit_client -p mistral -p edit_prediction_context` - `cargo test -p collab --features test-support --test collab_tests -- prettier` - Ran each `extensions_ui` test in its own process for seeds 0–99: all pass. Before, `test_suggestion_returns_after_uninstall` failed for 10 of them, including seed 0. ## 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 |
||
|
|
10d1b2a564 |
Preserve prompt caching for OpenAI Responses (#67245)
Starting with GPT-6.2, OpenAI [appends top-level `instructions` after `input`](https://developers.openai.com/api/docs/guides/prompt-caching#how-prefix-matching-works), outside the cacheable prefix. [Like Codex](https://github.com/openai/codex/blob/9f2b87495bf979f6c1953cf00c98143981664914/codex-rs/core/src/client.rs#L1283-L1292), send Zed’s reusable system prompt as a leading `developer` message, including when replaying a native compaction window. Verified in a local Zed build with GPT-6.2 Sol: 98.4% of input tokens were cached on the final request. A live native-compaction replay probe also hit the cache on all four follow-up requests. All 137 focused tests passed. Release Notes: - Fixed prompt caching for reusable OpenAI system instructions on GPT-6.2 and later. |
||
|
|
46d9717008 |
crates_io_client: Add team_id query parameter and basic logging (#67242)
Also allows `OwnerLogin`s to be used in static contexts, which I'll use in a follow-up PR. Release Notes: - N/A |
||
|
|
a65e743ad9 |
Show external agent authentication status in the Agent Panel (#67243)
With `acp-beta` enabled, Zed asks an external agent that advertises `auth.status` whether it needs sign-in before starting a new thread. Previously, Zed had to try `session/new` and wait for the agent to reject it. This uses the [ACP authentication state query](https://agentclientprotocol.com/rfds/get-auth-state) on both v1 and v2. - When the agent reports `unauthenticated` and offers a supported login method, show the existing sign-in prompt. Continue the original session start after sign-in, keeping its draft and working directories. If the agent doesn't support the query, fails to answer, or takes more than 200 ms, proceed as before. A real authentication error still takes precedence. - Show the active connection's account labels in the Agent Panel's **…** menu (**Toggle Agent Menu**), above Reauthenticate and Log Out. Update them on `auth/status_update`. The composer's **Agent Options** menu is for configuration, not account information. A sign-out notification doesn't interrupt an open thread or resend a prompt. - Show `auth/status` results and `auth/status_update` notifications as received in the local ACP debug log. Copied logs can include the account email or organization if the agent supplied them. No telemetry is added. Release Notes: - N/A |
||
|
|
ad1058d78d |
Use Anthropic capability metadata and update model compatibility (#67203)
- Read compaction support and accepted thinking modes from the Anthropic Models API. - Infer system-message updates, preserved-thinking prefix binding, adaptive-only thinking, and temperature restrictions from Claude family and version. Keep fast mode and forced tool choice on explicit model lists. - Use an advertised thinking-off mode when available; otherwise retain model-specific fallbacks for missing metadata and let models without an off mode use their default. - Cover family cutoffs, future model IDs, and request serialization in regression tests. Validation: 49 Anthropic unit tests, `cargo check -p language_models`, formatting, and `git diff --check` passed. Release Notes: - Improved compatibility with new Claude models and kept Inline Assist working on models that cannot turn thinking off. |
||
|
|
87e6a02e1e |
worktree: Do less work while scan_dir holds the state lock (#67226)
## Summary `BackgroundScanner` workers hold the `state` lock for about 85% of an initial scan, so work under the lock sets the scan time. `scan_dir` now does less of it: - It reserves one block of entry IDs per directory after `read_dir`. Per-child IDs interleaved with other workers' IDs, so each `entries_by_id` edit inserted in about 12 places instead of one. - It skips `reuse_entry_id` when there are no removed entries and the directory has no loaded children, as during an initial scan. These lookups accounted for 58% of all path comparisons on a Linux checkout. - It sorts children by name before it takes the lock, so `SumTree::edit` gets them nearly in order. - It checks `is_path_excluded` before it takes the first lock. Initial scan with `Worktree::local` and `RealFs` in a headless app, one scan per process, warm file cache, Ryzen 7 9800X3D (16 threads), median of alternating runs (21 per variant, 7 for Firefox): | Tree | Entries | Before | After | |---|---|---|---| | Linux checkout | 120,916 | 354.9 ms | 274.0 ms | | Firefox checkout | 532,906 | 2.27 s | 1.85 s | | Zed checkout | 5,339 | 37.9 ms | 35.8 ms | After was faster in every Linux and Firefox run, and in 19 of 21 Zed runs. CPU time is unchanged. Both versions found the same entries in every run. GitHub-hosted runners (4 vCPUs, 3 on macOS), shallow clones, same harness, median of alternating runs (21 per variant, 11 for Firefox; 101 and 41 on macOS): | Runner | Tree | Before | After | After faster | |---|---|---|---|---| | `ubuntu-latest` | Linux | 874.9 ms | 818.0 ms | 20/21 | | `ubuntu-latest` | Firefox | 5.52 s | 5.23 s | 11/11 | | `ubuntu-latest` | Zed | 75.3 ms | 74.9 ms | 13/21 | | `macos-latest` | Linux | 1.13 s | 1.10 s | 61/101 | | `macos-latest` | Firefox | 9.32 s | 9.24 s | 24/41 | | `macos-latest` | Zed | 85.0 ms | 80.3 ms | 58/101 | | `windows-latest` | Linux | 7.93 s | 7.83 s | 15/21 | | `windows-latest` | Firefox | 36.22 s | 35.81 s | 11/11 | | `windows-latest` | Zed | 629.7 ms | 629.0 ms | 12/21 | The scanner starts one worker per CPU, so the runners have less lock contention to remove. Pinned to 4 cores, the local Linux scan improves by 11% instead of 23%. macOS runner times vary by up to 2× between runs. ## Testing - `cargo test -p worktree --features test-support` and `cargo test -p project --features test-support --test integration` pass. - Without the `removed_entries` check, four of these tests fail, including `test_rescan_and_remote_updates`, which checks that renamed files keep their IDs. Without the loaded-children check, 22 fail. - `./script/clippy -p worktree` passes. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - Improved the time to scan large projects when they are opened |
||
|
|
87da03ad3f |
Remove dead code and redundant checks in workspace, search, terminal, and vim (#67219)
## Summary Removes unused code and redundant work. No behavior changes. - Removes about 20 unused items. Examples: - `SerializedWorkspaceLocation::sorted_paths`, which was `unimplemented!()` - `prompt_to_save_or_discard_dirty_items` - the `StatusBar` position helpers - `agent_panel_position` was the only user of `Dock::has_agent_panel`, which was the only user of `Panel::is_agent_panel`. Removes the chain, including `AgentPanel`'s impl. - `Toolbar::can_navigate` was never read. Removes it, `Pane::set_can_navigate`, and the terminal panel's call. - `Pane::in_center_group` was written by `mark_positions` and never read. Removes it, both `mark_positions` methods, `PaneGroup::is_center`, and the `cx` parameter that seven `PaneGroup` methods took only to call `mark_positions`. - Once its unused setter is gone, `Pane::close_pane_if_empty` is always `true`. - `VimCommand::has_count` and `.count()` have done nothing since #18424. - Search no longer checks `is_focused` before `window.focus`, which already returns early for the focused handle. - Removes `cx.notify()` after `start_dismiss_timer` and REPL `shutdown` and `restart`, which always notify. - Vim's `is_numeric_string` drops four emptiness checks that another check or `Iterator::all` already covers. - Drops clones and conversions made only to be borrowed, such as in vim mark lookups and `strip_prefix(..)?.to_string().chars()`. ## Testing - `./script/clippy` - `cargo test -p workspace -p search -p terminal_view -p vim -p repl -p zed -p debugger_ui` ## 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 |
||
|
|
7279c76ef7 |
editor: Remove dead code and redundant checks (#67217)
## Summary Removes unused code and redundant work. No behavior changes. - Removes about 20 unused items. Examples: `HunkAddedColor` and `HunkRemovedColor`, `FoldStatus`, `restore_diff_hunks_in_ranges`, and two `EditorTestContext` helpers. - Nothing called `disable_indent_guides_for_buffer`, so `buffers_with_disabled_indent_guides` was always empty. Removes it, and the lookup that ran for every indent guide. - `Autoscroll::bottom_relative` was the only constructor of `AutoscrollStrategy::BottomRelative`. Removes both. - `SplitEditorState::left_ratio` and `cached_width` were written but never read. - Removes `cx.notify()` after `remove_blocks`, `toggle_git_blame_inline_internal`, `request_autoscroll`, `highlight_background` and `select_entry`, which always notify. - Removes redundant checks and repeated work: - an `edits.is_empty()` early return, already covered by the `edits.first()` let-else that follows it - an `is_empty` check before `CreaseMap::remove` - a re-check of an `Option` in hover popovers - a second identical `anchor_after` call - a second identical buffer snapshot - `multi_buffer`: removes `BufferOffsetUtf16`, `should_expand_up`, `should_expand_down`, `path_for_anchor`, unused lifetimes, and a `cfg` that the enclosing impl already applies. ## Testing - `./script/clippy` - `cargo test -p editor -p multi_buffer -p outline_panel` ## 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 |
||
|
|
4e2c957a6d |
Remove dead code and redundant checks in agent and language model crates (#67218)
## Summary
Removes unused code and redundant work. No behavior changes.
- Removes about 25 unused items. Examples:
- `TerminalProviderCommand`
- `AgentPanel::activate_retained_thread`
- `Thread::is_generating_summary`
- `LanguageModelResponseMessage`
- the fake provider's `ToolUseRequest`, along with `language_model`'s
`serde_json` dependency
- `ResolvedSymbol::{line_text, truncated}` were never read, so symbol
lookups no longer build a display string.
- `SandboxWrap::is_local` has gone unread since #59790 moved the check
into `terminal_tool`.
- Removes `cx.notify()` after `set_server_state`, `add_to_queue`,
`set_editor_is_expanded` and `clear_thread_error`, which always notify.
- `ProfileSelector::ensure_picker` and `ThreadView::toggle_search`
create or reuse their entity in one step instead of re-checking an
`Option` they just set. This removes an `unwrap()`.
- Copilot: once both completion futures finished, the result-tracking
state could only produce an empty `Vec`. Removes it.
- Smaller redundancies:
- Bedrock reuses its `current_message` binding.
- The context server listener uses the request id it already has instead
of `request.id.unwrap()`.
- `action_log` drops an `is_empty` check that `Buffer::edit` already
makes.
- Drops clones made only to be borrowed, and 17 `arc_with_non_send_sync`
allows in agent tests that no longer fire.
## Testing
- `./script/clippy`
- `cargo test -p agent -p agent_ui -p acp_thread -p agent_servers -p
copilot -p language_model -p language_models`
## 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
|
||
|
|
a246423a3b |
Fix TypeScript and TSX type highlighting (#64462)
# Objective - update the `tsx` and `typescript` grammars to match other grammar highlighting - fixes points 1 and 3 of #47049; point 2 (template-string `${}` background, from the `@embedded` capture on `template_substitution`) is left for a follow-up PR ## Solution - remove highlight rules that are too broad - add rules so `this` and `void` types get `type.built_in` Both `typescript/highlights.scm` and `tsx/highlights.scm` ```diff ; Special identifiers -(type_annotation) @type - (type_identifier) @type (predefined_type) @type.builtin +(this_type) @type.builtin + (type_alias_declaration @@ "with" ] @keyword +; `void` is also a unary operator, so the keyword rule above would otherwise win in type positions. +(predefined_type + "void" @type.builtin) + [ ``` `typescript/highlights.scm` only (tsx never had this rule) ```diff -(arrow_function) @function - ; Parameters ``` ## Testing - added `test_builtin_type_highlighting` to check `this` and `: void` as `type.builtin` and `void 0` as `keyword` in TS and TSX. - compared below theme on Nightly and Dev with a `.ts` file with the included TS below. ### Reproduction steps 1. Add the below theme file to Zed's config directory 2. Toggle the "Example Light" or "Example Dark" theme on 3. Create a new file with the TS code below <details><summary>Theme file</summary> ```json { "$schema": "https://zed.dev/schema/themes/v0.2.0.json", "name": "Example", "author": "Daniel Lazaro", "themes": [ { "name": "Example Light", "appearance": "light", "style": { "syntax": { "function": { "color": "#402060", "background_color": "#F7EDFE" }, "type": { "color": "#402060", "background_color": "#F7EDFE" }, "type.builtin": { "color": "#0B3A5C", "background_color": "#D6EEFF" }, "keyword": { "color": "#B3261E" } } } }, { "name": "Example Dark", "appearance": "dark", "style": { "syntax": { "function": { "color": "#F7EDFE", "background_color": "#402060" }, "type": { "color": "#F7EDFE", "background_color": "#402060" }, "type.builtin": { "color": "#D6EEFF", "background_color": "#0B3A5C" }, "keyword": { "color": "#FF8A80" } } } } ] } ``` </details> <details><summary>File to see the repro</summary> ```ts interface Point { x: number; y: number; } const flag: boolean = true; const origin: Point = { x: 0, y: 0 }; class Builder { add(): this { return this; } } function log(): void {} const nothing = void 0; ``` </details> ## 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 ## Showcase | Nightly with issue | Dev build with fixes | | ---- | ---- | | <img width="440" alt="Image" src="https://github.com/user-attachments/assets/f8be7721-9a64-4a70-83c8-a28a443a9638" /> | <img width="440" alt="Image" src="https://github.com/user-attachments/assets/70cda149-9ff9-41aa-acf8-821f4daa8942" /> | --- Release Notes: - Fixed TS/TSX highlighting of type annotations, arrow functions, and `this`/`void` return types --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Kirill Bulatov <mail4score@gmail.com> |
||
|
|
d5615304a1 |
project: Remove dead code and redundant checks (#67200)
## Summary Removes two unreachable modules, unused code, and redundant checks. No behavior changes. - Removes `project::connection_manager`. Its only caller, `maintain_project_connection`, was removed in #36967, and collab no longer handles `RejoinRemoteProjects`. All the module still did was install a global that nothing read. - Removes `task::static_source`, which nothing used, along with `task`'s `futures` and `parking_lot` dependencies. - Removes unused methods on `Project`, the git store and the debugger stores, and unused items in `dap`, `lsp` and `fs`. One of them, `Session::breakpoints_enabled`, returned `ignore_breakpoints`. - `FakeFs::set_create_worktree_error` was the only way to set `simulated_create_worktree_error`. Removes both, along with the check. - `language_server_download_dir` no longer calls the blocking `Path::exists` before `create_dir_all`. - Smaller redundancies: - `set_diff_base` already ignores an unchanged setting, so the caller's comparison is gone. - `Vec::retain` needs no emptiness check. - A `bool` is assigned without comparing it first. - A few clones, `.peekable()` calls and rebuilt structs changed nothing. ## Testing - `./script/clippy` - `cargo test -p project -p task -p dap -p lsp -p fs -p worktree` ## 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 |