mirror of
https://github.com/zed-industries/zed.git
synced 2026-12-04 05:43:21 +01:00
f73feed9de36c5e3eb82aa89baa8eaef5ffc9c98
40689
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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> |
||
|
|
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. |
||
|
|
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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
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 |
||
|
|
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 |
||
|
|
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. |
||
|
|
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. |
||
|
|
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 @
|
||
|
|
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 `` 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. |
||
|
|
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.
|
||
|
|
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> |
||
|
|
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 |
||
|
|
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> |
||
|
|
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. |
||
|
|
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. |
||
|
|
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:  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. |
||
|
|
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 |
||
|
|
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> |
||
|
|
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> |
||
|
|
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. |
||
|
|
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). |
||
|
|
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. |
||
|
|
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. |
||
|
|
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. |
||
|
|
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> |
||
|
|
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. |
||
|
|
0373366f43 |
gpui_macos: Fix animations running at 30 fps on M5 Macs (#65472)
## Summary **This fixes a major slowdown in GPUI apps on M5 Macs (and, per the reports below, other base M-series Macs on macOS 26+).** Every frame blocked the main thread for about 33 ms, which capped animation at 30 fps and delayed input handling; with this change a frame takes under 1 ms and animation runs at the display's full rate. On an Apple M5 (base chip; macOS 27.0.1; Studio Display at a fixed 60 Hz), GPUI animations that aren't driven by input run at 30 fps on `main`. Zed's own `crates/gpui/examples/animation.rs` never goes above 30 fps, even in a focused window. With `ZED_MEASUREMENTS=1`, each frame's draw plus present takes about 33 ms while the scene itself takes about 3 ms; the rest is spent blocked in `-[CAMetalLayer nextDrawable]`. Input hides it: while the mouse moves, frames run at 60 Hz, presumably because input raises the system's performance state. This matches reports outside Zed: about 30 fps UI animation on base M4/M5 chips since macOS 26 ([Apple forum 839102](https://developer.apple.com/forums/thread/839102)), Psychtoolbox's finding that macOS 26 moved the compositor deadline close to vsync so a frame submitted after the vsync callback slips a refresh ([thread](https://psychtoolbox.discourse.group/t/timing-performance-issues-on-macos-26-tahoe/5767/32)), and another app on the same GPUI crates measuring about 32 ms in `nextDrawable` ([karan-vk/Oxikube#601](https://github.com/karan-vk/Oxikube/issues/601)). In #46728 a maintainer suggested moving to CADisplayLink or CAMetalDisplayLink. ## What changed On macOS 14 and later, each window is paced by a `CAMetalDisplayLink` on its layer, and the renderer draws into the drawable the link hands out instead of calling `nextDrawable`. Earlier systems keep the existing `CVDisplayLink` path unchanged. - **The OS picks the rate.** The link keeps Apple's default `preferredFrameRateRange` (the display's maximum rate, adjusted by system policy such as Low Power Mode and thermal state) and default `preferredFrameLatency`. There is no hand-picked frame rate or fallback. - **Shared Apple wrapper.** `gpui_apple::display_link::MetalFrameSource` owns the link and its delegate. It is confined to the main thread (`MainThreadMarker`, `MainThreadOnly` delegate), delivers updates through a typed Rust closure, and `new` returns `None` where `CAMetalDisplayLink` is unavailable. iOS can adopt it later; iOS still uses its existing `CADisplayLink` here. - **The renderer can't call `nextDrawable` while a link drives the layer.** A `DisplayLinkMode` enum makes that state explicit; a frame drawn outside a link update while attached is skipped and logged. Activation and live resize draw synchronously, so they detach (invalidate) the link first and recreate it afterwards. - **Idle windows stop the link.** After an update in which GPUI neither drew, presented, nor asked for another frame, the link pauses, so an idle window acquires no drawables. GPUI's existing `frame_waker` and `schedule_frame` hooks resume it; macOS didn't implement them before, and they're no-ops on the `CVDisplayLink` path. GPUI still owns every frame decision, including presenting for a second after high-rate input, so there is no backend timer. - **macOS window cleanup.** The frame source is an enum (Metal or `CVDisplayLink`), the window state is `Rc<Mutex<…>>` instead of `Arc` plus `unsafe impl Send`, and window teardown invalidates the link. ## Testing **Frame rate (Apple M5 base, macOS 27.0.1, 60 Hz Studio Display; measured on the original revision).** Zed's `animation` example, `--profile release-fast`, frames per second in each second: - `main`: 30 in every focused second (never above 30), 22 to 25 while unfocused - this branch: 60 in every focused second, 22 to 24 while unfocused (GPUI's unfocused-window cap) A scripted scroll benchmark in an app built on these crates (44 identical wheel flicks injected with `Window::dispatch_event`, including a spring animation after each): | | CVDisplayLink | CAMetalDisplayLink | |---|---|---| | Frames with no input, at 60 Hz | 0% (100% at 30 Hz) | 97% | | Frames while input arrives, at 60 Hz | 22% | 91% | | Median frame time (draw + present) | 33.1 ms | 0.5 to 0.7 ms | | Time to run a 25.4 s script | 31.1 s | 26.6 s | **Idle cost (Apple M4 Max, macOS 27.0.1, built-in 120 Hz ProMotion display, AC power, Low Power Mode off).** GPUI `hello_world` and `animation` examples (dev builds), `main` and this branch built from the same base, display kept awake. Each idle run is 60 s after a 10 s warmup; numbers are `top`'s %CPU and energy impact: | | App CPU | App energy impact | App idle wakeups/s | |---|---|---|---| | `main`, idle `hello_world` (3 runs) | 0.96–1.02% | 2.37–2.84 | 30–40 | | Link always running, idle `hello_world` (2 runs) | 1.93–2.19% | 1.93–4.47 | — | | This branch (idle pause), idle `hello_world` (3 runs) | 0.00% | 0.00 | ~0.1 | | `main`, `animation` (30 s) | 23.1% | 24.4 | — | | This branch, `animation` (30 s) | 21.0% | 22.2 | — | Without the idle pause, an idle window cost about twice `main`'s CPU because the link acquires a drawable every refresh; with it, an idle window does no work at all. The `animation` run checks that a paused link resumes and keeps rendering. WindowServer showed no consistent difference, though some runs overlapped with the machine being in use. Also verified by hand on the M4 Max: idle, animation, and live resize after the final revision. Checks: `cargo clippy -p gpui_macos -p gpui_apple --tests` is clean; `cargo test -p gpui_macos -p gpui_apple` passes, including tests for the renderer's display-link drawable handling, the idle-pause decisions (including a wake that arrives during an update), and drawing normally once a link is invalidated. `gpui_apple` also type-checks for the iOS simulator at the iOS 15 deployment target. **Not yet measured:** whether the first frame after an idle pause (e.g. the start of a scroll) arrives later than with an always-running `CVDisplayLink`; whether the idle pause lets ProMotion drop its refresh rate more (expected, not measured); Low Power Mode; macOS 14 and 15; multiple displays and moving a window between them. **Open questions for review:** - **Live resize recreates the link on each resize step.** The synchronous `displayLayer:` draw detaches the link, and starting the source creates a new one. Resizing works, but a cheaper approach (e.g. restarting the link once when live resize ends) could follow. - **One frame may mismatch during a programmatic resize.** A frame is sized from the link's drawable while the path-rendering intermediate textures follow the layer's newer size, so the two could differ for that frame. Not observed. ## 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. (Frame rate and idle cost need a display and were measured by hand, as above.) Release Notes: - [GPUI] Improved animation frame rate on macOS: frames are paced by `CAMetalDisplayLink` on macOS 14 and later, so animations reach the display's refresh rate instead of 30 fps on some Macs, and idle windows stop requesting frames --------- Co-authored-by: Anthony Eid <hello@anthonyeid.me> |
||
|
|
025d2a06ee |
agent_ui: Avoid flashing submission status rows for ACP v2 prompts (#66295)
When sending a prompt to an ACP v2 agent, the thread view showed a
status row ("Sending message…" / "Waiting for message to appear…") with
a preview of the prompt until the agent echoed the message back. Most
agents echo almost immediately, so the row flashed briefly on every
send.
- In-flight submissions (pending, or accepted but not yet echoed) now
only show a status row once they have stayed unsettled for 1 second.
Failed, cancelled, and disconnected submissions still appear immediately
so they can be copied, restored, or discarded. Submissions already in
flight when a thread view is created are shown without the delay.
- Each row is now a single line: a short colored status, a truncated
one-line prompt preview, and the Copy/Restore/Discard buttons. Longer
explanations and error messages move into a tooltip on the status.
Release Notes:
- N/A
|
||
|
|
5882c67dc3 |
notification: Remove unreferenced bits (#66294)
Following removal of notification panel there should be opportunities to remove some (all??) of notification crate ## 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 |
||
|
|
2529740084 |
gpui: Wrap arena in an Rc to prevent UB (#66293)
Attempting to repro an unrelated bug with miri discovered UB in the way we handle the arenas. Previously, the `App` struct had a `RefCell<Arena>` field. A `*const` to this refcell was stored in a thread-local, which, when allocating elements, is then converted to a `&RefCell<Arena>`, and then `.borrow_mut()`-ed and `Deref`-ed into a `&mut Arena`. However, at the same time, we produced a `&mut App` reference, which claims unique write access to the fields of `App`, including the `RefCell<Arena>` (and therefore the `Arena` itself). Since we were producing a `&mut App`, at the same time as a `&mut <field of that App>`, and that second reference was derived from a thread local, it's UB (miri reports it in both stacked-borrows and tree-borrows modes). Wrapping it in an `Rc` breaks this "exclusive claim", since the `&mut App` only implies exclusive access to the `Rc` itself (i.e. the `RcInner` pointer), but not the `RefCell<T>` itself. Release Notes: - [GPUI]: n/a |
||
|
|
33156f0d81 |
language_model: Stream background events through async-channel (#66290)
`stream_in_background` forwards a model's events from a background task through a bounded `futures::channel::mpsc`. When the 32-event buffer fills, that channel parks the sender behind a `std` mutex that the receiver also locks to wake it. On the web the receiver polls on the browser's main thread, and the producer runs on a Web Worker. Waiting on a contended `std` mutex on the main thread traps with `Atomics.wait cannot be called in this context`, which can happen whenever rendering falls behind a model stream. `async_channel::bounded` keeps the same backpressure without that mutex. `gpui_web`'s HTTP response body already uses it for the same reason. Release Notes: - N/A |
||
|
|
bc7041c600 |
Fix standalone modifier sequences not being flushed after timeout (#55800)
### Summary
Standalone modifier keys were not timing out, causing them to linger in
pending state and incorrectly form multi-stroke sequences (e.g.
triggering `shift shift` after IME switching).
### Details
Standalone modifier keystrokes (e.g. `shift`) were not participating in
the key sequence timeout lifecycle, causing them to remain in the
pending input state indefinitely.
In Chinese IME, `shift` is commonly used to toggle between EN and ZH
modes.
A typical workflow is:
1. Tap `shift` to switch to Chinese input
2. Type some Chinese text
3. Tap `shift` again to switch back to English
However, due to the missing timeout behavior, the first `shift` remains
in the pending sequence.
As a result, the second `shift` is interpreted as `shift shift`, which
incorrectly triggers the command palette.
### Reproduction
1. Use the following keymap, or enable the JetBrains keymap:
```json
[
{
"bindings": {
"shift shift": "command_palette::Toggle",
},
}
]
```
2. Press the `shift` key twice with an interval greater than the timeout
(1 second)
3. The command palette is toggled (unexpected; it should not be
triggered)
### Fix
If the pending input sequence contains only a standalone modifier, mark
it as requiring a timeout, so it is flushed after the timeout.
### Test
Tests are added to cover:
- timeout flushing of standalone modifiers
- successful dispatch when the sequence completes before timeout
---
Self-Review Checklist:
- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable
~~Closes #ISSUE~~
Release Notes:
- [GPUI] Fixed standalone modifier keys no longer lingering in the
pending input state indefinitely. This prevents them from incorrectly
forming multi-stroke shortcuts after long intervals
|
||
|
|
3524cb2297 |
settings_ui: Save new project skills to the remote in remote workspaces (#66224)
Part of #59088 Stacked on #66207 Creating a project skill in a remote project over SSH, WSL, or a dev container wrote it to your local machine instead. The skill creator took the remote folder path and used it on the local disk. So the save either failed, or the skill landed in a folder the project never sees. The form, URL import, and share links all hit this. The skill creator now writes through the project, the same way share and delete do after #66207, so the skill ends up on the remote. Before writing, it checks for an existing skill with the same name on the machine that has the files, so it won't overwrite one, even in a gitignored or excluded `.agents`. That check is a new `Project::host_path_is_dir`, which uses the existing `GetPathMetadata` request, so no proto changes. Collab guests can't check the host's disk, so saving a project skill in a project someone shared with you now fails with an error. Hiding the creator for shared projects is a separate PR. Global skills in a remote project still get created locally. They should go to the remote's `~/.agents/skills`, but Zed doesn't load skills from there yet, see #58222. I'll do that separately. Release Notes: - Fixed the skill creator saving project skills to the local machine instead of the remote in remote workspaces. |
||
|
|
2eb2928c15 |
tasks: Do not run worktree hooks in restricted mode (#66284)
## 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: - Worktree task hooks no longer run when a given workspace is in restricted mode. |
||
|
|
e8e579d6ea |
agent: Fix project skill mentions, share links, and deletion in remote workspaces (#66207)
Part of #59088. Fixes the project skill case of #58222 (reported in #62293 and #65525). Supersedes #65527. In remote projects (SSH, WSL, dev containers), project skills were broken outside of the agent loading them itself: mentioning one failed with "Failed to read skill file", and Copy Share Link and Delete on the Skills settings page did nothing. This fixes that. In remote projects, you can now: - mention a project skill in the agent panel - copy a project skill's share link from the Skills settings page - delete a project skill from the Skills settings page Global and built-in skills work the same as before. Supersedes #65527, keeping its commit, and on top of it: - shows a skill again if Delete can't move it to the trash - only routes project skills through the project, so a global skill isn't read from the remote when its path also exists there - adds tests for mentions, share links, and delete - checks the skill's path when finding its project, since collab projects can repeat worktree ids - keeps a skill hidden if it was already deleted outside Zed Left out on purpose: - The skill creator still saves project skills to the local machine instead of the remote. That's the other half of #59088, and it'll be a separate PR. - Skills in the remote machine's own `~/.agents/skills` still aren't loaded (#58222). Global skills always come from the local machine for now. - Clicking a global skill mention in a remote project still doesn't open the file (#61357, #58148), because it looks for the file on the remote. - Deleting a project skill on a Windows remote from a macOS or Linux machine still fails, because the skill's folder path is worked out with the local machine's path rules. - The Skills settings page doesn't list skills until a Zed Agent thread has been started (#59543). That also happens in local projects, so it's separate from this PR. Release Notes: - Fixed mentioning, sharing, and deleting project skills in remote workspaces. --------- Co-authored-by: Daniel Bloom <daniel@wormholelabs.xyz> |
||
|
|
99cda17e05 |
project: Include user MCP servers before the first worktree loads (#64612)
# Objective Fixes #64611 An ACP thread created before the project's first worktree finishes loading receives no MCP servers, even when they are configured in user settings. `ContextServerStore::resolve_all_context_server_settings` only reads settings through visible worktrees, so with none loaded it returns an empty map. `mcp_servers_for_project` then sends `mcpServers: []` in `session/new`, and the agent runs the whole thread without MCP tools. #62026 refreshes the store once a worktree appears, but a session that was already created is never updated. This came from #52849, which replaced the `ProjectSettings::get(location, cx)` call (where `location` was `None` with no worktree, so global settings applied) with a loop over visible worktrees. ## Solution When there are no visible worktrees, read `context_servers` from `ProjectSettings::get(None, cx)` with `worktree_id: None`. Behaviour with one or more worktrees is unchanged. ## Testing - Added `test_global_context_servers_configured_without_worktrees`: a project with no worktrees and a user-level HTTP server. It fails on `main` (`configured_server_ids()` returns `[]`) and passes with this change. - `cargo test -p project --test integration context_server`: all 22 tests pass, including the multi-worktree ones from #52849. - Tested on Linux. We found this in headless Zed, where an ACP thread is opened programmatically a few seconds after launch and the agent intermittently had no MCP tools. I haven't tested the GUI path by hand. ## Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content adheres to Zed's UI standards ([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) and [icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md) guidelines) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable --- Release Notes: - Fixed external agents sometimes starting without MCP servers configured in user settings, when the thread was created before the project folder finished loading. --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com> |
||
|
|
5a534d7b5d |
git: Add git auto fetch (#53089)
## Summary
Adds an opt-in periodic background `git fetch --all` for local
repositories, so remote-tracking branches and ahead/behind counts stay
current without a manual fetch.
Because the fetch runs unattended, it behaves differently from a
user-initiated fetch:
- **Trusted repositories only.** Re-checked on every tick, since a
worktree can be trusted or restricted at any point in a session.
- **Never prompts.** Credentials that need no interaction (e.g. an SSH
agent, or a credential helper answering from a keychain) still work.
Anything that would need input fails instead of blocking on a prompt
nothing will answer.
- **Silent.** No activity indicator in the status bar, since a spinner
every minute is noise. Failures are logged at debug level.
- **Stays out of the user's way.** It runs off the repository's serial
job queue, so status refreshes and staging aren't stalled behind the
network. A user-initiated fetch, pull, or push preempts an in-flight
background fetch rather than waiting for it.
- **Leaves the repository clean when stopped.** Stopping a fetch (a
settings change, preemption, closing the project) asks git to terminate
so it can remove its ref lockfiles, rather than killing it and leaving a
stale `.lock` behind that breaks every later fetch. It also never
triggers auto-maintenance on the user's behalf.
## Configuration
```json [settings]
{
"git": {
"auto_fetch": {
"enabled": false,
"interval_secs": 60
}
}
}
```
- `enabled` (default `false`): whether to fetch from all remotes in the
background.
- `interval_secs` (default `60`, clamped to a minimum of `15`): how
often to fetch.
Both are exposed in the settings UI under **Version Control > Git
Integration**, where the interval is only shown while auto-fetch is
enabled, and documented in `docs/src/reference/all-settings.md`.
Unrelated settings changes don't restart the timer.
## Implementation design
### `GitCaller`
The remote-capable `GitRepository` methods (`fetch`, `pull`, `push`,
`commit`) take a `GitCaller` instead of a bare `AskPassDelegate`:
```rust
pub enum GitCaller {
/// A user started this and is waiting on it. Prompts route to the UI.
User(AskPassDelegate),
/// No user attached. Never prompts, and stops when the receiver resolves.
Background(Option<oneshot::Receiver<()>>),
}
```
Every such command goes through `GitBinary::run_remote_command`, which
applies everything the caller implies. git, credential helpers, and ssh
each prompt through a different mechanism, so keeping the list in one
place means no call site can miss one. For `Background`:
| Prompt channel | Mitigation |
| --- | --- |
| git's own terminal prompt | `GIT_TERMINAL_PROMPT=0` |
| Credential helpers | `credential.interactive=false`, which is narrower
than clearing `credential.helper` so helpers that answer without
prompting keep working |
| askpass | `core.askPass=`, and `GIT_ASKPASS`/`SSH_ASKPASS` unset |
| ssh (key passphrases, host key confirmation) | `-o BatchMode=yes`
composed onto the ssh command git would otherwise use
(`GIT_SSH_COMMAND`, then `core.sshCommand`, then `ssh`), so custom ssh
commands keep working. Setups that only set the deprecated `GIT_SSH` are
left alone, since setting `GIT_SSH_COMMAND` would silently replace them.
|
`gc.auto=0` is also set, since auto-maintenance can repack the whole
repository. gpg's pinentry when signing isn't covered, as no background
caller signs.
### Cancellation
A background command is spawned with `kill_on_drop` and raced against
its cancel receiver, where a dropped sender counts as cancellation:
1. If already cancelled before spawning, git is never started.
2. On cancellation, git is sent `SIGTERM`
(`util::process::request_termination`), which runs its handlers that
remove lockfiles.
3. If it hasn't exited within a 2s grace period, it's killed.
Windows has no equivalent signal, so cancellation there is a kill.
### Scheduling
- Each repository has a timer task, restarted only when `enabled` or
`interval_secs` change.
- On each tick, the timer checks trust, then tries to acquire the
repository's `fetch_lock` semaphore and skips the tick if it's held. It
spawns a **detached** fetch task that holds the permit until the fetch
settles.
- `AutoFetchState.cancel` holds the sender, and is the only thing
bounding the fetch's lifetime. It's dropped on a settings change, on
preemption, and when the repository is dropped, so every way of stopping
a fetch goes through graceful cancellation.
- Running off the serial job queue is safe because auto-fetch mutates no
`Repository` state. It only updates remote-tracking refs, which git
guards with its own lockfiles, and the results reach the UI via the
resulting git directory rescan. Manual fetch stays on the queue, since
it also writes snapshot state via `refresh_branch_list`.
- `fetch`, `pull`, and `push` call `preempt_auto_fetch()`, which drops
the cancel sender, then wait on `fetch_lock` inside their job. That wait
is bounded by a cancelled fetch shutting down rather than by the
network, and stops them failing with "cannot lock ref" against a
background fetch.
## Test plan
`test_auto_fetch` covers:
- [x] An untrusted repository is never auto-fetched, and fetching begins
once its worktree is trusted
- [x] Timer fires on schedule, and again on the following interval
- [x] Unrelated settings change mid-interval doesn't reset the timer
- [x] Disabling `auto_fetch` stops all fetches
- [x] Re-enabling with a longer interval respects the new cadence
## Review
Self-Review Checklist:
- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable
Addresses
#24611(https://github.com/zed-industries/zed/discussions/24611)
Release Notes:
- git: Added option (off-by-default) to automatically fetch upstream of
the current branch and default upstream of the project. Enable it with:
```
{
"git": {
"auto_fetch": {
"enabled": false,
"interval_secs": 60
}
}
}
```.
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Codex (GPT-6) <noreply@openai.com>
Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
|
||
|
|
4112666801 |
gpui_macos: Update Spanish-ISO shortcut mappings (#66283)
Extract the Spanish-ISO shortcut-mapping update from #51600 by @jamarju, preserving Javier Martín as the commit author. Update the Spanish-ISO key-equivalent table using the keyboard-inspector output collected on macOS Tahoe 26.3.1 and shared in the original PR. Correct stale punctuation mappings, add the missing equals-to-asterisk mapping, and remove the obsolete period-to-ç mapping. Release Notes: - [GPUI] Fixed outdated macOS Spanish-ISO keyboard shortcut mappings. Co-authored-by: Javier Martín <javier.martin@freepik.com> |
||
|
|
28917a970d |
helix: Fix system clipboard clobbering (#55455)
Hi! Pleased to be able to contribute In Helix, plain `y`/`d`/`c`/`p`/`R` operate on register `"` and the system clipboard is reached with `+y`/`+d`, etc... Under `vim.use_system_clipboard: "always"`, the plain operations also clobbered the system clipboard. For ex: - Pressing `d` on a blank line empties the OS clipboard - Pressing `d` on a selection overwrites the clipboard with the deleted text This restores Helix's separation between the `"` and `+` registers in helix mode only. Regular vim mode is not affected by the changes. Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable I'm pretty sure this is related to #42975 Release Notes: - fix(helix): system clipboard clobbering --------- Co-authored-by: Lukas Wirth <lukas@zed.dev> |
||
|
|
9cb5f90e3c |
Suppress synthetic WM_MOUSEMOVE during window repaint (#55739)
Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Closes #55491 Release Notes: - [GPUI] Synthinc mouse movement events on windows no longer retrigger focus ### Summary Suppress synthetic `WM_MOUSEMOVE` events fired by Windows when the window repaints (e.g. command palette opening). These are not real mouse movements and should not reposition the editor cursor. ### Changes - `crates/gpui_windows/src/window_inner.rs`: add `mouse_position: Cell<Point<Pixels>>` to `WindowsWindowState` - `crates/gpui_windows/src/events.rs`: in `handle_mouse_move_msg`, skip dispatch when position unchanged and no button is held |
||
|
|
87ce147829 |
git_ui: Make git graph refs its own column & resizable (#66260)
## Summary Since https://github.com/zed-industries/zed/pull/59839 we moved the ref labels outside of the description column, but this introduced for some people a worse UX, because they have a very long branch names that now couldn't be shown anymore since we truncate the label based on a min/max available space. So I think making the ref labels its own column so that you can resize the column to your own liking makes sense so that people can view they ref labels based on their own liking column size that was also suggested in https://github.com/zed-industries/zed/issues/65681 which i agree with. As you can see now inside the after video the column can now be resized and allows you to see more of your ref labels if needed :). **Before** <img width="1512" height="821" alt="Screenshot 2026-10-28 at 18 56 09" src="https://github.com/user-attachments/assets/63090314-dce6-4b0f-9dd4-f8419fc8964d" /> **After** https://github.com/user-attachments/assets/76a1a4a1-451d-41de-8068-039e38255030 ## Testing I validated that everything still works like selecting/highlighting a row and toggling of rows as you can see inside the **after** video and added tests that cover the new behavior. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - Added a resizable "Refs" column to the git graph that can be toggled on or off from the column header's context menu |
||
|
|
7c8dbadcb5 |
gpui: Make power and thermal frame intervals configurable (#66281)
## Summary Expose `low_power_frame_interval` and `thermal_frame_interval` on `WindowOptions`, alongside the existing `inactive_frame_interval`. Defaults remain approximately 30 fps in Low Power Mode and 60 fps under serious or critical thermal pressure. Each option accepts `None` to disable that particular limit. When multiple limits apply, the longest interval wins; mandatory platform presentations continue to bypass throttling. Profiler skip reasons identify the effective limit. Applications can now choose their own limits without changing GPUI internals. This does not add application settings UI. Release Notes: - [GPUI] Added configurable Low Power Mode and thermal-pressure frame intervals to `WindowOptions`, with the most restrictive enabled limit taking precedence. |
||
|
|
2c2f737ab2 |
gpui: Add sendable foreground execution for web HTTP clients (#66165)
## Summary This cleans up the gpui_platform code a bit, and in combination the way we set up the http client for the web. This does introduce a `ForegroundExecutor` variant that it itself is Send-able, allowing to dispatch foreground futures from background workers (by requiring the future to be Send, unlike `ForegroundExecutor`), which is a requirement for web fetch. a31c7b54c60738b82524e4e4c12aec2f6caf101d fixes a bunch of warnings with our binary names Release Notes: - [gpui] N/A |
||
|
|
f0210f1621 |
gpui: Use UAX #14 line breaking for text wrapping (#64624)
Replaces the `is_word_char` list with Unicode line breaking ([UAX #<!-- -->14](https://www.unicode.org/reports/tr14/)) using the `icu_segmenter` crate. `is_word_char` can't express line breaks that depend on both neighboring characters, so currently wrapped lines sometimes start with `/` or `?`, and some emojis like 👍🏽, 🇯🇵, and 👩💻 get incorrectly split across lines: https://github.com/user-attachments/assets/2a8a9eee-11c9-4143-b56c-3a2b4621af9a This generalizes the tweaks from #11296, #17590, #35724, #37019, #37024, #45160, #51659, #51973, #54546, #59775, and #62743, and supersedes #62345 and #63983. Important to note: - This allows hyphenated words to break after the hyphen which is a behavior change. I believe UAX #<!-- -->14 does permit tweaking this in case we want to keep the current behavior, by filtering those out of the `break_indices` return value. - Obviously this isn't quite as performant as `is_word_char`, but it seems to still be plenty fast enough, as I wasn't able to come up with a contrived case where this causes noticeable performance issues. ## Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content adheres to Zed's UI standards ([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) and [icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md) guidelines) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable --- Release Notes: - Improved text wrapping to follow Unicode line breaking rules. - [GPUI] Improved text wrapping to follow Unicode line breaking rules. --------- Co-authored-by: Noritada Kobayashi <noritada.kobayashi@gmail.com> Co-authored-by: Lukas Wirth <lukas@zed.dev> |
||
|
|
1663af412c |
Properly invalidate LSP data for outdated excerpts (#66264)
Closes https://github.com/zed-industries/zed/issues/66189 * Multi buffers kept code lens rows, inline diagnostics and document colors after their excerpts were replaced, shrunk, moved or removed, so ghost lenses, blank rows and misplaced errors piled up at excerpt starts. * Refreshing LSP data for one visible buffer cancelled pending refreshes for the others, so in project search only some files got code lenses, colors, folding ranges, links, symbols or pull diagnostics until an excerpt was edited. * One slow buffer held back LSP results for every other buffer in the same refresh. * Late code lens results for removed buffers could bring their stale data back after removal. * Removing a buffer from a multibuffer didn't cancel its pending LSP requests. All fixed by splitting one large data-related task into per-buffer tasks and adding an explicit cleanup on excerpt changes/buffer removals. Release Notes: - Fixed stale LSP data being shown in multi buffers |
||
|
|
7f9a39a9c0 |
Bump livekit-rust-sdks to upgrade zip to 9.1 (#66272)
Bumps the `livekit`, `libwebrtc` and `webrtc-sys` git rev from `0a1c519` to `fbda05e` (zed-industries/livekit-rust-sdks#15). The only change in that rev is `webrtc-sys-build` moving from `zip` 0.6 to 9.1, using only the pure-Rust deflate decoder. This clears these zip advisories: - GHSA-m665-v7pm-7grj: inspection and extraction can see different filenames. - GHSA-vv5m-jxxh-4627: extraction keeps SUID/SGID bits. - GHSA-4684-h2q9-2vcp: extraction can change permissions through a symlink. `zip` is used only at build time, to extract the prebuilt WebRTC archive. `Cargo.lock` changes: - zip 0.6.6 → 9.1.3. - Adds `nix`, `typed-path` and `zlib-rs`. - Removes `bzip2`, `zstd` 0.11, `pbkdf2` and related crates that only zip 0.6's default features used. ## Verification - `corgi check -p livekit_client` passed. Corgi supplies WebRTC through `LK_CUSTOM_WEBRTC`, so this check didn't use the download path. - The download and extraction path was tested in zed-industries/livekit-rust-sdks#15 against the real WebRTC archives for macOS arm64 and Linux x64. Release Notes: - N/A |
||
|
|
02d47bf64f |
http_client: Unify asset downloading logic (#66048)
Supersedes https://github.com/zed-industries/zed/pull/62653 ## Summary This PR unifies the download handling we have in the http_client crate, because we were alternating between the ways we were downloading a lot, in one case we changed the way of downloading entirely if a hex digest was present or not. With this in, we now handle this one way for all kinds of downloads, removing a lot of duplicated code and unifying the behavior here across download types. ## Testing Tested this manually. ## 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: - Improved reliability of language server and agent downloads by verifying checksums consistently, rejecting failed HTTP responses, and improving cleanup of partial downloads. |
||
|
|
e5bdd01cd8 |
agent: Truncate long lines in read_file tool (#65395)
# Objective Fixes #64376 Relates to #59401, #34099 Prevent the agent `read_file` tool from overflowing the model's context window when encountering very long lines (such as minified JavaScript/CSS, source maps, SVGs, single-line JSON files, or embedded data URIs). This follows up on the review discussion in #64378 with @smitbarmase to implement generic line length capping rather than special-casing base64 strings. ## Solution 1. **Generic line truncation (`MAX_LINE_LEN = 2000`)**: In `crates/agent/src/tools/read_file_tool.rs`, lines streamed in `write_lines_numbered` are capped to 2000 characters (`char_indices().nth(remaining)`), appending `... (line truncated to 2000 chars)`. - Streaming chunks are tracked across boundaries so multi-chunk long lines are capped without materializing oversized strings. - Counts Unicode characters rather than bytes so multi-byte UTF-8 (e.g. CJK) text is not cut early. - Preserves line numbers and trailing newlines intact. 2. **Updated tool description**: - `read_file`: Informs the model that lines longer than 2000 characters are truncated with `... (line truncated to 2000 chars)` and suggests using `grep` or `terminal` to inspect the full content of very long lines. 3. **Tests**: - Added `test_write_lines_numbered_truncation` (unit test covering single-chunk, multi-chunk, and multi-byte UTF-8 character capping). - Added `test_read_file_truncates_long_lines` (GPUI tool test). ## Testing - Ran `cargo fmt -p agent --check` (clean). - Ran `cargo test -p agent truncat` (all passed). ## Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments (none used) - [x] The content adheres to Zed's UI standards - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable --- Release Notes: - Improved `read_file` tool output by truncating lines longer than 2000 characters to prevent context window overflow. --------- Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com> |