mirror of
https://github.com/zed-industries/zed.git
synced 2026-12-02 13:30:26 +01:00
d0400aaf033a703a037f8fe5400bbc896db985da
3473 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
cb48e27ceb |
project: Prefer musl builds of ACP registry agents on musl Linux hosts (#66914)
The ACP registry now optionally publishes `linux-{arch}-musl` targets.
On a musl host (e.g. Alpine), Zed now picks that target and falls back
to `linux-{arch}` when an agent doesn't publish one.
The host libc is detected at runtime rather than with `cfg!(target_env =
"musl")`: the Linux remote server is a static musl binary that mostly
runs on glibc hosts, and the desktop build is glibc.
- Move the libc probe from the rust-analyzer adapter into
`util::libc_type::host_libc_type()` and cache the result for the process
lifetime.
- Also read `ldd --version` stderr, which is where musl prints its
version. Previously musl hosts were only detected through the `/lib`
scan.
- Use one ordered list of registry platform keys for both the "supported
on this platform" check and the archive selection, so the registry UI
and the installer agree.
Closes #66850
Release Notes:
- Improved ACP registry agent installation on musl-based Linux systems
to use musl builds when available
|
||
|
|
4fd48c02ac |
Miscellaneous improvements to prepare for Rust 1.100 (#66901)
## Summary Fixes rustc and clippy warnings for a potential upcoming Rust 1.100 version bump. All changes are backwards compatible and Rust is **not** bumped in this PR. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - N/A - [GPUI] N/A --------- Co-authored-by: Finn Evers <finn.evers@outlook.de> |
||
|
|
eda58e5040 |
Keep history of unchanged tasks on tasks file updates (#66646)
Closes https://github.com/zed-industries/zed/issues/52659 Release Notes: - Fixed task rerun opening task spawn menu after any tasks.json edit |
||
|
|
f99c53f4f6 |
Restore the last session when Zed is started by opening a path (#65463)
Closes #4848 Closes #57305 ## Summary On Windows and Linux, starting Zed by opening a file or folder (Explorer "Open with Zed", a file manager, `zed <path>`) skipped session restoration. The new session then replaced the old one, so its windows, tabs and unsaved buffers were lost. macOS does not have that bug: there the request arrives after the restore has started. Now such a start first restores the local windows of the last session, for at most 5 seconds, then handles the request with the same code as before. The request's window is created last, so it ends up in front. - **A file opened without a CLI environment** (Explorer, a file manager, the desktop entry) becomes a tab in its project's window, or in the front window, as when Zed is already running. A file that has a saved window of its own reopens that window instead. - **Any other path request** (a file from a terminal, a folder, `-n`, `-a`, `-r`, `--diff`, `--dev-container`) opens in its own window, as before. A saved window with the same folders (a folder inside another one is folded into it), or of the same repository, is left to the request and kept out of the sidebar of the other restored windows. - Remote requests, `zed://` links, channel links and `--wait` requests are handled as before, without restoring. Two changes in `workspace` come with it: - A window restored by such a start can still be loading its tabs while the user works in it or quits. Until it has finished, saving it writes the layout it is restoring plus a pane with what was opened in it meanwhile, and tabs opened in it are kept when the saved tabs arrive. Every other restore takes the same code path as before. - `Workspace::open_paths` returned the opened items sorted by path, not in the order the paths were given, so several file links with positions opened into one existing window could each get another file's line. Such a start now reaches that code, so it is fixed here. Known limits: - The requested path appears after the session's windows, at most 5 seconds later, and requests that arrive during startup wait for it. - A saved window that has not opened within the 5 seconds is not restored by this start; a bare `zed` in the same run restores it. - A path start does not restore remote windows. - A window still loading after the 5 seconds finishes behind the request's window. Until then its saved state wins over what is done in it: a saved unsaved draft replaces newer text of the same file (typed, or saved to disk), a bookmark or breakpoint removed from a saved row comes back, dock changes are not saved, and `--wait` on a file among its saved tabs returns when the saved tab takes its place. A new tab whose id equals a saved tab's id replaces that tab in the saved layout. ## Testing 50 new tests. The startup tests run each kind of request against a saved session: files joining a restored window (also file links with positions), files and folders getting their own window with the CLI environment, `-n` and `-r`, saved windows and sidebar projects left to the request (also through a symlink, with a nested folder, and for a linked worktree), remote windows, bare CLI, link and `--wait` requests, and the 5-second limit ending in each phase. The restore tests cover a window that is still loading: quitting keeps its saved tabs, docks, bookmarks and breakpoints together with what was added meanwhile; a tab opened in it survives, a file among the saved tabs gets one tab, pinned tabs stay in place, the tab in use stays selected; an ordinary start is unchanged. Manual check: 1. Set `"restore_on_startup": "last_session"`. 2. Open a folder with two tabs and an untitled buffer with text, then quit. 3. With Zed closed, open a file inside that folder from the file manager: the folder window comes back with its tabs and the untitled text, and the file is a new tab. 4. Quit and run `zed /another/folder` in a terminal: that folder is in front and the first window is restored behind it. ## Self-review - [ ] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). (No UI changes.) - [x] Tests cover the new or changed behavior. Release Notes: - Fixed opening a file or folder while Zed is closed not restoring the last session on Windows and Linux, which caused previously open windows, tabs and unsaved buffers to be lost. Co-authored-by: Kirill Bulatov <kirill@zed.dev> |
||
|
|
b6ff193ba6 |
Stop showing worktree trust modal after "Stay in Restricted Mode" is called (#66649)
Closes https://github.com/zed-industries/zed/issues/58246 * Starts to remember "Stay in Restricted Mode" calls to avoid repeated worktree trust pop-ups * Uses `RemoteConnectionIdentity` instead of the prior type (removed) as more detailed remote host identifier (has a port value now) * Migrates worktree trust DB to that, more detailed, data format Release Notes: - Stopped showing worktree trust modal after "Stay in Restricted Mode" is called |
||
|
|
5014e5b302 |
Update ACP SDK to 5.2.0 and adopt schema 1.17 additions (#66832)
Updates `agent-client-protocol` to 5.2.0 (schema 1.17.0) and adopts its new additions. - **Session references in tool call content.** `ToolCallContent::Session` (unstable subagents) used to render as "Unsupported tool call content." for v2 agents and was dropped for v1 agents. It now renders as an "Open Session" link that switches to the referenced session, labelled the same way as session-message participants. Because references are display-only, sessions Zed doesn't know about show as "Unavailable Session" and aren't loaded. - **Saved config defaults sent inline with `session/new`, behind the ACP beta flag.** If the agent advertises `sessionCapabilities.options`, Zed now sends the user's saved config defaults in the session-creation request (`configOptions`) instead of only applying them one `session/set_config_option` call at a time afterwards. This covers v1 and v2. `session/options` is still a draft, so this only happens with `acp-beta` enabled. The existing one-at-a-time pass still runs after creation: it sends nothing when the agent already applied everything, and it still catches defaults the agent skipped (for example, one that depends on another option's value). - The `session/options` request itself is not used yet. - `AuthAccount.description` is not adopted, because Zed doesn't use auth status. Release Notes: - N/A |
||
|
|
82f2558e17 |
Stream directory check instead of joining all futures (#66830)
Refactors some code a bit I found during triaging - primarily changes the is_dir check so that we stop on the first directory found as opposed to awaiting all futures, then also get's rid of converting paths to pathbufs to just then use them by ref again. Release Notes: - N/A --------- Co-authored-by: tidely <43219534+tidely@users.noreply.github.com> |
||
|
|
912159c7ad |
git_ui: Disambiguate repository names in the repository selector (#62800)
The repository selector and the Git panel footer both label a repository with the leaf name of its working directory. In a workspace where every project is checked out into a directory of the same name, every row reads the same. Related to #56255 (discussion) and #56265, which proposed always prepending the parent directory. The review there raised that this adds noise where the leaf name is already unique, example `Developer/foo` and `Developer/bar` gain nothing from it. This PR takes a different approach suggested in that thread. ## Solution Add `disambiguated_display_names`, which labels each repository with its leaf directory name where that is already unique across the workspace, and grows only the colliding labels by one parent component at a time until they are distinct. Repositories whose names never collide are unchanged. ## Testing - `cargo test -p project --lib git_store::tests::test_disambiguated_display_names` — passed. Covers unique leaves being left alone, single-parent disambiguation, the multi-parent case, identical paths, and empty input. - `./script/clippy` — passed. - `cargo fmt --check -p project -p git_ui` — passed. - `cargo build` — passed. - Manually tested on macOS with a debug build, on a workspace of 12 repositories: a meta-repository, five submodules checked out as `src`, two nested `proto`, two nested `protos`, and two uniquely named ones. Reviewers can reproduce it with any tree that nests several repositories into same-named directories. Not tested on Linux or Windows. ## 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 - [ ] Performance impact has been considered and is acceptable ## Showcase I created a stub project and build and ran the development build, replicating my project structure that I used where I did ran into the "issue". This is a before and after comparison. <img width="965" height="863" alt="before-and-after" src="https://github.com/user-attachments/assets/8775c643-f3ee-41ac-a2b3-fba991990a8e" /> --- Release Notes: - Improved the Git Panel’s repository selector to distinguish repositories that share the same directory name. --------- Co-authored-by: Josia Aranda <josiaranda@users.noreply.github.com> Co-authored-by: dino <dinojoaocosta@gmail.com> |
||
|
|
a1f2e21c2c |
project: Fall back to whole-repo git scan when many paths changed (#66242)
`git status` and `git diff` match every pathspec against every index entry, so scoped refreshes cost roughly paths x index entries. On a 573k-entry repository, 1000 paths took ~3s per command (CPU-bound across preload threads) while a whole-repo scan takes ~0.13s for diff and ~1s for status. Break-even is around 100-200 paths. When more than 64 changed paths are pending, scope the refresh to the repository root instead, which also makes the stale-entry removal walk the whole previous snapshot. Partially addresses #41054. ## Summary `Repository::paths_changed` refreshes git status and the three `git diff --numstat` variants for the file paths the worktree reported as changed, passing them as pathspecs. Git matches every pathspec against every index entry with no pruning. The cost is roughly (pathspecs × index entries), and it is paid on every command. On large repositories the scoped refresh gets slower than a whole-repo scan once there are more than ~100 paths. Many paths arrive in one batch after a branch switch, a rebase, a build writing into the worktree, or the initial worktree scan. In a 573k-file repository this pegs several CPU cores for seconds to minutes and delays the Git panel and project diff. This change caps the number of scoped paths. When more than 64 coalesced paths are pending, the refresh is scoped to the repository root, equivalent to a whole-repo scan (the same `.` pathspec `compute_snapshot` already uses). The stale-entry removal loop in `paths_changed` then walks the whole previous snapshot, so entries that disappeared are still removed. Below 64 paths nothing changes, so the common single-file save keeps its fast scoped refresh. ### Why 64 Chromium checkout (573,523 tracked files), median of 3 runs, seconds: | paths | diff HEAD | diff --cached | diff index→worktree | status | |---|---|---|---|---| | 0 (whole repo) | 0.32 | 0.09 | 0.30 | 1.21 | | 1 | 0.04 | 0.03 | 0.03 | 0.15 | | 10 | 0.06 | 0.03 | 0.05 | 0.18 | | 50 | 0.15 | 0.04 | 0.13 | 0.34 | | 100 | 0.26 | 0.07 | 0.50 | 0.56 | | 200 | 0.46 | 0.05 | 0.46 | 0.97 | | 1000 | ~3–17 | | | ~6 | | 5000 | ~15–59 | | | ~34 | Break-even is around 100–200 paths. 64 keeps the large win for small changes (status is about 8x faster with 1 path than without) while staying clear of the quadratic region. Timings vary between runs, so treat them as ratios (my first 1000-path `diff HEAD` took 17s and later runs about 3s). ### Root cause I profiled git (master, 2.56) built with `-pg` and with perf on `git diff --numstat HEAD` with 1000 pathspecs on the Chromium checkout: - 94% of CPU is in `do_match_pathspec` (`dir.c`), called ~1.01M times (about twice per index entry). - The callers are `oneway_diff()` (`diff-lib.c`) inside `unpack_trees`, and the `preload_index` threads. - `do_match_pathspec` loops over all pathspec items for every entry. There is no early exit, sorting or hashing, and 99.8% of entries match nothing. - Cost is ~2.5 ns per item check, which predicts the measured numbers (~12.7s CPU for 5000 paths). - fsmonitor doesn't avoid this: `oneway_diff` has no fsmonitor shortcut, and I measured the same pathspec cost with fsmonitor on and off. - I found no upstream git issue or patch for this. ## Testing - Added unit test `limit_repo_paths_falls_back_to_root_above_threshold`. It checks that exactly 64 paths are kept and 65 collapse to the repo root. - Benchmarked the exact git commands invoked by Zed (table above) on the Chromium checkout on Linux. ## 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 status refresh performance in very large repositories when many files change at once |
||
|
|
5e23b6e71d |
Open single files inside the same window (#66103)
Part of https://github.com/zed-industries/zed/issues/55726 Closes https://github.com/zed-industries/zed/issues/55893 https://github.com/user-attachments/assets/3926b9a1-019b-4c37-bcfc-0d5a0e30146b Release Notes: - Fixed single file opening ergonomics |
||
|
|
94f3eb1b72 |
Bookmark picker (#60005)
# Objective - Add a picker for bookmarks to view all bookmarks in the workspace, with support for filtering, previewing, opening files and jumping to corresponding positions. ## Solution - Add a picker delegate and related actions to pop up a picker modal displaying the bookmark list upon trigger - Display the label of the bookmark, its file path and line number. If the bookmark label is empty, use the text on the line where the bookmark is located as the label. - Support enabling preview to view surrounding code of bookmarks simultaneously - Open the preview tag and reuse the existing tab pane on primary confirm; open a separate tab pane on secondary confirm - Design distinct result display layouts for horizontal and vertical modes to prevent excessive text truncation ## Testing - Conducted manual testing - Added two test cases ## 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 https://github.com/user-attachments/assets/4126fec0-0177-4f05-8cd8-738e6c358164 ## Current Limitations - The current picker does not provide initial layout information to its delegate. If it is opened in horizontal mode initially, the result list will render in vertical mode, causing severe text truncation. This issue should be straightforward to resolve with minor adjustments to the picker-related code. #60007 - The current preview highlights bookmark rows by matching the full line of text, which results in an unappealing visual effect. It would be preferable if the picker code could support full-row highlighting natively in a future update. --- Release Notes: - Added a picker to show all bookmarks inside current workspace |
||
|
|
e231594b6b |
git: Add date format and per-view date style settings (#66533)
## Summary resolves #15272, take 2 of #58950 tl;dr: add following options: ```json { "git": { "date_format": "locale", // "locale" (default), "iso", or a strftime format like "%Y-%m-%d %H:%M" "blame": { "date_style": "relative" }, "inline_blame": { "date_style": "relative" }, "branch_picker": { "date_style": "relative" }, "stash_picker": { "date_style": "relative" } }, "git_panel": { "date_style": "relative" }, "git_graph": { "date_style": "absolute" } } ``` design per https://github.com/zed-industries/zed/pull/58950#issuecomment-6017682621, also pinging @smitbarmase per request ## Testing screenshots are taken on fedora linux 44 + kde plasma 6.7.5 <img width="2560" height="1440" alt="image" src="https://github.com/user-attachments/assets/0784f1f7-0e00-4be5-893d-775d617b33e4" /> <img width="1125" height="937" alt="image" src="https://github.com/user-attachments/assets/7ae6c876-3a93-4876-a151-85632d54d982" /> <img width="1407" height="340" alt="image" src="https://github.com/user-attachments/assets/2178804a-444b-4613-9024-3700b15e0cfe" /> changed each config values `Date Format {locale/iso/strftime} x Date Style {relative/absolute}` and they all seem to work without issues also, invalid date format will default to `locale` (with an warning log like below) ``` 2026-11-05T00:14:08+09:00 WARN [project::project_settings] Invalid git.date_format: invalid component name `Q` at byte index 1 ``` ## 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 `git.date_format` and per-view `date_style` settings for git dates --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com> Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com> |
||
|
|
ddc9eda925 |
git_ui: Show changes since a base branch in the git panel (#66482)
Closes #66458 Closes https://github.com/zed-industries/zed/discussions/48185 Closes https://github.com/zed-industries/zed/discussions/66301 Closes https://github.com/zed-industries/zed/discussions/65750 Follow-up to #66461 The Changes header has a new menu button with two options: - Uncommitted shows your staged and unstaged changes, same as before. It's the default. - Compare Against Base opens a submenu with a branch picker. Pick a branch like `origin/main` and the panel switches to branch mode, listing every file your branch changed since then. The button then reads `Since origin/main`. What changed: - Clicking a file opens its diff against the base and scrolls to it. If a diff tab for that base is already open, it reuses it. - List and tree view and sorting work the same as in Uncommitted mode. - Switching bases shows a loading state until the new base's files load. - The "View Branch Diff" button in the empty state now also switches the panel to branch mode. In a repo with no default branch it used to open an empty diff. It now asks you to pick a base first. - Uncommitted mode remains the same as before. Some calls I made: - In this mode action like staging does not really make sense so rows are read-only. One row can have both committed and uncommitted changes. You can still open diffs, copy paths and commit. - In branch mode the base branch follows the active branch diff tab base branch, like outline panel. It doesn't work the other way. You can have several diff tabs open against different bases, and the panel can't know which one you'd want to change, so picking a base in the panel only changes the panel, and you will have to click "View Diff" next. https://github.com/user-attachments/assets/66a9ee24-f8bc-4c5d-a984-b5d2f280f9f4 Left for follow-ups: - Line counts like `+12 -3` on branch rows. - Moving the History tab's state into its own type, like branch mode has here. `GitPanel` holds state for every tab and mode in one struct, so changing one part tends to touch the others. - The branch filter button in the submenu picker is hidden on purpose. There is some gpui/ui fixes needs to render tooltip and its popover over this new embedded view. I'll fix that separately. Release Notes: - Added a branch mode to the git panel that lists all files changed since a base branch, such as `origin/main`. |
||
|
|
d71ff73440 |
tasks_ui: Fix tasks with file variables missing for single-file worktrees (#66195)
## Summary When a single file is opened without a folder (e.g. via `ctrl-o`), it gets a worktree whose root is the file itself. `task_contexts` only built the editor context for items from worktrees rooted at a directory, so variables like `ZED_FILE` were never set. Tasks referencing them, including global tasks from `~/.config/zed/tasks.json`, failed to resolve and were silently dropped from `task: spawn`. Tasks without variables were still listed, which made the bug look inconsistent. This PR: - builds the editor context for any active item with a project path, while keeping the worktree context limited to directory worktrees (as introduced in #25605); - makes `BasicContextProvider` set `ZED_WORKTREE_ROOT`, the relative path variables and the default cwd only for visible directory worktrees, so they don't point at the file itself or at an unrelated directory such as the Zed config directory; - moves the task picker's source-aware context selection into `TaskContexts` and uses it when spawning tasks by name or tag, so worktree tasks are resolved against their own worktree even when an external file is active; - gives items outside of visible directory worktrees (e.g. the global `tasks.json` opened via `zed: open tasks`) the visible project's `ZED_WORKTREE_ROOT` and cwd, preserving the behavior from #55727, and keeps only their file and cursor variables, so nothing derived from their own worktree (relative paths, git repository, language-provided values such as Python test targets) leaks next to the project's root; - uses the first visible directory worktree, skipping single-file ones, as the active worktree when the active item is not in a visible directory worktree, so the fallback above and the worktree context still apply when a standalone file was opened before a folder was added to the project. As a side effect, language tasks (e.g. Python runners) now also show up for single-file worktrees, since the active location is no longer dropped. Closes #66148 ## Testing - Added `test_single_file_worktree_provides_file_context`: the item context of a single-file editor contains `ZED_FILE`, has no `ZED_WORKTREE_ROOT` and no `cwd`. - Added tests that spawn a worktree-local task by name, or rerun it with `reevaluate_context: true`, while a file-backed external editor is active (single-file and invisible directory worktrees): the task resolves against its own worktree and doesn't get the external file's `ZED_FILENAME`. - Added `test_spawn_by_name_resolves_global_task_with_global_tasks_file_editor_active`: with a file-backed global `tasks.json` editor from an invisible worktree active, a global task gets the visible project's root and cwd, keeps `ZED_FILENAME` and has no `ZED_RELATIVE_FILE`. - Added `test_spawn_by_name_resolves_global_task_with_single_file_worktree_listed_first`: the same check with a visible single-file worktree listed before the visible directory worktree. - Extended `test_external_item_context_does_not_carry_its_worktree_environment`: an external item's `ZED_MAIN_GIT_WORKTREE` and language-provided variables don't reach global tasks. - Added `test_spawn_by_name_does_not_use_language_targets_derived_from_external_relative_path`: with the built-in languages registered and a Python file from an invisible worktree active, the real `PythonContextProvider` derives a relative `ZED_CUSTOM_PYTHON_TEST_TARGET` for the editor, but a global `pytest` task spawned by name gets the `.` default and the visible project's cwd. - `cargo test -p tasks_ui` and task-related tests in `project` pass. - Manually reproduced on Linux before the fix: with global tasks using `$ZED_FILE` and a task without variables, only the latter was listed for a file opened via `ctrl-o`, while both were listed with a folder opened. - Manually verified on Linux after the fix: global tasks using `$ZED_FILE` are listed and run for a file opened via `ctrl-o`. - `./script/clippy` passes. To test: add a global task with `"command": "echo $ZED_FILE"`, open a file via `ctrl-o` in an empty window, run `task: spawn`. ## 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 tasks that use file variables such as `$ZED_FILE` not being listed in `task: spawn` when a single file is opened without a folder. |
||
|
|
784374c679 |
remote: Fix Windows SSH commands when the default shell is Nushell (#65580)
## Summary Closes #65575 When connecting over SSH to a Windows remote server, Zed forwards commands that need to be executed (for example terminals and tasks) through `ssh`. The logic lives in `build_command_windows()` in `crates/remote/src/transport/ssh.rs`. The command built on the client looks like this: ``` ssh -t <remote_server> powershell -E <command_base64> ``` Zed passes `powershell -E <command_base64>` to `ssh` as the remote command. The Windows OpenSSH server appends it as-is to `<ssh_remote_shell> <shell_command_option>`, so the command that actually runs on the remote server is: ``` <ssh_remote_shell> <shell_command_option> powershell -E <command_base64> ``` For `cmd.exe`, which is the default Windows OpenSSH server shell, the final command is: ``` cmd.exe /c powershell -E <command_base64> ``` This works fine. However, if the default shell is changed to `nu`, the final command becomes: ``` nu -c powershell -E <command_base64> ``` Here `nu` treats `powershell` as the only command to execute and passes `-E <command_base64>` to itself as flags. `-E` is not a flag of `nu`, so we get the following error: ``` The nu command doesn't have the flag '-E' ``` To fix this, the command is now wrapped in literal quotes when it is sent, so that the command line executed on the remote server becomes: ``` <ssh_remote_shell> <shell_command_option> "powershell -E <command_base64>" ``` This way, `powershell -E <command_base64>` is always interpreted as a single command, regardless of the shell. ## Testing I checked the process creation on the Windows remote with Procmon: - Before the change, `nu` was launched as `nu -c powershell -E <command_base64>`. - After the change, it is launched as `nu -c "powershell -E <command_base64>"`, which runs successfully. I also manually tested `nu`, `pwsh`, `powershell`, and `cmd` as the Windows OpenSSH server default shell. Terminals and tasks work correctly with all of them. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [ ] Tests cover the new or changed behavior. Release Notes: - Fixed the remote terminal and tasks failing on Windows SSH servers whose default shell is Nushell |
||
|
|
ba36af2050 |
Revert "Reduce waits for navigation, suggestions, and file comparisons (#66487)" (#66517)
This reverts commit
|
||
|
|
7e7311ad20 |
Reduce waits for navigation, suggestions, and file comparisons (#66487)
# Objective Reduce waiting when navigating code, loading details for code suggestions, and comparing files. Zed currently starts some independent file reads and requests only after the previous one finishes. ## Solution - Load up to 16 definition or reference results at once. Keep their original order. Repeated results for the same file share one read and one open copy of the file. - Request details for up to 16 code suggestions at once. Repeated item indexes produce one request. Successful items still update if one request fails. Keep the checks that each language server supports the request. - Read both sides of a file comparison together. Load up to 16 comparison pairs at once, while keeping their display order. - Add controlled-delay tests. Saved file contents and the text ranges returned by navigation stay the same. ## Testing On current `main` at `8a47b35109`: - 748 tests passed across `project`, `git_ui`, and `git_ui_core`. Four tests were already ignored. Each suite ran one test at a time. - Seven timing and behavior tests passed across 100 task execution orders each: 700 runs. They check result order, repeated files and suggestions, the request limit, errors, and cleanup. - Required `./script/clippy` passed for all three packages, with all targets and all features. Its dependency check also passed. The check used no debug symbols and `profile.release.opt-level=0` to limit build storage. - Formatting and `git diff --check` passed. The original checkout measured the following controlled delays. The port to current `main` passes the same 40 ms checks: | Operation | Before | After | | --- | ---: | ---: | | Go to definition across three unopened files | 120 ms | 40 ms | | Find references across three unopened files | 120 ms | 40 ms | | Load details for three code suggestions | 120 ms | 40 ms | | Open one file comparison | 80 ms | 40 ms | | Open three file comparisons | 240 ms | 40 ms | Each independent read or request has a deliberate 40 ms delay. These results prove reduced waiting in these cases. They do not establish a whole-application speed improvement. Remote network performance and the best concurrency limit for each machine remain unmeasured. The earlier checkout also passed all five checks in a clean-built macOS app. Those built-app checks predate this port. They are separate from the current-main checks above. Reviewers can run the focused tests with: ```sh ITERATIONS=100 cargo test -p project -p git_ui -p git_ui_core --features project/test-support concurrently -- --nocapture ``` ## Self-Review Checklist - [x] Reviewed the changes for correctness and cleanup of completed or failed work - [x] Added tests for the changed behavior and measured waiting time - [x] Kept result order and bounded active work ## Suggested .rules additions Proposed text for the project test guidance, for review in a separate rules change: > In GPUI tests that check the release of invisible worktrees, drop the final buffer handles inside `cx.update(...)`, then check the remaining worktrees. `run_until_parked()` alone does not flush deferred entity releases. Release Notes: - Improved responsiveness when navigating code, loading completion details, and comparing files. |
||
|
|
e38d4ec980 |
Fix active repository selection after removing remote worktrees (#66299)
Removing a project folder containing the active Git repository from a remote workspace could leave the Git panel showing “No Git Repositories” and an “Initialize Repository” button, even when other Git repositories remained open. Select a remaining repository when the active repository is removed. Preserve the current selection when removing another repository, and clear it when the last repository is removed. Testing: - Added a regression test covering removal of an inactive repository, the active repository, and the last repository. - Confirmed the regression test fails before the fix and passes afterward on Windows. - Passed the existing remote worktree add/remove/re-add test. Release Notes: - Fixed the Git panel showing “No Git Repositories” after removing the active repository's project folder from a remote workspace while other repositories remain open. --------- Co-authored-by: dino <dinojoaocosta@gmail.com> |
||
|
|
1d76f828ee |
Fix SVG images in remote Markdown previews (#66404)
## Summary <img width="3024" height="1898" alt="zed-svg-ssh-after" src="https://github.com/user-attachments/assets/d35454cc-9d27-4165-900a-00990f483e4e" /> Closes #64517 Fixes SVG images failing to display in remote Markdown previews by adding content-based SVG support to ImageStore and using the existing GPUI renderer. ## Testing - Integration tests and Clippy passed. - Manually verified with a macOS client connected to a Linux SSH project. - To verify: open a remote Markdown file containing `` and confirm the SVG displays in the preview. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - Fixed SVG images failing to render in Markdown previews for remote projects. |
||
|
|
3524cb2297 |
settings_ui: Save new project skills to the remote in remote workspaces (#66224)
Part of #59088 Stacked on #66207 Creating a project skill in a remote project over SSH, WSL, or a dev container wrote it to your local machine instead. The skill creator took the remote folder path and used it on the local disk. So the save either failed, or the skill landed in a folder the project never sees. The form, URL import, and share links all hit this. The skill creator now writes through the project, the same way share and delete do after #66207, so the skill ends up on the remote. Before writing, it checks for an existing skill with the same name on the machine that has the files, so it won't overwrite one, even in a gitignored or excluded `.agents`. That check is a new `Project::host_path_is_dir`, which uses the existing `GetPathMetadata` request, so no proto changes. Collab guests can't check the host's disk, so saving a project skill in a project someone shared with you now fails with an error. Hiding the creator for shared projects is a separate PR. Global skills in a remote project still get created locally. They should go to the remote's `~/.agents/skills`, but Zed doesn't load skills from there yet, see #58222. I'll do that separately. Release Notes: - Fixed the skill creator saving project skills to the local machine instead of the remote in remote workspaces. |
||
|
|
2eb2928c15 |
tasks: Do not run worktree hooks in restricted mode (#66284)
## Summary What problem does this solve, how, and why does this change matter? Use "Closes #123" for each issue resolved. Include artifacts produced when testing: before/after screenshots, GIFs, videos, benchmarks. ## Testing Manually test your changes; report results, mention platforms if relevant. How can reviewers test this easily? Include setup and steps. ## Self-review - [ ] I've reviewed my diff for quality, security, reliability, and performance. - [ ] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [ ] Tests cover the new or changed behavior. Release Notes: - Worktree task hooks no longer run when a given workspace is in restricted mode. |
||
|
|
99cda17e05 |
project: Include user MCP servers before the first worktree loads (#64612)
# Objective Fixes #64611 An ACP thread created before the project's first worktree finishes loading receives no MCP servers, even when they are configured in user settings. `ContextServerStore::resolve_all_context_server_settings` only reads settings through visible worktrees, so with none loaded it returns an empty map. `mcp_servers_for_project` then sends `mcpServers: []` in `session/new`, and the agent runs the whole thread without MCP tools. #62026 refreshes the store once a worktree appears, but a session that was already created is never updated. This came from #52849, which replaced the `ProjectSettings::get(location, cx)` call (where `location` was `None` with no worktree, so global settings applied) with a loop over visible worktrees. ## Solution When there are no visible worktrees, read `context_servers` from `ProjectSettings::get(None, cx)` with `worktree_id: None`. Behaviour with one or more worktrees is unchanged. ## Testing - Added `test_global_context_servers_configured_without_worktrees`: a project with no worktrees and a user-level HTTP server. It fails on `main` (`configured_server_ids()` returns `[]`) and passes with this change. - `cargo test -p project --test integration context_server`: all 22 tests pass, including the multi-worktree ones from #52849. - Tested on Linux. We found this in headless Zed, where an ACP thread is opened programmatically a few seconds after launch and the agent intermittently had no MCP tools. I haven't tested the GUI path by hand. ## Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content adheres to Zed's UI standards ([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) and [icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md) guidelines) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable --- Release Notes: - Fixed external agents sometimes starting without MCP servers configured in user settings, when the thread was created before the project folder finished loading. --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com> |
||
|
|
5a534d7b5d |
git: Add git auto fetch (#53089)
## Summary
Adds an opt-in periodic background `git fetch --all` for local
repositories, so remote-tracking branches and ahead/behind counts stay
current without a manual fetch.
Because the fetch runs unattended, it behaves differently from a
user-initiated fetch:
- **Trusted repositories only.** Re-checked on every tick, since a
worktree can be trusted or restricted at any point in a session.
- **Never prompts.** Credentials that need no interaction (e.g. an SSH
agent, or a credential helper answering from a keychain) still work.
Anything that would need input fails instead of blocking on a prompt
nothing will answer.
- **Silent.** No activity indicator in the status bar, since a spinner
every minute is noise. Failures are logged at debug level.
- **Stays out of the user's way.** It runs off the repository's serial
job queue, so status refreshes and staging aren't stalled behind the
network. A user-initiated fetch, pull, or push preempts an in-flight
background fetch rather than waiting for it.
- **Leaves the repository clean when stopped.** Stopping a fetch (a
settings change, preemption, closing the project) asks git to terminate
so it can remove its ref lockfiles, rather than killing it and leaving a
stale `.lock` behind that breaks every later fetch. It also never
triggers auto-maintenance on the user's behalf.
## Configuration
```json [settings]
{
"git": {
"auto_fetch": {
"enabled": false,
"interval_secs": 60
}
}
}
```
- `enabled` (default `false`): whether to fetch from all remotes in the
background.
- `interval_secs` (default `60`, clamped to a minimum of `15`): how
often to fetch.
Both are exposed in the settings UI under **Version Control > Git
Integration**, where the interval is only shown while auto-fetch is
enabled, and documented in `docs/src/reference/all-settings.md`.
Unrelated settings changes don't restart the timer.
## Implementation design
### `GitCaller`
The remote-capable `GitRepository` methods (`fetch`, `pull`, `push`,
`commit`) take a `GitCaller` instead of a bare `AskPassDelegate`:
```rust
pub enum GitCaller {
/// A user started this and is waiting on it. Prompts route to the UI.
User(AskPassDelegate),
/// No user attached. Never prompts, and stops when the receiver resolves.
Background(Option<oneshot::Receiver<()>>),
}
```
Every such command goes through `GitBinary::run_remote_command`, which
applies everything the caller implies. git, credential helpers, and ssh
each prompt through a different mechanism, so keeping the list in one
place means no call site can miss one. For `Background`:
| Prompt channel | Mitigation |
| --- | --- |
| git's own terminal prompt | `GIT_TERMINAL_PROMPT=0` |
| Credential helpers | `credential.interactive=false`, which is narrower
than clearing `credential.helper` so helpers that answer without
prompting keep working |
| askpass | `core.askPass=`, and `GIT_ASKPASS`/`SSH_ASKPASS` unset |
| ssh (key passphrases, host key confirmation) | `-o BatchMode=yes`
composed onto the ssh command git would otherwise use
(`GIT_SSH_COMMAND`, then `core.sshCommand`, then `ssh`), so custom ssh
commands keep working. Setups that only set the deprecated `GIT_SSH` are
left alone, since setting `GIT_SSH_COMMAND` would silently replace them.
|
`gc.auto=0` is also set, since auto-maintenance can repack the whole
repository. gpg's pinentry when signing isn't covered, as no background
caller signs.
### Cancellation
A background command is spawned with `kill_on_drop` and raced against
its cancel receiver, where a dropped sender counts as cancellation:
1. If already cancelled before spawning, git is never started.
2. On cancellation, git is sent `SIGTERM`
(`util::process::request_termination`), which runs its handlers that
remove lockfiles.
3. If it hasn't exited within a 2s grace period, it's killed.
Windows has no equivalent signal, so cancellation there is a kill.
### Scheduling
- Each repository has a timer task, restarted only when `enabled` or
`interval_secs` change.
- On each tick, the timer checks trust, then tries to acquire the
repository's `fetch_lock` semaphore and skips the tick if it's held. It
spawns a **detached** fetch task that holds the permit until the fetch
settles.
- `AutoFetchState.cancel` holds the sender, and is the only thing
bounding the fetch's lifetime. It's dropped on a settings change, on
preemption, and when the repository is dropped, so every way of stopping
a fetch goes through graceful cancellation.
- Running off the serial job queue is safe because auto-fetch mutates no
`Repository` state. It only updates remote-tracking refs, which git
guards with its own lockfiles, and the results reach the UI via the
resulting git directory rescan. Manual fetch stays on the queue, since
it also writes snapshot state via `refresh_branch_list`.
- `fetch`, `pull`, and `push` call `preempt_auto_fetch()`, which drops
the cancel sender, then wait on `fetch_lock` inside their job. That wait
is bounded by a cancelled fetch shutting down rather than by the
network, and stops them failing with "cannot lock ref" against a
background fetch.
## Test plan
`test_auto_fetch` covers:
- [x] An untrusted repository is never auto-fetched, and fetching begins
once its worktree is trusted
- [x] Timer fires on schedule, and again on the following interval
- [x] Unrelated settings change mid-interval doesn't reset the timer
- [x] Disabling `auto_fetch` stops all fetches
- [x] Re-enabling with a longer interval respects the new cadence
## Review
Self-Review Checklist:
- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable
Addresses
#24611(https://github.com/zed-industries/zed/discussions/24611)
Release Notes:
- git: Added option (off-by-default) to automatically fetch upstream of
the current branch and default upstream of the project. Enable it with:
```
{
"git": {
"auto_fetch": {
"enabled": false,
"interval_secs": 60
}
}
}
```.
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Codex (GPT-6) <noreply@openai.com>
Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
|
||
|
|
02d47bf64f |
http_client: Unify asset downloading logic (#66048)
Supersedes https://github.com/zed-industries/zed/pull/62653 ## Summary This PR unifies the download handling we have in the http_client crate, because we were alternating between the ways we were downloading a lot, in one case we changed the way of downloading entirely if a hex digest was present or not. With this in, we now handle this one way for all kinds of downloads, removing a lot of duplicated code and unifying the behavior here across download types. ## Testing Tested this manually. ## Self-review - [X] I've reviewed my diff for quality, security, reliability, and performance. - [ ] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [ ] Tests cover the new or changed behavior. Release Notes: - Improved reliability of language server and agent downloads by verifying checksums consistently, rejecting failed HTTP responses, and improving cleanup of partial downloads. |
||
|
|
2e57653724 |
project: Remove the PathStyle guard for repository identity paths (#66209)
## Summary Follow-up of #63075. `repo_identity_path_if_local` is nearly identical to `repo_identity_path`; the only difference is that it returns `None` unless the path style matches the host's: https://github.com/zed-industries/zed/blob/e4a3732b94eb0881e1d954201ed41ffd2abf18f6/crates/project/src/git_store.rs#L10691-L10697 As its doc comment explains, the function was a stopgap: it guarded callers that were not yet `PathStyle`-aware from receiving a `PathStyle`-constructed path and processing it with `std::path` methods, which produces incorrect results for foreign path styles. Since then, the worktree path handling has largely been migrated to `PathStyle`. The only remaining non-aware consumer in these call chains was `Worktree::directory_name` in `crates/git/src/repository.rs`. This PR removes `repo_identity_path_if_local` and replaces its uses with `repo_identity_path`. `Worktree::directory_name` now takes a `PathStyle`, so the guard is no longer needed. The removal also improves path handling for remote projects, where the path style can differ from the host's. ## Testing Added tests for `RepositorySnapshot::linked_worktree_anchor_path` and `Worktree::directory_name`, covering both Unix and Windows path styles. ## 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 |
||
|
|
8767f1530c |
project: Fix npm-based registry agents failing to launch after a broken install (#66235)
A user reported Claude failing to launch after upgrading Zed: ``` Error: Cannot find package '.../external_agents/registry/npx/claude-acp/node_modules/@anthropic-ai/claude-agent-sdk/index.js' imported from .../@agentclientprotocol/claude-agent-acp/dist/acp-agent.js code: 'ERR_MODULE_NOT_FOUND' ``` Node only falls back to `index.js` when a package directory has no usable `package.json`, so the install on disk was incomplete. The published package is fine. ## Cause `LocalRegistryNpxAgent::get_command` runs `npm install` in the shared per-agent install directory on every call (per project and per connection), with no coordination. Running several installs at once in the same `node_modules`, or interrupting one, can leave a package directory without its `package.json`. npm doesn't repair this state on its own. I reproduced it locally: with `claude-agent-sdk/package.json` removed and npm's hidden lockfile (`node_modules/.package-lock.json`) still looking up to date, `npm install` reported success, the package stayed broken, and loading the agent failed with the user's exact error. ## Fix - Serialize installs per install directory with a shared async lock, so concurrent launches of the same agent don't run overlapping `npm install`s. - After installing, check that every top-level and scoped package directory in `node_modules` has a `package.json`. If one doesn't, delete `node_modules` and reinstall once. I checked this manually against the broken install above, and the agent loaded afterwards. ## Known limitation The lock only applies within one Zed process. If the launch is cancelled while `npm install` is running, npm keeps going after the lock is released, so a new launch could overlap with it. In both cases the self-repair check fixes any resulting breakage on the next launch. Release Notes: - Fixed registry agents installed via npm (such as Claude Agent) failing to launch with `ERR_MODULE_NOT_FOUND` after an interrupted or concurrent install. |
||
|
|
fae4b2ea4f |
workspace: Fix local file opens with remote workspaces (#65771)
## Summary Closes #58773 While working on this, I noticed that project grouping and workspace lookup used different connection comparisons. I unified them around the existing `RemoteConnectionIdentity`. I also simplified the relevant code, removing redundant lookup and comparison helpers and borrowing values instead of cloning them when the caller only needs to read the data. ## Testing Added corresponding test coverage ## 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 local files opening as empty buffers in remote workspaces. --------- Co-authored-by: Kirill Bulatov <kirill@zed.dev> |
||
|
|
9521840152 |
path: Reimplement PathStyle::join based on the standard library's implementation (#65966)
## Summary Final follow-up of #64149, this PR reimplements `PathStyle::join()` on top of `std::path::PathBuf::push`, via a new `PathStyle`-aware `PathBufExt::styled_push` helper. The old `join_path()` and `join_path_preserving_components()` are removed, and their call sites are migrated as follows: - `join` -> `join` - `join_path` -> `join` + `normalize_lexically` - `join_path_preserving_components` -> `join`, plus `normalize_separators` only where the joined path is displayed to the user I'm confident that the new `join()` mirrors std's behavior. The main thing to be aware of is that the old `join` rejected a rooted right-hand side and returned `None`, while the new one accepts it and handles it: the left-hand side is replaced entirely, except for a root-only operand such as `\b` on Windows, which keeps the left side's prefix (`C:\a` + `\b` = `C:\b`). Because the old `join` rejected rooted right-hand sides, all migrated call sites were audited for `has_root`: the right operand either cannot be rooted by construction, or the call site already guards rooted inputs with `has_root`, or an explicit guard was added here. One edge case was noticed but left unchanged: a drive-relative operand such as `C:foo.rs` is now replaced instead of concatenated (mirroring std). This case was equally unhandled before, so it is left as-is here; adding another check beyond the existing `has_root` guard would not be self-explanatory either. #65911 (git worktree names containing path components) is likewise pre-existing and tracked separately. ## Testing New tests are added for the new `join` method, adapted from the std lib. The tests of the affected caller crates have been run to prevent regressions, but this is not a guarantee. ## 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 |
||
|
|
eee7501970 |
agent: Remove checkpoints (#65989)
Closes #62283 Closes #58444 Follow-up #65304 Supersede #64000, #62301 Before every message, the agent snapshotted every Git repo in the project and waited for it before sending the prompt, and every Git status change during a turn took another one. In large workspaces this took tens of seconds, and on Windows it could hang forever. #65304 already skipped it for external agents and subagents. The snapshot only exists for "Restore Checkpoint", which very few people use, so this removes checkpoints entirely. Putting them behind a setting would keep the snapshot code and its maintenance around for a feature few people use. - Removed: - "Restore Checkpoint" button - Snapshots before, during and after each turn - Git, remote and proto code behind them (proto ids reserved) - Checkpoints docs section - Stays: - Editing an earlier message - Rejecting the agent's edits - Worktree archive snapshots Release Notes: - Removed agent checkpoints and the "Restore Checkpoint" button. Taking a checkpoint before every message made the agent slow to respond, or hang, in large Git repositories. To undo the agent's changes, reject its edits or use Git. |
||
|
|
04470cd9b5 |
project: Don't send a project update when no worktree was removed (#65189)
## Summary > Machine translation of my original text (Russian, below): > > Zed started to freeze when opening some of the threads created by an AI agent. After such a thread was opened, the cursor in the message input started blinking rapidly, everything stopped, and Zed could not be closed; the only way out was to kill the process. If several Zed windows were open, all of them froze. > > This happened in Zed on Windows with projects in WSL2. Not every thread in the same project froze, some opened fine, so it was hard to understand why it was happening. > > The investigation was done with the help of an AI (Claude), and it also prepared this fix. Its conclusions are below. Original text: Zed начал зависать при открытии некоторых тредов, которые создаёт ИИ-агент. После открытия курсор в поле ввода начинал быстро мигать, всё останавливалось, и закрыть Zed было невозможно — приходилось снимать задачу. Причём если было открыто несколько окон Zed, зависали все. Всё это происходило в Zed на Windows с проектами в WSL2. Не все треды в одном и том же проекте зависали, некоторые открывались нормально, из-за чего было непонятно, почему это происходит. Разбор ситуации делался с помощью ИИ (Claude), он же подготовил исправление. Его выводы ниже. > **AI-generated (Claude):** > > **Cause.** In a remote project the client sends `RemoveWorktree` whenever it releases a handle to a worktree (`Project::on_worktree_released`). On the server, `WorktreeStore::remove_worktree` answered every such request with `UpdateProject`, even when the worktree was already gone. When the client handles `UpdateProject`, `WorktreeStore::set_worktrees_from_proto` re-creates a handle for every listed worktree it does not hold. A remote client holds invisible worktrees weakly (`WorktreeStore::remote(false, ..)`), so that handle is released right away and `RemoveWorktree` is sent again. While the request that really removes a worktree is still queued behind redundant ones, every answer lists that worktree again and produces one more request. > > Loading an agent thread triggers this because `AcpThread::resolve_location` opens the file of every tool-call location with `Project::open_local_buffer`, which creates an invisible worktree for a file outside the project. When the buffer cannot be opened (an image: "Binary files are not supported") the worktree is released at once. A thread whose tool calls read a couple of dozen screenshots outside the project releases that many invisible worktrees almost simultaneously. > > **Change.** `remove_worktree` sends the project update only if it removed a worktree. > > **Measurements.** Stock Zed 1.22.0 client (Linux, calls counted with gdb breakpoints), remote server built from v1.22.0 with and without this change, loading one thread that creates 21 invisible worktrees: > > | | without | with | > |---|---|---| > | `UpdateProject` handled by the client | 4,741 | 57 | > | `Worktree::remote` handles created on the client | 4,702 | 281 | > | `SettingsStore::clear_local_settings` calls | 9,980 | 645 | > | UI thread busy after the thread loaded | 112 s | 6 s | > > In the captured part of a traced unpatched run, 2,839 of 2,840 `RemoveWorktree` requests removed nothing, and 2,565 of them were for the same worktree. A second thread (33 tool-call locations outside the project) went from 54 s to 6 s. > > The client still re-creates and drops handles for worktrees listed in older updates, and `handle_update_project` still recomputes settings for every listed worktree. Both are bounded now and left for follow-ups. > > Possibly related: #65008, #62542 (similar symptoms with WSL remotes and agent threads). Not verified that this resolves them. ## Testing > Machine translation of my original text (Russian, below): > > I checked it on my machine: Zed 1.22.0 on Windows 11, project in WSL2 (Ubuntu). I replaced the server in `~/.zed_server` with one built from v1.22.0 with this change. The thread that used to freeze Zed every time now opens normally. Original text: Проверил у себя: Zed 1.22.0 на Windows 11, проект в WSL2 (Ubuntu). Подставил в `~/.zed_server` сервер, собранный из v1.22.0 с этим изменением. Тред, который раньше каждый раз вешал Zed, теперь открывается нормально. > **AI-generated (Claude):** > > - New test `test_removing_missing_worktree_does_not_send_project_update` in `remote_editing_tests.rs` fails without the change (`left: 1, right: 0`) and passes with it. > - `cargo test -p remote_server --lib`: 57 passed. `cargo clippy -p project -p remote_server --lib --tests -- -D warnings`: clean. > - The measurements above were taken on Linux (Ubuntu in WSL2, Xvfb), with the project opened as an SSH remote through a local stand-in for `ssh` (client and server on the same machine). > - In the check on Windows described above, the thread replays 710 messages; Zed's log shows it loaded three times with the patched server running, and the connection to the server was idle afterwards. > - To reproduce: open a remote project, let an external agent read about 20 image files outside the project in one thread, then reopen that thread. ## 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 remote projects (SSH, WSL) becoming unresponsive when loading an agent thread that refers to many files outside the project. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
cb593458e1 |
project: Match document filter patterns in dynamic registrations (#65252)
## Summary Follow-up to #59243, which made dynamically registered capabilities honor the `language` and `scheme` of their document selectors, but left `pattern` matching fail-open. A registration such as `{ "language": "toml", "pattern": "**/Project.toml" }` therefore still applied to every TOML document the server had opened, and a pattern-only filter applied to every document. This matches `pattern` against the document's path: - String patterns are matched against the absolute path. As in the LSP glob syntax, `*` and `?` do not match path separators. - Relative patterns are matched against the path relative to their base URI, and Zed now advertises the `textDocument.filters.relativePatternSupport` client capability. - Documents without a file system path never match a `pattern` filter. Contexts that stand for a whole language, like the semantic token legend lookup, and guest buffers whose path is unknown keep not evaluating patterns. - Registrations whose patterns are not valid globs are rejected when they are registered. LSP 3.18 changed `TextDocumentFilter.pattern` from a string to a `GlobPattern`, so that it can also be a relative pattern. ~~This PR depends on zed-industries/lsp-types#16, which updates the type and adds the client capability. I'd like to merge this together with that upstream change: `Cargo.toml` currently points at the commit of zed-industries/lsp-types#16 on my fork, and I will switch it to the `zed-industries/lsp-types` revision once that PR is merged.~~ **Update:** zed-industries/lsp-types#16 has been merged, and `Cargo.toml` now points at its `zed-industries/lsp-types` revision (zed-industries/lsp-types@82d7fc66eb). ## Testing - Added unit tests for matching string patterns, wildcards across path separators, and relative patterns. - Added an integration test that a pattern-scoped completion registration only applies to matching buffers, and that a registration with an invalid pattern is rejected. - Updated `test_dynamic_formatting_registration_with_pattern_only_selector`, which asserted the fail-open behavior left by #59243. ## 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 language servers' dynamically registered capabilities applying to files outside of the `pattern` of their document selector. --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
d27ad54dd6 |
Fix on-type formatting using a stale position when autoindent is pending (#65769)
## Summary Sister to Shopify/ruby-lsp#4242. Pressing Enter triggers `textDocument/onTypeFormatting` from inside the newline transaction, before autoindent has been applied. The request position was converted to a point at that moment, so language servers received column 0 of the new line even though the cursor ends up at the indented column. The left-biased cursor pins from #61823 were captured at the same moment, so the autoindent whitespace prevented them from being restored. With Ruby LSP this inserted `end` in front of the body's indentation and left the cursor after `end`. That is why the Ruby extension disables on-type formatting (zed-extensions/ruby#38). This PR: - Resolves the on-type formatting position after pending autoindent is applied. - Capture the cursor pins after pending autoindent is applied. ## Testing - `cargo test -p editor --lib on_type_format` (7 passed; the 2 new tests fail on `main`) - `cargo test -p collab --features test-support --test collab_tests on_input_format` (2 passed) - `./script/clippy -p editor -p project` - Manually with Ruby LSP: `def foo⏎`, `do |x|⏎`, heredocs, `do |` and `"#{` ### Proof https://github.com/user-attachments/assets/43ff3307-4bd7-43f5-a65d-d18eca0b5d2a ## 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. ## References - zed-extensions/ruby#38 - Follow-up to #61823 ## Suggested .rules additions For `crates/editor/.rules`: code that runs inside `Editor::transact` (for example from `newline`) sees the buffer before autoindent is applied. Wait for `Buffer::wait_for_autoindent_applied()` before reading cursor positions or anchoring to them. Release Notes: - Fixed on-type formatting after pressing Enter being applied before the new line's indentation, which left the cursor after text inserted by language servers such as Ruby LSP. |
||
|
|
1563b405f9 |
project: Honor document selectors of didChange and didSave registrations (#65253)
## Summary #59243 made dynamically registered capabilities honor their document selectors, but `textDocument/didChange` and `textDocument/didSave` registrations still overwrote the server-wide sync options and ignored their selectors, while `didSave` was sent for every saved file of the worktree to every server whose options asked for saves. These registrations are now kept per registration, with their selectors: - The sync kind of a document's changes and whether its saves are notified, with or without text, come from the latest registration matching the document, falling back to the static options. - The merged capabilities keep mirroring the latest registrations, and unregistering now restores the static options instead of clearing them. - A `didSave` registration without options is now honored instead of ignored. Static save options now only cover the documents a server was opened with, as they apply to the documents the client selects for the server, while `didSave` registrations may select any document of the worktree. Registrations without a selector stand for the same documents as the static options. This removes the broadcast of every save to every server, which rust-analyzer no longer needs to pick up manifest changes in Zed: with dynamic registration it declares no static save options, and registers `didSave` for `**/*.rs` and `**/Cargo.toml` to reload its workspace when a manifest is saved. Manifest saves keep reaching it either way: while `pattern` matching remains fail-open, its filters match every document, and once #65252 lands they select exactly these files. Documents without a language no longer match every registration, and only match filters without a `language`. ## Testing - Added integration tests that `didChange` and `didSave` registrations only apply to documents matching their selectors, fall back to the static options otherwise, and restore them when unregistered. - Added an integration test that static save options and registrations without a selector do not cover documents not opened in the server, that a `language` filter does not select a document without a language, and that a registration can select such a document. - Updated `test_managing_language_servers`, which asserted that saving a file notifies every server of the 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: - Fixed language servers receiving change and save notifications that do not follow their dynamic registrations, including save notifications for unrelated files of the project. --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
1416404b88 |
git_ui: Keep staged changes when discarding from the unstaged section (#65559)
## Summary Closes #63047 In other IDEs like VSCode (and its variants) I got used to being able to discard unstaged changes of a file while leaving its staged changes in place, but Zed currently behaves differently and caused me to lose whole files a few times. I think this is unexpected behavior, so this PR updates how the git panel handles discarding changes to something I personally find more intuitive in the hopes that other people do too. @mmalk3 reproduced [the behavior](https://github.com/zed-industries/zed/issues/63047#issuecomment-5386884858) and recorded this video which I'm reusing: https://github.com/user-attachments/assets/0f54db8e-0015-497f-896e-ae3954055e3c #63073 fixed this, but was an incomplete experience IMO and was never merged. I'm taking a slightly more holistic approach so that nothing about the experience feels buggy. These felt like the minimum required behavior changes around the original bug fix: 1. When selecting a file that has both staged and unstaged changes, two rows were selected. Leaving that in place made it unclear what was actually going to be affected by the "discard" action, so I adjusted selections to be scoped to their panel. You can still select a file that exists in both sections by clicking it in both panels if you wanted to. 2. "Trash Untracked Files" would trash staged files that were untracked. I updated the action to only affect untracked files that are also unstaged, but I'm open to reverting this so I added it as a separate commit. ## Testing 1. The original bug fix: discarding unstaged changes leaves the staged changes in place. https://github.com/user-attachments/assets/e89da0c3-b14f-47aa-88b6-0e344ef9375b 2. All changes can still be discarded by trashing the changes from the staged panel. I could see arguments for this being a different experience but it's the existing behavior so I didn't want to remove it. https://github.com/user-attachments/assets/47844acb-064e-4ae8-9cac-87d1a426c6f6 3. This is the new multi-select behavior. If the same file is in both the staged and unstaged panels, selecting one row does not automatically select the other -- but you can still select both. When you select both, it'll behave the same as if you selected the staged file and discard all changes. https://github.com/user-attachments/assets/f01e4b82-1e72-4860-8709-254a416ca9cd 4. This is the new "Trash untracked" behavior. Only unstaged files that are also untracked can be trashed via this action. If the untracked file is staged, it's protected (including the unstaged changes). If there are no untracked files or they are all staged (partially or completely), the button is disabled. https://github.com/user-attachments/assets/6a477a40-5d94-4dea-9bc1-3e280a1c579b ## 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 discarding unstaged changes in the git panel also discarding staged changes --------- Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com> |
||
|
|
a4a3a968d1 |
path: Replace normalize with component-based normalization in PathStyle (#65782)
## Summary Follow-up to #64149 and an intermediate step toward the composable join API discussed in https://github.com/zed-industries/zed/pull/63102#issuecomment-6214033056. This PR removes the handwritten `PathStyle::normalize()` and migrates its call sites, then introduces two new methods: `PathStyle::normalize_separators()` and `PathStyle::normalize_lexically()`. `normalize_separators()` collects a path's components into a `PathBuf` for the target `PathStyle`; the `/` to `\` rewrite only happens on Windows, and not inside verbatim paths. `normalize_lexically()` additionally resolves `.` and `..`. The standard library has no direct equivalent of `normalize_separators()`. The closest operation is `Path::components().collect::<PathBuf>()`, but that implementation pushes each component as a path and corrupts verbatim paths on Windows (rust-lang/rust#164467). I rewrote the collection in a dedicated `collect_components()` function that appends each component's raw `OsStr` with a `PathStyle`-aware separator; `normalize_separators()` is a thin wrapper around it. It removes redundant and trailing separators and interior `.` components, and it does not resolve `..`. One thing to note is that it does not normalize the prefix: `//server/share/user/project` becomes `//server/share\user\project`. This is necessary to prevent `//?/` from being transformed into `\\?\`: `//?/C:` is parsed as `UNC("?", "C:")`, while `\\?\C:` is a verbatim path with stricter separator rules. It may still be reasonable to canonicalize other prefixes such as plain UNC or device paths, but that would need an explicit exception for `//?/`; I kept the simpler raw-prefix rule for now. Happy to discuss. `normalize_lexically()` has a counterpart in std `Path::normalize_lexically()`, but that method is still unstable and under development. Combining the current std implementation with the discussion in https://github.com/rust-lang/rust/issues/134694#issuecomment-5780155118, I implemented `PathStyle::normalize_lexically()` to return `PathBuf` instead of `Result<PathBuf>`, preserve leading `..` components, and discard `..` above a root instead of returning an error; this follows the suggestion in that discussion that `a/../..` should normalize to `..` rather than error. It mostly matches the old `PathStyle::normalize()` behavior, with a few intentional differences: a non-empty path that normalizes to nothing now returns `.` instead of an empty path, Windows prefixes are preserved as written, `/` is not treated as a separator inside verbatim paths, and `C:..\worktrees` keeps `..` instead of collapsing to `C:worktrees`. It also normalizes separators. As discussed in https://github.com/zed-industries/zed/pull/63102#issuecomment-6214033056, although these two methods overlap, they expose different layers of normalization that callers can opt into on demand. The next step is to replace the three join helpers (`PathStyle::join`, `PathStyle::join_path`, and `PathStyle::join_path_preserving_components`) with a plain `PathStyle::join` that mirrors `std::path::Path::join`, leaving separator and lexical normalization as explicit steps that callers compose. ## Testing Added tests for both methods across Unix and Windows styles, covering the scenarios described above. ## 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 |
||
|
|
042e0406d3 |
path: Clean up leftover helpers before join_path work (#65792)
## Summary I think we are getting closer to fully making `PathStyle` a mirrored, cross-platform counterpart to `Path` on top of #65782. Before the final step — a separate change focused solely on the `join_path`-related methods — this PR clears up the remaining odds and ends and removes the leftover helpers from the `path` crate. The `normalize_path` function is moved to `crates/util/src/paths.rs`, as it has no cross-platform behavior, so `util` is a more appropriate home for it. `PathStyle::split()` is removed. Its functionality can be replaced by `PathStyle::file_name()` plus stripping the file name from the original path, and since there is only one caller, the migration is straightforward. ## Testing Mostly a refactor. For the only caller of `PathStyle::split()`, the multi-buffer header, I manually tested that the header still renders the file name and parent directory correctly. ## 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 |
||
|
|
afff3d2616 |
debugger: Add hover tree UI (#53198)
Closes #32932 ## Summary - Show debugger values as an expandable tree, with the first level visible immediately and deeper variables loaded on demand. - Show the debugger value without waiting for a slow language server, then show LSP documentation below it when it arrives. If debug evaluation fails, keep the regular LSP hover. - Keep the hover within the editor while expanding or resizing, with a visible scrollbar and a hint for variable actions. - Support mouse, keyboard, Vim, and Helix navigation. Long values remain readable through wrapping or scrolling; the variable menu can copy a value or expression and add an expression to Watch. - Handle bare identifiers such as `a` in `let c = a;`. ## Testing - `cargo test -p editor hover_popover -- --nocapture` - `cargo test -p debugger_ui hover_values -- --nocapture` - `cargo test -p project test_hover_ -- --nocapture` - `cargo test -p ui compact_scrollbar_thumb_tracks_the_visible_fraction -- --nocapture` - `cargo test -p vim test_digraph_keymap_conflict -- --nocapture` - `cargo fmt --all -- --check` ## Demo Earlier recording (before the latest interaction refinements): https://github.com/user-attachments/assets/dfb6d4d7-b52e-45a3-b921-dc14719ccd50 Release Notes: - Improved debugger hovers with an expandable, keyboard-accessible variable tree. --------- Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Co-authored-by: Amp <amp@ampcode.com> |
||
|
|
febcb5bb99 |
Bump proptest (#65821)
Closes https://github.com/zed-industries/zed/pull/65618 Release Notes: - [GPUI] N/A |
||
|
|
5504e87bfd |
workspace: Fix trust scope paths when connecting to Windows hosts from Unix (#63102)
# Objective This is another fix related to the path handling issue when connecting from Unix to Windows, similar to #62038 and #63075, but confined to the path handling in the security modal. The root cause is the same: when using the standard library `Path` API across platforms — especially connecting from Unix to Windows — these `Path` methods give wrong results. The bugs I have observed include: 1. When opening a single file, its parent folder is not shown properly in the project list. 2. When opening a folder, no parent folder is auto-filled into the input field after "Trust all projects in". 3. When Zed runs in debug mode, opening two untrusted folders, checking "Trust parents", and then trusting would result in a panic. ## Solution Use the corresponding methods in `PathStyle`, which is designed for handling paths across platforms, instead of the `Path` methods in the relevant code. ## Testing Built and tested locally, with comparison screenshots attached. ## 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) - [ ] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable ## Showcase || Before | After | |:--:|:--:|:--:| | Auto fill |<img width="657" height="343" alt="auto_fill_before" src="https://github.com/user-attachments/assets/e36ca3d5-998c-4bed-94e9-f97dd0e7ebf4" />| <img width="654" height="333" alt="auto_fill_after" src="https://github.com/user-attachments/assets/c8413fb5-d2dd-427a-afb0-9cbebc033742" /> | | Single file | <img width="654" height="322" alt="single_file_before" src="https://github.com/user-attachments/assets/bfe87ab0-bf87-491a-8f85-b5a2681763a9" />| <img width="657" height="325" alt="single_file_after" src="https://github.com/user-attachments/assets/0437cbde-42c3-44f6-847b-abd33e54cd2c" /> | --- Release Notes: - Fixed trusting projects on remote Windows machines from Unix systems |
||
|
|
2dcc4cc04d |
Allow to restart stopped servers (#65387)
Part of https://github.com/zed-industries/zed/issues/61896 https://github.com/user-attachments/assets/1625de1d-0ce3-4257-9f61-887ae86954be Currently, if one stops language servers via the LSP button, there's no way to bring them back. The PR adjusts the "restart language server" command to work so that it actually restarts the servers relevant to the file opened, even in this case. Release Notes: - Allowed to restart stopped servers |
||
|
|
f929b3f7ce |
path: Reimplement PathStyle::strip_prefix based on std lib's implementation (#65503)
## Summary Another follow-up of #64149 The old `strip_prefix` did not only do the stripping, but also had the functionality to build `RelPath`; this PR removes the `RelPath` building part. It also reimplements this method based on components instead of strings, which gives us the ability to handle non-UTF-8 paths and Windows prefixes reliably. Most of the callers of `PathStyle::strip_prefix()` are replaced by the following chain: ```rust PathStyle::strip_prefix() .ok() .and_then(|path| RelPath::new(path, path_style).ok()) ``` In certain places, RelPath is not needed, and the updated `strip_prefix` gives a direct result. ## Testing Added new tests to guard `PathStyle::strip_prefix`'s functionality. Tests passed for the crates where the callers live. ## 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 |
||
|
|
51a3a0e971 |
path: Distinguish is_absolute and has_root in PathStyle (#65468)
## Summary Follow-up of #64149, Zed currently has three handcrafted, identical `is_absolute()` functions, living in `crates/path/src/path.rs` and `crates/util/src/paths.rs`. They read as follows: https://github.com/zed-industries/zed/blob/93d745668805029476e6d7fbb19652116fed51de/crates/path/src/path.rs#L409-L420 In fact, these handcrafted methods behave like `Path::has_root()` rather than `Path::is_absolute()`. The difference between the two is that `Path::has_root()` only checks whether a path has a root, whereas `Path::is_absolute()` checks whether the path is truly absolute. On Unix, which has a single root, `has_root()` and `is_absolute()` coincide. Windows, however, is multi-rooted (`C:\` and `D:\` are different roots), so a rooted path such as `\temp\path` is not absolute: depending on the working directory, it may resolve to `C:\temp\path` or `D:\temp\path`, which are different paths. This misleading naming can lead to misuse of the API. This PR does three things: 1. Deduplicates the methods, keeping only `is_absolute()` in the `PathStyle` body. 2. Reimplements `PathStyle::has_root()` and `PathStyle::is_absolute()` based on the standard library’s implementations; the former replaces the old `is_absolute()`. 3. Updates some callers of the old `is_absolute()` (now `has_root()`, per step 2) to the new `is_absolute()`, based on each call site’s semantics and the actual behavior of the methods. Steps 1 and 2 are pure refactors; the only functional change is in step 3. I believe this fixes some edge cases — or at least surfaces things that need fixing — though I am not entirely certain that every replacement is correct. ## Testing No new tests are introduced. The refactored parts pass the existing tests in the affected crates. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [ ] Tests cover the new or changed behavior. Release Notes: - N/A |
||
|
|
7ca96c2a58 |
Keep remote agent secrets out of launcher arguments (#65174)
Closes https://github.com/zed-industries/zed/issues/64511 Release Notes: - Fixed remote agent secrets exposed in the launcher arguments |
||
|
|
83b332342f |
Support inlay hint edits via double clicks and AcceptInlayHint action (#64789)
Closes https://github.com/zed-industries/zed/discussions/51582 https://github.com/user-attachments/assets/fb4ae2c2-c134-4c7c-8fea-e886b085fc32 Limitations: * we cannot accept all inlay hint at once, as each of them may apply contradicting text edits (e.g. altering imports) * next hint will be accepted with a slight delay, as, after the edit, we need to re-fetch the hints and then resolve that new hint to get the edits Release Notes: - Supported inlay hint edits via double clicks and `AcceptInlayHint` action |
||
|
|
8323e23277 |
Fix hanging during remote project search (#65257)
Closes https://github.com/zed-industries/zed/issues/65099 Before: https://github.com/user-attachments/assets/36673f06-75b2-4d36-a8d9-4aaaa6bc1768 After: https://github.com/user-attachments/assets/86a4e129-e1de-465f-9e70-fcec9d421c03 Issues: - The host checked files that were not yet open for matches, but treated every already-open buffer as a candidate. Earlier queries leave thousands of buffers open, so later queries sent all of them to the client: 3,339 buffers for 51 real matches in one case. Open buffers are now checked against their in-memory text first, which also stops ordinary non-SSH searches from reporting open buffers with no matches. - The host queued every candidate buffer's full contents without waiting for the client, so data from cancelled queries piled up in front of the new query's results. A single worker shared by all searches now sends at most 64 buffers or about 1 MiB before waiting for the client to acknowledge them, and skips batches from cancelled searches. - Cancelling a search could stop a buffer transfer after the buffer was already marked as shared, so later searches waited forever for its contents. `BufferStore` now owns transfers, so dropping the caller no longer cancels them. Release Notes: - Fixed hanging during remote project search |
||
|
|
72d073d642 |
Fix agent file link navigation (#64748)
Closes https://github.com/zed-industries/zed/issues/56633 Related to https://github.com/zed-industries/zed/issues/56067 Related to https://github.com/zed-industries/zed/issues/63968 Changes path handling to open files in the agent panel similar to what cmd-click does: regular open for files from the project, singe-file worktrees for files outside of the project Release Notes: - Fixed agent file link navigation |
||
|
|
fdc1005e71 |
Fix worktree creation on Windows remote from Unix host (#63075)
# Objective Closes #63067 Another issue with path handling when connecting from Unix to a Windows remote, similar to #62038. When we create a git worktree from Zed's title bar, Zed computes the target path using many standard library `Path` APIs, such as `Path::file_name()`, `Path::parent()`, and `Path::starts_with()`. All of these methods are platform-dependent. Since we build the Windows path on a Unix client, these methods don't work as intended, which introduces errors. ## Solution This PR does two things. First, it fixes the worktree creation issue. The main change is replacing the standard `Path` APIs with the corresponding ones in `PathStyle` across the methods involved in the worktree path computation chain, mainly `RepositorySnapshot::main_worktree_abs_path()`, `Repository::path_for_new_linked_worktree()`, and `worktrees_directory_for_repo`. This lets us build correct worktree paths on Windows. Additionally, to make the logic testable, the core of `Repository::path_for_new_linked_worktree()` was moved to `RepositorySnapshot`. Second, it fixes the worktree display. The main change is in the `linked_worktree_short_name` function; the rest updates its callers, including the title bar, sidebar, and the agent thread UI. ## Testing Added new tests, and also built and tested locally; a video recording is attached. ## Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content adheres to Zed's UI standards ([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) and [icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md) guidelines) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable --- Release Notes: - Fixed worktree cannot be created when remote connecting from unix system to windows. |
||
|
|
0418cb5b60 |
Fix LSP workspace folders for single-file worktrees (#60753)
# Objective - Fixes #40627 ## Solution - Only send directory URIs in LSP workspaceFolders ## Testing - Added a regression test for opening a Python file with ty as a single-file worktree. - Verified that the test fails without the fix and passes with it ## Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content adheres to Zed's UI standards ([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) and [icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md) guidelines) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - Fixed ty panic when opening a Python file as a single-file project. Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> |
||
|
|
0849124bc2 |
Ensure more snapshots are used after .await points (#65219)
Follow-up to https://github.com/zed-industries/zed/pull/65193 Release Notes: - N/A |
||
|
|
aecb6364b3 |
Fix inlay hint filtering against stale buffer snapshots (#65193)
The local inlay-hint fetch captured its filtering snapshot before awaiting the LSP response, while response conversion created anchors from the newer buffer state. Editing during a pending request could produce anchors that the filtering snapshot had not observed, leading to the reported invalid-anchor crash. Take the filtering snapshot after response conversion, matching the remote fetch path, while preserving background filtering. Release Notes: - Fixed a crash when editing a buffer while an inlay-hint request was pending. |