Release Notes:
- Added button tu prevent idle sleep during AI response streaming
**Context / Motivation:**
When an AI agent takes a long time to generate a response, the operating
system might enter an idle sleep (or display sleep) state if there is no
user interaction (mouse or keyboard). This can interrupt the workflow.
This PR aims to prevent the system from sleeping during an active AI
turn by invoking native OS APIs, and provides a UI toggle for users to
control this behavior.
**Key Changes:**
1. **Cross-Platform Idle Sleep Prevention in GPUI (`gpui`, `gpui_*`)**
- Added a new `prevent_idle_sleep` method to the `Platform` trait. It
returns a RAII-based `PreventIdleSleepToken`, which automatically
restores the original sleep policy when dropped.
- **macOS**: Utilizes `NSProcessInfo`'s `beginActivityWithOptions` with
`NSActivityIdleDisplaySleepDisabled`.
- **Windows**: Uses `SetThreadExecutionState` to prevent display and
system sleep, incorporating a reference counter to handle concurrent
requests safely.
- **Linux**: Uses `ashpd` to request `org.freedesktop.portal.Inhibit`
(inhibiting `Idle` and `Suspend` states) via D-Bus.
2. **AI Agent State Integration (`crates/acp_thread`)**
- Introduced idle sleep prevention logic in `AcpThread`: Acquires the
token at the beginning of `run_turn`, and automatically releases it when
the turn completes normally, errors out, or is explicitly canceled by
the user.
- Added comprehensive unit tests to ensure the token is correctly
acquired and released under various cancellation and concurrency
scenarios.
3. **Settings and UI (`crates/agent_settings`, `crates/agent_ui`)**
- Added `AgentOutputIdleSleepControl` to global state.
- Added a new toggle button (screen icon) to the toolbar at the bottom
of the `ThreadView` (AI conversation panel). Users can hover to view the
tooltip and click to toggle the feature on or off.
<img width="419" height="132" alt="截屏2026-04-04 16 09 08"
src="https://github.com/user-attachments/assets/619da9ff-10f7-46e0-b959-d7c74b16b918"
/>
---------
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Co-authored-by: Kirill Bulatov <kirill@zed.dev>
# Objective
- Support opening remote paths from SCP-style SSH URLs that use
bracketed IPv6 hosts, such as `ssh://[2600::]:~/foo`.
## Solution
- Validate SSH hosts with `url::Host::parse`, which supports bracketed
IPv6 addresses while continuing to reject malformed or ambiguous hosts.
- Add test coverage for IPv6 URLs with usernames, home-relative paths,
absolute paths, and explicit ports.
- Add rejection tests for unbracketed IPv6 addresses and ambiguous
port-plus-SCP-path syntax.
## Testing
- Ran `cargo fmt --all -- --check`.
- Ran `cargo test -p zed test_parse_ssh_urls -- --nocapture`.
- Ran `cargo test -p zed test_reject_ssh_urls -- --nocapture`.
- All targeted tests passed on macOS. No additional platform-specific
testing is expected to be necessary because the change only affects URL
parsing.
Release Notes:
- Fixed opening remote paths from SCP-style SSH URLs with IPv6 hosts.
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Closes https://github.com/zed-industries/zed/issues/62262
## Solution
Identical hover responses from multiple language servers should be
displayed only once.
Different hover responses should still all be preserved, since multiple
language servers may provide complementary information.
## Showcase
https://github.com/user-attachments/assets/67246d9f-ed1c-4f5a-98f5-f10548b7fc6d
---
Release Notes:
- Deduplicated identical language server hover responses
---------
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Co-authored-by: zed-zippy[bot] <234243425+zed-zippy[bot]@users.noreply.github.com>
Previously, the `[` and `]` marks always pointed to the yank source
location. After a paste operation, they now correctly point to the start
and end of the pasted text in the destination buffer.
This enables workflows like `v]` to select just-pasted text, and fixes
the `gp` keymap pattern shown in the issue.
Closes https://github.com/zed-industries/zed/issues/56404
Release Notes:
- vim: Made `[` and `]` marks point to the start and end of pasted text
after a paste operation.
---------
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Co-authored-by: Tom Houlé <tom@tomhoule.com>
Release Notes:
- Fixed remote support for adding paths to .gitignore
The problem solved by this PR is: when opening a remote project,
right-clicking a new file in the git panel and clicking "Add to
.gitignore" does not work.
---------
Co-authored-by: Cole Miller <cole@zed.dev>
Release Notes:
- Fixed clear drag overlay when external drag ends outside window
When dragging files from macOS Finder over the project panel and then
dragging back to Finder, the drag overlay remained visible because the
drag state was not properly cleaned up.
The root cause was that only `draggingExited:` was handled, but not
`draggingEnded:`. On macOS:
- `draggingExited:` is called when the drag leaves the window area
- `draggingEnded:` is called when the drag operation ends entirely
When a user drags a file back to Finder and drops it there,
`draggingEnded:` is called but was not being handled.
---------
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Enable the command palette picker scrollbar while preserving the
one-shot reopen behavior.
---
Release Notes:
- N/A or Added/Fixed/Improved ...
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
# Objective
This change prevents users from starting multiple Git remote operations
at the same time from the Git panel. Fetch, pull, and push can take
time, may prompt for credentials, and can update shared repository
state, so allowing repeated clicks can create duplicated work, confusing
UI feedback, or overlapping Git commands.
## Solution
The panel now records when a remote operation is in progress, disables
the main remote action button, and shows a clear tooltip such as “Push
in progress.” When the async task exits, the state is cleared and the
button is re-enabled. This keeps the UI aligned with the operation
lifecycle and makes repeated clicks harmless.
---
Release Notes:
- Git: Improved performance by not allowing multiple remote Git
operation to start at the same time.
---------
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
Share marked selections across rendered project panel entries and defer
drag-related path cloning until drag and drop rendering is enabled. Also
defer symlink path string conversion until tooltip creation.
Release Notes:
- N/A or Added/Fixed/Improved ...
# Objective
fix `cargo xtask web-examples --no-serve` error.
## Solution
Building GPUI web examples for wasm failed because gpui's ordinary
dev-dependencies were included in the wasm build graph. That pulled in
proptest's default fork/timeout support, which depends on wait-timeout.
wait-timeout does not support wasm32-unknown-unknown, so compilation
failed.
The a11y example also had a wasm_bindgen start function but was missing
the wasm no_main crate attribute, so Rust still expected a normal main
function and emitted E0601.
Move gpui's proptest dev-dependency behind the non-wasm target so web
example builds do not include native-only test timeout support. Add the
wasm no_main crate attribute to the a11y example.
Verified with:
```
cargo tree --target wasm32-unknown-unknown -p gpui -i wait-timeout
cargo xtask web-examples --no-serve
```
---
Release Notes:
- N/A or Added/Fixed/Improved ...
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Clip split buffer headers to the editor's content bounds so they no
longer paint into the horizontal scrollbar area.
Reuse the editor's computed right margin and horizontal scrollbar
visibility instead of reimplementing scrollbar detection in
split_editor_view. This keeps split headers aligned when minimap, inline
blame, or scrollbar visibility change the available content area.
Release Notes:
- Fixed horizontal scrollbars not being rendered behind buffer headers
in split editors
---------
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Co-authored-by: dino <dinojoaocosta@gmail.com>
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 https://github.com/zed-industries/zed/issues/58153
Release Notes:
- Agent: Fixed image previews not being displayed after submitting a
prompt and then hovering the mentioned image.
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
Release Notes:
- N/A
When importing settings from VS Code, the minimap is now enabled by
default (matching VS Code's behavior) even if the user hasn't explicitly
set minimap-related options in their VS Code settings.json.
Previously, if `editor.minimap.enabled` and `editor.minimap.autohide`
were absent from the VS Code config, Zed would leave minimap at its own
default ("never"). Since VS Code defaults to minimap on, this caused a
mismatch for users expecting their VS Code experience to carry over.
Closes#56297
Release Notes:
- Fixed apply VS Code minimap default when importing settings
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
When shift is held during a single click, extend the existing selection
from its anchor point to the clicked position instead of starting a new
selection.
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
Release Notes:
- Added markdown support shift+click to extend text selection
Registry archive agents install each version into a versioned cache
directory, but older extracted archives were left behind after updates
and
could accumulate disk usage.
After resolving the current archive cache directory, remove other
versioned
cache directories for the same registry agent while preserving the
current
version.
Release Notes:
- Fix certain ACP registry agents not cleaning up old versions
---------
Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
Release Notes:
- Added support for opening a file with a line range selected in the
file finder using the `path:start-end` syntax (e.g. `file.rs:10-20`).
---------
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
Use `future::join` when loading index and committed text for buffer diff
bases, while keeping skipped loads as ready None futures.
Release Notes:
- N/A
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Build split text directly from Arc<str> slices instead of allocating
intermediate Strings. Reuse the original SharedString for full-line
splits, return a static empty string for empty sides, and add a
regression test covering boundary splits.
Release Notes:
- N/A
---------
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Release Notes:
- Added git panel support select all and deselect all check box
---------
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
This adds an eye icon button to the right of the password input field
when connecting to a remote device, allowing users to toggle the
visibility of the typed password. The toggle defaults to masked and only
appears for actual password prompts, avoiding yes/no confirmations.
After modification, an eye button has been added:
https://github.com/user-attachments/assets/76fb5a89-0aa3-4017-b050-d6bb9c2ad4a8
---
Release Notes:
- Added a toggle to control password visibility when connecting to a
remote project.
---------
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
Ensure that the `vim::visual::Vim::visual_block_motion` method is called
when `scroll_editor` is called while in Visual Block mode. This fixes an
issue where, after getting into `Visual Block` mode, if the user used
`ctrl-d` or `ctrl-u` to scroll half of the page, the wrong selection
would be made and, if `shift-i` was used to start inserting at the start
of the line, a single cursor would be placed at the cursor position
where the selection was started, instead of one cursor per each of the
selected lines.
These changes ensure that we now match Neovim's behavior for the same
flow.
---------
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Co-authored-by: dino <dinojoaocosta@gmail.com>
Release Notes:
- Fixed send failure for pasted file#line mention links
Handle `MentionUri::Selection` with a file path in
`confirm_mention_for_uri`
by resolving it to text content via existing line-range loading logic,
instead
of returning "Unsupported mention URI type for paste".
Keep untitled-buffer selections (`abs_path: None`) as an explicit
unsupported
error for now.
Add a regression test for pasting selection mentions to ensure they
resolve to
`Mention::Text` with the expected line range.
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Release Notes:
- N/A
The WASI-SDK is several hundred megabytes in size; using streaming
downloads is network-friendly and can reduce memory usage.
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Release Notes:
- Fixed prevent shell command injection in conda environment activation
The conda environment name was directly interpolated into the shell
command without proper escaping, which could allow command injection
if the environment name contained malicious shell metacharacters.
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Closes#47007
Release Notes:
- Fixed await config worktree before opening settings.json
ensures that the worktree creation is awaited before attempting to open
the settings file.
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Previously, when an MCP server returned a tool response with
`is_error: true`, the error content was incorrectly treated as
a successful result. This could mislead the LLM into thinking
the tool call succeeded when it actually failed.
Now we check the `is_error` flag and propagate the error message
properly, allowing the agent to handle failures appropriately.
Release Notes:
- N/A
---------
Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
Release Notes:
- Agent: Improved the "Copy Selection" right-click menu item by
disabling it when there are no selections.
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Release Notes:
- N/A
Avoids iterating through all registered actions when looking up a single
action's schema in json_schema_store.
---------
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Release Notes:
- Improved Display the actual Windows error message when writing
credentials to Credential Manager fails, instead of the generic "Failed
to write API key to keychain" message. This helps users diagnose issues
like permission problems.
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Release Notes:
- git: Added the ability to copy a commit's SHA in the commit view.
---------
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
The change simplifies the `max_token_count` and `max_output_tokens`
methods by grouping Gemini models with identical token limits.
Release Notes:
- N/A
Release Notes:
- Fixed double slash in commit URLs
The github_url variable was generating URLs with an extra slash like
"https://github.com//user/repo/commit/xxxx" due to manual string
formatting
of the base_url() result.
Fixed by replacing manual URL construction with the proper
build_commit_permalink() method that uses Url::join() for correct
path handling, consistent with how other Git hosting providers
construct URLs.
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
The WM_DPICHANGED suggested RECT is calculated for non-maximized
windows. When a maximized window's DPI changes, we now query the
monitor's work area directly to ensure the window correctly fills the
entire screen.
For non-maximized windows, the original behavior using the
system-suggested RECT is preserved.
Release Notes:
- windows: Fixed maximized window size when DPI scale changes
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Escape special characters (&, <, >, ", ') in the title attribute of
TextThreadContext's XML output to prevent malformed XML when titles
contain these characters.
Resolves TODO at context.rs:629
Release Notes:
- N/A
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
Replace the binary search approach with a more efficient partition_point
method for checking selection overlaps. This eliminates the need to
collect and sort selection ranges separately, reducing memory allocation
and improving performance when handling multiple selections.
Release Notes:
- N/A
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Refactor the find_tab_group method to use the question mark operator for
cleaner error handling, replacing the explicit if-else pattern with a
more concise chained approach.
Release Notes:
- N/A
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Fix issue where Zed would unconditionally override user's custom shell
with system default from passwd entry.
Closes https://github.com/zed-industries/zed/issues/40171
Release Notes:
- Fix issue where Zed would unconditionally override user's custom shell
with system default from passwd entry.
---------
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Replace O(n²) linear search with O(log n) binary search for checking
selection overlaps when finding next selection range. Pre-sort selection
ranges and use binary search to significantly improve performance when
working with many selections.
Release Notes:
- N/A
---------
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Use path! macro for platform-specific path formatting in test
assertions, fixing hardcoded Unix-style paths that failed on Windows.
Release Notes:
- N/A
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Using `crate::command::new_smol_command` on the Windows platform will
not display the PowerShell window.
Closes#39052
Release Notes:
- N/A
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Fixes the "failed to get working directory environment for repository"
error on Windows by implementing proper shell environment variable
capture.
Release Notes:
- Fixed failed to get working directory environment for repository
---------
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
The edit prediction button menu was displaying stale authentication
status due to capturing the Copilot status in a closure. After signing
out, the menu would still show "Sign Out" instead of "Sign In to
Copilot".
This change fixes the issue by reading the current Copilot status each
time the menu is displayed, ensuring the menu options are always
accurate.
Release Notes:
- Fixed Copilot AI menu not updating after sign out
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>