mirror of
https://github.com/zed-industries/zed.git
synced 2026-12-02 21:40:41 +01:00
f4fe0be1f8c7974db07e01c5cd05bee0cf4eb8d9
40952 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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 |
||
|
|
5a0e9521f6 |
Remove dead code and no-op options from UI components (#67201)
## Summary Removes component options and state that nothing used. No behavior changes. - `ContextMenu::header_with_link` was the only constructor of `ContextMenuItem::HeaderWithLink`. Removes both. - Removes unused options and their render paths: - `DropdownMenu::no_chevron` - `Modal::show_back` and `ModalHeader::show_back_button` - `Section::contained` and `Section::new_contained` - Removes fields that were written but never read: - `ThreadItem::is_remote`, which the sidebar computed for every row - `TreeViewItem::default_expanded` - three `SkillCreatorPage` fields - `JoinChannelTooltip::has_notes_notification` - `ContextMenu` no longer notifies after `close_submenu`, which already does, and no longer clones its focus handle just to focus it. - Removes other unused builders and helpers, such as `custom_entry_with_docs`, `Tooltip::new_element` and `ToggleState::from_any_and_all`. Also removes unused test macro arms. ## Testing - `./script/clippy` - `cargo test -p ui -p sidebar -p settings_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 |
||
|
|
925ee76e1b |
Remove dead code and stale lint suppressions in infrastructure crates (#67199)
## Summary Removes unused code, redundant checks, and lint suppressions that no longer do anything. No behavior changes. - `settings`: removes the `EditableSettingControl` trait, which had no implementations. - Removes unused helpers in `util`, `paths`, `path`, `sqlez`, `clock`, `zlog`, `http_client` and `migrator`. - `settings_json` reuses a string it just built. `zlog` drops a flag that an earlier `continue` keeps `true`. `http_proxy` drops emptiness checks before `write_all`. - GPUI internals: removes a `.peekable()` that never peeks and a duplicate inspector handle clone. The Wayland client drops an `is_some()` check before setting `enter_token = None`. - Removes empty, unused Cargo features: - `test-support` in `feedback`, `http_client_tls` and `install_cli` - `perf-enabled` in `util_macros`, whose code checks the `perf_enabled` cfg instead - Also removes two `cfg_attr`s on a `nightly_coverage` feature that doesn't exist. - Removes `#[allow]` attributes for lints the workspace already allows, and ones that no longer suppress anything. ### Suggested AGENTS.md additions > Don't apply `clippy::let_unit_value` to `let _guard = span.enter()`. `ztracing` spans are `()` when tracing is off, so the lint fires, but dropping the binding ends the span early when tracing is on. ## Testing - `./script/clippy` - `cargo test -p settings -p util -p paths -p sqlez -p scheduler -p zlog -p crashes -p http_proxy -p gpui` ## 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] Removed unused internal code and stale lint suppressions |
||
|
|
07278eddc4 |
agent_servers: Fix removal of registry agent versions that are still in use (#66971)
## Summary Registry agents installed from an archive live in one directory per version, and every launch removed all older version directories. An agent still running from one of them then broke, because adapters resolve files next to their own binary on demand. After another session installed a newer Claude Agent, the older session failed with "The Claude CLI is missing" (agentclientprotocol/claude-agent-acp#1596). A running agent now holds a lease on the version it was launched from, and cleanup only removes versions that nobody holds a lease on. - **The lease** is a shared file lock on `<version dir>.lease`. Every Zed process that shares the data directory (stable, preview, nightly) honors it, and the operating system releases it if Zed crashes. - **Taking it** happens before checking whether the version is installed, so a cleanup in another process can't remove the version between that check and the agent starting. - **Releasing it** happens when the agent process exits, not when the connection is dropped. Threads keep a connection alive long after its agent has exited, and that should not pin the version. - **Cleanup** retires a version only if it can lock that version's lease exclusively. A per-agent `leases.lock` serializes taking and removing leases, so a lease file is never deleted between another process opening and locking it. - **Retiring** renames the version to `retired_<name>` while the leases are locked, and deletes it after the lock is released. A version is therefore never left half-deleted under a name that still looks installed, and launching an agent doesn't wait for a deletion. A later cleanup deletes any `retired_` directory that an interrupted one left behind. - **Installing** takes an exclusive per-agent `install.lock` and re-checks for the version afterwards. Installing replaces the version directory, so two windows installing the same version at once could previously remove the directory the first agent was already running from. - **Remote projects**: the client launches the agent, so the remote server never sees it exit. The server keeps the lease of every version it resolved until the server itself exits. A failure on one stale version is logged and the remaining ones are still cleaned up. ### File locks in `Fs` Locking goes through the `Fs` trait, like the rest of the store's file access. This adds `Fs::lock_file` (waits for conflicting locks) and `Fs::try_lock_file` (returns `None` instead of waiting). Both take a `FileLockKind` (`Shared` or `Exclusive`), create the file if needed, and return a `FileLock` that is released on drop. - `RealFs` takes OS file locks through std. To wait, it opens the file once and retries a non-blocking lock with a backoff (5 ms up to 250 ms). A wait uses no thread and stops when its future is dropped. Waiting inside the operating system instead would hold a blocking-pool thread per waiter, even after cancellation, and enough waiters would starve the lock holder's own file operations. - `FakeFs` keeps an in-memory lock table keyed by inode and resolves the file once before waiting. A lock is therefore on the file that was at the path when it was requested, even if that file is removed or replaced, as on a real file system. To keep that true, `FakeFs::create_file` with `overwrite: true` now keeps an existing file's inode instead of assigning a new one, which is how `FakeFs` already treats writes to an existing file. ### Other API changes `get_command` now returns a `ResolvedAgentServerCommand`, which bundles the command with its lease, and the connect functions take that type. Callers without an installation to protect build one with `ResolvedAgentServerCommand::without_installation_lease`. ### Known limits - A Zed build without this change takes no lease and still removes old versions unconditionally. Two channels running side by side stay exposed until both have the fix. - The terminal login command is not leased, because the terminal outlives the task that resolves the command. - On a file system without lock support, the agent launches without a lease and cleanup removes nothing. - A Zed process that hangs while installing an agent keeps other processes from installing that agent until it exits. - Lock waiters poll, so one can notice a released lock up to 250 ms late, and waiters are not served in order. - Agents distributed through npx install in place and are not covered by this change. ## Testing Ran locally on macOS; CI covers Linux and Windows. ```sh cargo test -p fs cargo test -p project --lib -- agent_server_store cargo test -p agent_servers --lib cargo test -p remote_server -- agent ./script/clippy ``` New or changed tests: - `test_realfs_file_locks` and `test_fake_fs_file_locks` run the same assertions against both implementations: shared locks coexist, shared and exclusive locks conflict, a waiting lock is granted once the conflicting ones are released, a cancelled wait doesn't take the lock, a waiter is granted the lock on the file it started waiting on even if that file is removed or replaced, locking a dangling symlink creates its target (resolving `..` through symlinked directories), and truncating a file keeps the locks on it. On Windows, `RealFs` skips the removed-file, truncation and symlink cases. - `test_realfs_lock_waiters_leave_threads_for_file_operations`: with 512 waiters queued on a held lock, the holder can still use the file system. It times out if waiting blocks a pool thread. - `test_remove_stale_versioned_archive_cache_dirs` (on `FakeFs`): stale versions, leftover lease files and leftover `retired_` directories are removed; an older version with a held lease survives until the lease is released; a version that can't be deleted doesn't keep the others on disk; and a lease file is kept if its version exists. - `registry_archive_version_is_installed_once_by_concurrent_launches` (on `RealFs`): two launches of the same uninstalled version download it once. It fails without the install lock. - `registry_archive_version_is_kept_while_its_lease_is_held` (on `RealFs`): installs through `get_command`, checks the version survives cleanup while the lease or a clone of it is held, is removed once released, and reinstalls afterwards. - `installation_lease_is_released_when_the_agent_exits`: the lease is released when the agent process exits, while its owner is still alive. Checked by hand, not in the repo: - With a throwaway program: another process sees a lock as held, it is released when the holder is killed with SIGKILL, and a child spawned by the holder does not inherit it. Not tried against a real adapter update in a running Zed. ## 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.) - [x] Tests cover the new or changed behavior. Release Notes: - Fixed external agents installed from the ACP registry breaking (for example Claude Agent reporting "The Claude CLI is missing") when a newer version was installed while an older one was still running. |
||
|
|
f693ad0847 |
Group Delta checkouts with their source repository (#67187)
Delta gives every checkout its own Git clone, so that each checkout has its own refs, and lets the clone borrow objects from the source repository through `objects/info/alternates`. Zed groups workspaces by the common directory of their repository, so each Delta checkout was a project of its own, and all of them had the same name: https://github.com/user-attachments/assets/ec8c4d62-7ba4-4356-b214-7b2a038869cc Open Recent and the agents sidebar then listed one indistinguishable entry per checkout, the title bar named every checkout `main`, and its worktree picker listed the clone's Git directory as a worktree. This change treats a Delta checkout like a linked worktree of its source repository, as Max and Nathan suggested: the project appears once, and each checkout is a worktree of it. https://github.com/user-attachments/assets/97fe63b1-67ca-47b8-b965-c05cd703ffb8 Now: - A Delta checkout joins the project group of its source repository in the agents sidebar, in Open Recent and in the title bar. - Thread rows, the project menus and the title bar label a checkout after its Delta namespace directory. - The title-bar worktree picker lists the other open checkouts of the project, and no longer lists the Git directory of a clone as a worktree. - The project picker of an archived thread lists every open checkout of the project. - Git operations keep using the checkout's own repository: grouping identity and Git identity are separate values. - A checkout is recognized only when its clone contains `delta/copy-baseline` and the first line of its alternates file names the objects directory of the source. Notes on the implementation: Before this change the identity of a project was the identity of its repository in every layer. A Delta checkout needs two identities, one for grouping and one for Git, and every layer that stores, compares or shows the identity has to tell them apart. - Test are 3,772 of 6,206 added lines (most of the test size is fixtures) - The identity is persisted in three places (workspaces, threads, terminals), and each needs to read rows saved by older builds. - Left out on purpose, to keep it from being larger: conversion of saved data that is not open, remote projects, and any new UI for closed checkouts. Release Notes: - Improved the agents sidebar, Open Recent and the title bar to show Delta checkouts as worktrees of their source project |
||
|
|
3d3bd04fad |
Preserve signed Anthropic thinking without display text (#67198)
From their docs: > A block with empty text is complete, because its signature holds the reasoning, encrypted. Anthropic can return a `thinking` block with an empty `thinking` string and a nonempty `signature` when thinking display is omitted. The signature contains the encrypted reasoning, so the API expects the whole block back unchanged. See [Anthropic’s preserved-thinking documentation](https://platform.claude.com/docs/en/build-with-claude/preserved-thinking/change-tools-or-instructions#append-assistant-turns-exactly-as-returned-details). Treat a thinking block with a signature as nonempty in the shared request model, and serialize signed blocks even when their display text is empty. Unsigned thinking blocks are still dropped. The regression test checks the serialized JSON when a signed, empty-text block is the assistant message’s only content. Release Notes: - Fixed Anthropic thinking blocks being dropped from follow-up requests when they contain a signature but no display text. |
||
|
|
2cc3c8ec76 |
sandbox: Add proxy events, TCP port and Unix socket grants, and hidden paths (#67106)
The `sandbox` crate's policy can restrict the network to a list of HTTP(S) hosts, but a caller can't find out which hosts the proxy refused, can't let anything that isn't HTTP through (so restricting the network breaks Git over SSH), and can't keep a command from reading a directory. This adds those capabilities for macOS, where Delta uses the crate today. `Sandbox::with_network_events` forwards the proxy's events to the caller while the existing logging continues. `SandboxNetPolicy::Restricted` gains `allowed_tcp_ports`, and `SandboxPolicy` gains `allowed_unix_sockets`. Both filesystem policies gain `hidden_paths`, subtrees a command can't read or write, with `hidden_path_exceptions` inside them that behave as if they were outside. Existing callers pass empty values for the new fields, so Zed's behaviour is unchanged. The Bubblewrap and WSL backends reject a policy that uses a capability they can't enforce, the same way they already reject protected file names. The second commit makes `canonicalize_allowing_missing_leaf` resolve through the nearest existing ancestor instead of a single missing level; without that, a hidden path two levels below a missing directory under a symlink such as `/tmp` keeps its unresolved form and is silently not hidden. That also corrects protected-path and `GrantableWriteDir` results in the same case, which is a behaviour change worth a look. A few things reviewers may want to weigh: a TCP port grant applies to every host; re-exporting the proxy's event types ties this crate's public API to `http_proxy`; and Seatbelt hides by path, so a hard link made earlier outside a hidden path stays readable. The last two commits can be dropped if only proxy events and the port and socket grants are wanted. The Linux rejection tests were not run, and nothing was run on Linux, WSL, or Windows beyond cross-checking that the library builds. Closes DEL-4085 Release Notes: - N/A |
||
|
|
6ae76a6a0a |
Add an Ultrafast response speed picker (#67184)
Offer Standard, Fast, and Ultrafast in the Agent Panel for supported OpenAI and ChatGPT Subscription models. Fast-only models keep their existing toggle. Release Notes: - Added an Ultrafast response speed option for supported OpenAI and ChatGPT Subscription models. |
||
|
|
72ff4e05ee |
project_panel: Hide expand chevron on empty directories (#65672)
Hide the expand chevron on empty folders when `folder_indicator` is `both`. `chevron` mode keeps it, since it is the only thing marking a folder. Empty folders are worked out in `update_visible_entries` from the same snapshot as the rows, and only for local worktrees. Feature request: https://github.com/zed-industries/zed/discussions/66749 Release Notes: - Improved the project panel to hide the expand chevron on empty folders when `folder_indicator` is `both` --------- Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com> |
||
|
|
10c56fa0c6 |
search: Fix regex replacement of capture groups before non-ASCII text (#66821)
## Summary
I was renaming chapter headings in a Chinese text, changing `第1回` to
`第1章`, using a regex search for `第(\d+)回` with the replacement `第$1章`.
Instead of `第1章`, every match was replaced with just `第`: both the
captured number and the trailing `章` were gone.
The same thing happens whenever a capture reference is directly followed
by a non-ASCII letter. For example, replacing `(\d+)e` with `$1ème`
turns `2e` into an empty string instead of `2ème`.
The cause is that `fancy_regex` treats every Unicode alphanumeric
character as part of an unbraced reference, so `$1章` is looked up as a
group named `1章`, which does not exist. The `regex` crate ends the
reference at the first character outside `[0-9A-Za-z_]`.
`SearchQuery` still expands with `fancy_regex`, but prepares the
replacement first: an unbraced reference that starts with ASCII word
characters and continues with non-ASCII ones is ended at the first
non-ASCII character (`$1章` becomes `${1}章`), unless a group with the
full name exists. Braced references and all other syntax are left as
they were, and no dependency is added. The prepared template is computed
once in `with_replacement` and kept next to the raw replacement, so
`replacement_for` only expands captures for each hit. Writing `第${1}章`
is a workaround in the meantime. Vim's `:s` with `\1` goes through the
same code path.
Related: #40775 covers the ASCII case (`$1_old` is read as group
`1_old`), which this PR leaves unchanged.
## Testing
- Added four unit tests in `crates/project/src/search.rs`: the normal
path, the fallback path that matches the hit on its own, the reference
syntax that has to keep working (including the cases from review), and
preparing the template again when the replacement changes. The first two
fail without the fix (the replacement comes back empty).
- `cargo test -p project --lib search::tests` and `cargo test -p search
--lib replace` pass on macOS (Apple Silicon).
- Manually tested in a local build on macOS: with regex search enabled,
replacing `第(\d+)回` with `第$1章` now turns `第1回` into `第1章`. Retested on
|
||
|
|
0cc1ffb6b3 |
agent: Support global skills over SSH, WSL, and dev containers (#66767)
Closes #58222 Closes #59088 Closes #58148 In a remote project (SSH, WSL, or a dev container), global skills came from your local `~/.agents/skills`. The remote machine's own `~/.agents/skills` was ignored, and when the agent tried to read or edit a skill file it looked on the local disk. Global skills in a remote project now come from the remote machine. The remote server loads and watches its `~/.agents/skills` and tells Zed when it changes. What changed: - The agent lists the remote's global skills, and picks up new, edited and deleted ones without a restart. - Using a skill, or mentioning one, reads its `SKILL.md` from the remote. - The agent's file tools (read, list, edit, write, create directory, copy, move, delete) work on the remote's `~/.agents/skills`. They still ask before changing anything there, even when the tool is set to always allow. - The User tab of the Skills settings page lists, creates and deletes skills on the remote, and says which machine it is showing. - Opening the global `AGENTS.md` from a remote project shows a read-only copy. The file lives on your local machine, and Zed used to look for it on the remote. - Local projects work the same as before. Some calls I made: - A remote project uses only the remote's global skills, not both. The agent's tools take a plain path, and `~/.agents/skills/my-skill/SKILL.md` could then mean a file on either machine. A local skill's scripts also wouldn't exist on the remote, where the agent's terminal runs. - The check for "is this path inside the skills folder" runs on the remote. Only that machine can resolve `..` and symlinks in a path on its disk. - The remote only sends each skill's name and description. The body is read when the skill is used. - The agent now rebuilds its project context when the project's visible folders change, not on every worktree added or removed. Reading a remote skill file opens it outside the project, and that used to trigger a rebuild each time. Left out on purpose: - The Skills settings page still doesn't list skills until a Zed Agent thread has been started (#59543). That also happens in local projects. - Collab guests keep using their own local global skills. Release Notes: - Added support for global skills from the remote machine's `~/.agents/skills` in remote projects (SSH, WSL, and dev containers). |
||
|
|
df1ba676f2 |
agent_ui: Organize ACP config options in the agent composer (#67190)
Keep the external agent composer compact and match the Zed Agent's Fast Mode and Thinking Effort controls. Model and Mode stay next to Send. Other settings go in Agent Options, where pickers keep their search, groups, and favorites. If the agent changes its options while a submenu is open, close the menu and release the old picker. <img width="635" height="197" alt="image" src="https://github.com/user-attachments/assets/2f2ad595-98ea-441e-80c7-f41d9c01bc00" /> (Fast mode will use the fast mode toggle in the next adapter release) Release Notes: - Aligned External Agent config options with native Zed agent UI for similar controls. |
||
|
|
4a7d10473a |
sandbox_linux: Remove timeout (#67186)
its trivial Release Notes: - N/A |
||
|
|
886dab4069 |
Remove dead code and redundant checks in edit prediction (#67150)
## Summary
Removes unused code and redundant checks. No behavior changes.
- Removes four unused `EditPredictionStore` methods, and
`RelatedExcerptStore::set_related_files`, whose only caller was one of
them.
- Removes `ContextRetrievalStartedDebugEvent::search_prompt`, which was
always empty and never read, plus three unused constants.
- Rate predictions modal: removes `cx.notify()` after
`select_completion` and `confirm`, which notify on every path.
- CLI: removes `exists()` checks before `read_to_string`,
`create_dir_all`, `remove_file` and `remove_dir_all`. Each call already
handles a missing path.
- `zeta_prompt`: `ends_with('\n') && !is_empty()` becomes
`ends_with('\n')`.
## Testing
- `./script/clippy`
- `cargo test -p edit_prediction -p edit_prediction_context -p
edit_prediction_cli -p edit_prediction_ui -p zeta_prompt`
## 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
|
||
|
|
36acea54c5 |
Remove dead code and redundant checks in language and text crates (#67151)
## Summary
Removes unused code and redundant work. No behavior changes.
- `language`: removes unused `Buffer` and `BufferSnapshot` methods and
`proto::deserialize_selections`, plus an `is_empty` check before a loop
in `randomly_undo_redo`. Examples: `build_empty_snapshot`,
`highlighted_text_for_range`, `syntax_root_ancestor`.
- `languages`: removes the unused `LANGUAGE_GIT_COMMIT` and its optional
`tree-sitter-gitcommit` dependency. The `grammars` crate still registers
the grammar.
- `text`: nothing called the test `Network`'s disconnect helpers, so
`disconnected_peers` was always empty. Removes it and its checks.
- `toolchain_selector`: removes the never-read `language` field and the
task that loaded it. Also removes a `.map(|this| if false { .. } else {
.. })` whose first branch could never run.
- `picker_preview`: removes the never-read `current_path` field.
- `html_to_markdown`: compares attribute names without allocating a
`String`.
- `markdown`, `markdown_preview`: `SharedString::from(s.to_string())`
becomes `SharedString::from(s)`.
- Also removes:
- unused items in `buffer_diff`, `rope`, `sum_tree`, `fuzzy_nucleo` and
`language_core`
- `.peekable()` calls that never peek
- unused lifetimes
- the empty `test-support` features in `language_core` and
`markdown_preview`
## Testing
- `./script/clippy`
- `cargo test -p language -p languages -p text -p markdown -p
markdown_preview -p toolchain_selector -p html_to_markdown`
## 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
|
||
|
|
0c5af8c563 |
Remove dead code and redundant checks in git, debugger, and panel UIs (#67149)
## Summary Removes unused code and redundant work. No behavior changes. - Diagnostics no longer clones the buffer snapshot for every row it scans when expanding context. The callee takes a reference. - The project panel's download path no longer calls the blocking `Path::exists` before `Fs::create_dir`, which already succeeds when the directory exists. - Removes `cx.notify()` calls right after callees that already notify: `update_visible_entries`, `Picker::update_matches`, `Picker::refresh`, `set_selected_index` and `Pane::set_zoomed`. - Calls `select_thread` directly. It already returns early for the current thread. - Replaces `collect::<Vec<_>>().len()` with `count()` and `Some(i).and_then(f)` with `f(i)`. - Drops clones made only to be borrowed, `.peekable()` calls that never peek, and `let _ =` on unit values. - Removes unused code: - four `git::repository` helpers - `open_branches` and `open_stash`, which were never registered as action handlers - `ProjectDiff::deploy_at_project_path` - `RepositorySelector::update_repository_entries` - `ProjectSymbols` - the git graph's never-read `SplitState::left_ratio`. Its `on_drop` handler stays, empty, so the drop still ends the drag. - `open_path_prompt`: narrows `cfg(any(test, feature = "test-support"))` to `cfg(test)`. The crate has no `test-support` feature. ## Testing - `./script/clippy` - `cargo test -p git -p git_ui -p debugger_ui -p tasks_ui -p diagnostics -p project_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 |
||
|
|
b51ffab015 |
search: Ensure text finder clears on no results (#67147)
## Summary If the text finder already had results and the query was changed to one that produced no results, the list of results would not be cleared, as `search::text_finder::delegate::stream_results_to_picker` would only clear results when handling results, so when no results were received, the list of results would not be cleared. This commit updates `search::text_finder::delegate::stream_results_to_picker` to ensure results are always cleared, even when no results are received, except if the search has been cancelled. ## Testing Tested both manually, as shown in the Showcase section below, as well as added a test for this – `search::text_finder::delegate::tests::test_no_matches_clears_previous_results`. ### Showcase <details> <summary>Before</summary> https://github.com/user-attachments/assets/2a399814-204a-497d-9647-f2ea460411ca </details> <details> <summary>After</summary> https://github.com/user-attachments/assets/fa4e1a7b-9f1f-4f6e-90d5-cec7295d95f9 </details> ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - Fixed Text Finder showing results from the previous query when a search found no matches. |
||
|
|
740e018b70 |
Fix private value redaction in remote projects (#66525)
Remote files lose their `is_private` flag, leaving `.env` values visible over SSH even with `redact_private_values` enabled. Preserve the flag in file metadata so the editor's existing redaction works remotely. Testing: all 71 remote-server tests pass. Both new regressions fail with the original decoder. Verified masking over SSH from macOS to Linux. ## Self-review - [x] Reviewed for quality, security, reliability, and performance. - [x] UI [checklist](https://zed.dev/docs/development/ui-checklist): verified dark/light themes and the redaction setting over SSH. - [x] Tests cover the changed behavior. Release Notes: - Fixed `.env` values remaining visible over SSH when `redact_private_values` is enabled. |
||
|
|
4e161e70b5 |
google_ai: Add Extra High thinking level for Gemini 4 Neon (#67173)
## Summary Barely 24 hours after merging #67011 (`gemini-4-hydrogen`), Google is already working its way across the periodic table with [Gemini 4 Neon (`gemini-4-neon`)](https://aistudio.google.com/docs/models/gemini-4-neon) — thankfully skipping Helium through Fluorine for now. Following #65572 and #67011, Zed loads BYOK Gemini models dynamically from Google's `v1beta/models` catalog while maintaining model-specific thinking level overrides in `google_ai` (as the catalog endpoint only reports a boolean `thinking` flag). Like Hydrogen, `gemini-4-neon` supports four thinking levels (`low`, `medium`, `high`, and `xhigh`) and defaults to `high` rather than `medium` (while rejecting `minimal`). Without explicit overrides in `google_ai`, `Extra High` is omitted from Zed's thinking effort selector for Neon and its default effort falls back to `Medium`. This PR: - Adds `"gemini-4-neon"` to `highest_thinking_level` (`ThinkingLevel::XHigh`), exposing `[Low, Medium, High, XHigh]` via `Model::from_listed`. - Adds `"gemini-4-neon"` to `default_thinking_level` (`ThinkingLevel::High`). - Extends `test_from_listed_thinking_levels_per_model` to cover `"gemini-4-neon"`. ## Testing - `cargo test -p google_ai` (31 passed) - `./script/clippy -p google_ai` - `cargo fmt -p google_ai -- --check` Reviewers with a paid-tier Gemini API key can select `Gemini 4 Neon` in the Agent Panel and verify that thinking effort defaults to `High`, lists `Low`, `Medium`, `High`, and `Extra High`, and strips `Extra High` gracefully when switching a thread to `Gemini 4 Argon` or `Gemini 4 Carbon`. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - Added Extra High thinking effort support and High default thinking level for Gemini 4 Neon (`gemini-4-neon`). |
||
|
|
4a4c8150f0 |
Bump tree-sitter to cf5d3a63 (#67174)
Release Notes: - N/A Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
2eff23878e |
gpui: Normalize clipboard line endings on Windows (#66945)
Windows applications expect CRLF line endings in CF_UNICODETEXT, so convert LF to CRLF when writing to the clipboard. Convert CRLF back to LF when reading from the clipboard, too, to prevent surprises in applications. Release Notes: - N/A - [GPUI] N/A Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
3c2118dd69 |
Correct hosted model pricing and availability (#67165)
Update the hosted-model reference to match Cloud's customer-visible catalog. - Add Claude Haiku 5.5 pricing and its enforced 100k context window. - Add Gemini 3.8 Flash pricing and its 1M context window. - Move retired GPT-5.2-Codex out of the pricing/context tables and replace the stale recommendation with GPT-5.3-Codex. - Leave GPT-6.2 models out of the public reference while their rollout is staff-only. Prices come from Cloud's `crates/billing/src/plans.rs`, including the 10% Zed markup. Context limits come from `crates/llm_api/src/services/model_service.rs`. The customer rollouts are cloud#4143 and cloud#3909; GPT-5.2-Codex retirement is cloud#3135. No billing data, database rows, or model access changes. The human author reviewed the changes and removed the required README.md review notice; that removal has been committed and pushed. This is the single source PR to main; the premature manual stable PR #67166 is closed. Publishing to preview and stable will use the docs workflow, with its source revision explicitly verified first. `script/trigger-docs-build --from-main` selects the workflow from main but still checks out the channel release branch; it does not copy this PR from main. Fable 5.2 documentation is already present on the current stable branch and public Markdown page. Validation: - `cd docs && npx --yes prettier --check src/account/zed-hosted-models.md` passed. - `git diff --check` passed. - A Python consistency check passed: 35 models have matching pricing/context entries; all documented prices apply exactly 10% markup; new rates, context limits, retirement, Fable retention, and GPT-6.2 exclusion match the intended change. - `cd docs && npx --yes prettier --check src/` reports pre-existing formatting issues in six unchanged files: configuring-languages.md, development.md, extensions/themes.md, languages/r.md, reference/all-settings.md, and vim.md. Those files are out of scope. - The full mdBook build was not run locally. Release Notes: - N/A |
||
|
|
dd091a1b4f |
Update installer terms to General Terms and Zed Product Terms (#67119)
Replaces the terms shown by the Zed installers with the new **General Terms of Service** followed by the **Zed Product Terms** (both dated November 18, 2026), and updates the `legal/` mirror of zed.dev's legal pages to match. ### Installers affected | Installer | Where terms come from | Change | | --- | --- | --- | | macOS DMG | `script/bundle-mac` → `dmg-license script/terms/terms.json` → `terms.rtf` | New content; `terms.json` unchanged and still points at `terms.rtf` | | Windows (Inno Setup) | `crates/zed/resources/windows/zed.iss` → `LicenseFile: "script\terms\terms.rtf"` (English and Simplified Chinese) | New content; `zed.iss` unchanged | | Linux (install script, Flatpak, tarball) | No install terms | None | ### Files - `legal/terms.md`: now the General Terms of Service (zed.dev `/terms`). - `legal/zed-product-terms.md` (new): Zed Product Terms (zed.dev `/terms/zed`, `slug: terms/zed`). - `legal/privacy-policy.md`: new Privacy Policy, titled "Zed Industries Privacy Policy" (zed.dev `/privacy-policy`). - `script/generate-terms-rtf`: now builds one RTF from both documents. - `script/terms/terms.rtf`: regenerated. Release Notes: - N/A |
||
|
|
846ff80e0e |
vim: Match Vim's word selection for * and # (#66794)
## Summary Vim allows searching for punctuation runs using */# and furthermore does not require the word to be searched for, to be adjacent to the cursor. See also [pattern.txt](https://github.com/neovim/neovim/blob/7e394dbb896eaf86cb1046666dd423d512cda55f/runtime/doc/pattern.txt#L62) Vim's priority for selecting the run to be searched for is: 1. Word under the cursor 2. First word somewhere to the right of the cursor on the same line 3. Punctuation run under the cursor 4. First punctuation run somewhere to the right of the cursor on the same line Currently, Zed only allows picking words directly adjacent to the cursor (both to the left and to the right) and will otherwise not search for anything. After this change, Zed will no longer search for a word on the immediate left of the cursor, which did not match Vim's behavior. Instead, the chosen run will be selected according to the priorities outlined above. ## Testing Pick any file and optionally a Neovim instance and observe that */# behave as in Neovim. In particular * Zed will no longer search for a word on the immediate left of the cursor. * Zed will only pick runs that either surround the cursor or are somewhere to the right of the cursor. * It is possible to search for punctuation runs. * Word runs are always prioritized over punctuation runs. For example: `(ˇ[ tmp ([tmp` will result in `([ tmp ([ˇtmp` (this is also included in the test cases). ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [ ] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - Improved `*` and `#` in Vim mode to follow Neovim's behavior and search for the next word on the line when the cursor isn't on a word, and for punctuation when no word follows --------- Co-authored-by: dino <dinojoaocosta@gmail.com> |
||
|
|
988007a89a |
Update ACP SDK to 5.4.0 and align v2 session behavior (#67155)
Update to published ACP Rust SDK 5.4.0 (schema crate 1.19.0). Follow the [protocol changes since schema 1.18](https://github.com/agentclientprotocol/agent-client-protocol/compare/v1.18.0...dbff792240171b199b5ad24d01406720ac9e4bd3) for behavior Zed already implements: - Use each parent's `replay_complete` marker to distinguish historical child state and cancel capabilities from current updates. Keep current child updates that arrive before the resume response, but wait for a successful response before sending child controls. Detach descendants when their root closes. - Reply to agent-cancelled v2 permission requests and elicitations with `cancelled` or `cancel`, respectively. Leave background requests and tools alone when cancelling foreground work, and keep accepting agent status updates. - Ignore `pattern` in v2 elicitation forms, but keep validating it in v1 forms. Cursor and fork-at-position UI, retaining history from a failed resume, and automatic keyed prompt resend are out of scope. This PR uses the published SDK and does not depend on an unreleased SDK fix. Release Notes: - N/A |
||
|
|
264f0b67be |
Update piper to fix truncated file writes (#67160)
The zip extraction tests in `crates/util/src/archive.rs` fail intermittently on Linux CI with errors such as `unable to locate the end of central directory record`, for example in [this run on main](https://github.com/zed-industries/zed/actions/runs/44141138965). The cause is a bug in `piper` 0.2.4, where closing the `Writer` right after writing can make the `Reader` lose bytes (fixed upstream in smol-rs/piper#31, released as 0.2.5). This only bumps `piper` in `Cargo.lock`. ## Testing I reproduced the failure by running a test that extracts a small zip 20,000 times in a loop, with 48 copies of it running concurrently to create CPU contention: - `piper` 0.2.4: 47 of 48 runs failed, with `unable to locate the end of central directory record`, `unexpected end of file`, or an empty extracted file. - `piper` 0.2.5: 0 of 96 runs of the full `archive::tests` module (including the loop) failed. The loop test is not included, since it only fails under heavy load and exercises a dependency rather than our code. Release Notes: - Fixed a rare issue where files written by Zed, such as extracted downloads, could be truncated |
||
|
|
5cffb90247 |
project: Load diff bases for many buffers in one git process (#67026)
## Summary Opening a diff loads its base text with `Repository::load_committed_text` (HEAD and index, for uncommitted diffs) or `Repository::load_staged_text` (index, for unstaged diffs). Each call was a separate git job with its own `git cat-file --batch` process. A repository runs its git jobs one at a time, so opening many diffs at once queued one process per buffer, and other git work (status, staging, blame) waited behind them. Project search results open an uncommitted diff for every buffer they show, and the Uncommitted Changes view one per changed file. The branch diff view and the `default_branch` diff base open an unstaged diff per file. Each process reads the index to resolve `:path`, so the cost grows with the repository. Loads requested while their job is queued join it and share one process. Only the most recently queued job takes new loads, which keeps their order relative to other git jobs. The job owns its batch, so a job dropped before it runs cancels its loads. If the batch fails, each load retries in its own process, so an unreadable object fails only its own diff. The batch decodes its texts on a background thread. Remote repositories still send one request per buffer. Diff base reloads already loaded every open buffer's bases in one batch, and a failed batch cleared the bases of every buffer. Reloads retry the same way, and a buffer whose own load fails keeps its bases. `load_revisions` discards git's stderr, which it never read. When a `refs/tags/HEAD` ref exists, git writes an ambiguity warning for each `HEAD` lookup, and about 1,700 lookups filled a 64 KiB pipe and blocked git mid-batch, in opens and reloads alike. Benchmark: open the first N files of a checkout as buffers in a headless app with `RealFs`, wait 5 s for the initial git status, then time opening all of their diffs at once. Binary files don't open as buffers, hence 983 and 996. Warm cache, Ryzen 7 9800X3D, git 2.53, median of 5 alternating runs with and without this change: | Checkout | Index | Diff | Diffs | Before | After | Speedup | |---|---|---|---|---|---|---| | Zed | 0.5 MB | uncommitted | 100 | 95.0 ms | 29.6 ms | 3.2× | | Zed | 0.5 MB | uncommitted | 983 | 980 ms | 313 ms | 3.1× | | Zed | 0.5 MB | unstaged | 100 | 81.8 ms | 17.2 ms | 4.8× | | Zed | 0.5 MB | unstaged | 983 | 793 ms | 169 ms | 4.7× | | Linux | 10.5 MB | uncommitted | 100 | 418 ms | 32.6 ms | 13× | | Linux | 10.5 MB | uncommitted | 1,000 | 4.31 s | 281 ms | 15× | | Linux | 10.5 MB | unstaged | 100 | 398 ms | 20.0 ms | 20× | | Linux | 10.5 MB | unstaged | 1,000 | 4.08 s | 155 ms | 26× | | Firefox | 72 MB | uncommitted | 100 | 2.43 s | 56.1 ms | 43× | | Firefox | 72 MB | uncommitted | 996 | 25.4 s | 314 ms | 81× | | Firefox | 72 MB | unstaged | 100 | 2.52 s | 43.5 ms | 58× | | Firefox | 72 MB | unstaged | 996 | 24.5 s | 183 ms | 134× | git's CPU time drops by a similar factor, for example from 25.1 s to 95 ms for 996 uncommitted diffs in Firefox. GitHub-hosted runners, 1,000 diffs, shallow clones, one build that switches to the old code with an environment variable, median of 5 alternating runs: | Runner | Checkout | Diff | Before | After | Speedup | |---|---|---|---|---|---| | `ubuntu-latest` | Linux | uncommitted | 13.3 s | 598 ms | 22× | | `ubuntu-latest` | Linux | unstaged | 13.2 s | 294 ms | 45× | | `ubuntu-latest` | rust-lang/rust | uncommitted | 10.1 s | 638 ms | 16× | | `ubuntu-latest` | rust-lang/rust | unstaged | 10.0 s | 354 ms | 28× | | `windows-latest` | rust-lang/rust | uncommitted | 45.2 s | 1.05 s | 43× | | `windows-latest` | rust-lang/rust | unstaged | 44.5 s | 444 ms | 100× | ## Testing - `test_diffs_opened_together` opens three uncommitted diffs (index equal to HEAD, index differing from HEAD, untracked) and one unstaged diff in one batch, and checks each buffer's HEAD and index text. - `test_diff_base_loads_fail_when_their_job_is_dropped` drops a queued job and closes the job channel, and checks that its loads and later ones fail instead of hanging. - `test_diff_base_loads_join_only_the_newest_queued_job` checks that two loads share one job, and that a load queued after an index write gets its own job and sees the new index text. - `test_diff_base_load_with_unreadable_revision_fails_alone` makes one HEAD revision unreadable in the fake repository and checks that the other loads, including the index text of the same file, succeed. - `test_diff_base_reload_with_unreadable_revision_fails_alone` reloads three diffs while one HEAD revision is unreadable, and checks that only that file keeps its old bases. - `test_load_revisions_with_ambiguous_head` loads 4,000 `HEAD:` revisions with a `refs/tags/HEAD` ref. Without the stderr change, the test scheduler reports a deadlock after 15 seconds. - `cargo test -p project --features test-support`, `cargo test -p git`, `cargo test -p fs`, `cargo test -p remote_server --lib`, and `./script/clippy -p project -p git -p fs` pass. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - Improved git diff loading when many files open at once, such as in project search results and the Uncommitted Changes and branch diff views |
||
|
|
8c514d28ed |
Add official Snap package for Linux (#66941)
## Summary Closes #9922 Requires https://github.com/canonical/snapcraft/pull/6511. _Mostly_ reviewable but I am still doing QA. The GHA pipeline is a proposal. Snap gets released to the `edge` risk on every `main` commit, then any revision can be manually promoted to other risks, including `stable`. ## Testing ``` snapcraft pack -v sudo snap install ./zed...snap --dangerous --classic ``` ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [ ] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [ ] Tests cover the new or changed behavior. Release Notes: - Added an official Snap package for Linux --------- Co-authored-by: Neel <neel@zed.dev> |
||
|
|
b840e80bf2 |
Bump Zed to v1.31.0 (#67157)
Release Notes: - N/A Co-authored-by: zed-zippy[bot] <234243425+zed-zippy[bot]@users.noreply.github.com> |
||
|
|
9f1c56d6f2 |
gpui: Preserve empty content masks when snapping to device pixels (#67130)
## Summary Fully clipped content can leak a 1px line outside its parent when an empty content mask lies at a fractional device-pixel coordinate. Outward rounding can turn the empty mask into a nonempty region. For example, a zero-height mask with a vertical range of `[181.2, 181.2]` in device-pixel coordinates is expanded to `[181, 182]` by [cover_bounds](https://github.com/zed-industries/zed/blob/96362135eb98a011ac17b56a5c90cf77f9f597f1/crates/gpui/src/window.rs#L3673-L3683), which rounds the top edge down and the bottom edge up. This creates a 1px-tall region where nothing should be visible. This change preserves empty masks before rounding while retaining the existing behavior for positive-area masks, preventing rendering artifacts during fractional scrolling. Possibly related to [#63358](https://github.com/zed-industries/zed/issues/63358), which reports intermittent horizontal rendering artifacts on Linux/Wayland. The symptoms are similar, but this fix has not been tested against that report, so a shared root cause is unconfirmed. In the native Windows screenshots below, the **blue rectangles represent the visible body area (viewport) of a scrollable container**, and the **red rectangles represent its content**. The example positions the content entirely below the viewport, reproducing the state of an item that has been scrolled out of view. - **A — Unclipped reference:** clipping is disabled so the full red rectangle remains visible, showing what is being drawn. - **B — Fractional-coordinate clipping:** the same content should be completely hidden. Before the fix, its top pixel row leaks below the blue viewport as a 1px line; after the fix, it is fully hidden. - **C — Integer-coordinate control:** the content is fully hidden both before and after the fix. | Before | After | | --- | --- | | <img width="1658" height="894" alt="native-upstream-before" src="https://github.com/user-attachments/assets/49943dc9-9f0e-4537-abec-4a03e879c299" /> | <img width="1658" height="894" alt="native-upstream-after" src="https://github.com/user-attachments/assets/7c60f959-46fb-4cf9-b43b-bc4b175bd363" /> | ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - [GPUI] Fixed fully clipped content leaking single-pixel lines outside nested clipping regions. --------- Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com> |