## Summary
`LspStore` keeps per-buffer LSP data, including a snapshot of the
buffer's text and cached results such as document colors and links.
Local projects remove it when the buffer's last language server handle
is released. Remote development projects get the same handles, but
nothing observes their release, so the entries stayed after the buffer
closed.
This change removes a buffer's LSP data and reload task when the buffer
store reports the buffer dropped. Collab guests aren't covered: they
keep every buffer in `shared_with_me` until they leave the project, so
`BufferDropped` never fires for them.
## Testing
- `test_remote_lsp_data_dropped_with_buffer` fails without the change.
- `cargo test -p remote_server --lib` and `./script/clippy -p
remote_server -p project` pass on Windows.
## 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 memory usage in remote projects after closing files.
Follow-up to https://github.com/zed-industries/zed/pull/67187
After a restart Zed reopens only each window's active workspace, so the
title-bar worktree picker and the sidebar project menu could not switch
to the repository's other checkouts.
The worktree picker now also lists, as closed rows:
- Delta checkouts of the same source repository, found in
`<source>/.delta/worktrees` and in Delta's managed stores.
- The source repository's own checkout, as "main worktree".
- Linked worktrees registered with the source or with its Delta clones.
Enter opens the checkout, or switches to it when it is already open, and
the secondary action opens it in a new window.
The sidebar project menu gets "Switch Worktree…", which opens the same
picker in the group's workspace.
The picker also opens with what the window already knows, instead of a
single row that the rest of the list replaces later:
- The repository scan records the remote default branch from its
existing `git for-each-ref` call, so the create row reads "based on
origin/main" from the first frame instead of switching from "main" after
a git round trip.
- Git rows come from the repository snapshot; the picker still asks git
when it opens and redraws only if the answer differs.
- Closed rows are read from disk when the picker opens and arrive in one
step.
Discovery reads only the store folders and git's worktree registries,
and refuses symlinks and special files.
A store checkout is listed only when its git directory is where Delta
puts that checkout's clone, so a folder Delta renamed aside, or a copy
in another namespace, is not offered.
Git runs only for the "main worktree" row and for reftable HEADs, with
the untrusted-repository options, a 5s timeout and kill on drop.
Known limitations:
- Checkouts mounted into a folder of the user's choosing (`delta
worktree mount <ref> <dir>`) are not listed, because finding them means
reading `.delta/clones`, which tracked content can control.
- A project group with no open workspace after a restart needs Focus
Project before "Switch Worktree…" appears.
- With AI disabled, switching away from the window's starting workspace
drops it without a save prompt, as the existing worktree switch does.
- Closed rows load after the picker opens, so the list grows once when
they arrive.
- The first frame's current-checkout row differs from git's when the
path is spelled differently (symlink, letter case, SSH to Windows), for
an unborn HEAD or orphan branch, and for a `core.bare` folder opened as
the project; the refresh corrects it.
- Collab guests who join after the host's last update see the create
row's base change once, as before.
Release Notes:
- N/A (Nighlty only)
## Summary
I ran into this while testing #67091 in a dev container, but it's
independent of that PR and reproduces on main: requesting completions in
a remote project (SSH, WSL, dev containers) and editing the buffer
before the request was sent (e.g. typing or deleting quickly after
completions trigger) could crash debug builds with `point ... is beyond
the end of the line`.
Since #42723, `LspStore::completions` builds the `GetCompletions` proto
requests inside `cx.spawn`, so the cursor position (a `PointUtf16`) is
only turned into an anchor on a later tick, after the edit may already
have changed the buffer. In release builds there is no panic, but the
request is sent for whatever that point now refers to in the edited
buffer (clamped if it's past the end of the line), so the server can
return completions for the wrong position.
Completions without an edit range used to be dropped when the request
position was out of range, which an anchor can't be.
Instead, `LspStore::completions` now records the word being completed
when completions are requested, and checks it once after all language
servers answer, in local and remote projects.
If the buffer changed meanwhile, those completions replace the word
around the moved position, starting no later than the requested word.
They are dropped, and the response is marked incomplete, when the
requested word was deleted, non-word text was typed before the cursor,
or the word now reaches across a deleted separator.
Release Notes:
- Fixed completions being requested at the wrong position in SSH, WSL
and dev container projects, and completions without an edit range
replacing the wrong text after edits made while they were loading
## Testing
Added `test_remote_completions_with_concurrent_edit`, which panics on
main and passes with this change:
```
cargo test -p remote_server test_remote_completions_with_concurrent_edit
```
Manually tested on Linux: Beforehand when working in the debug build
with a devcontainer, crashing happened frequently. Now i don't encounter
it anymore
## 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 completions in SSH, WSL and dev container projects sometimes
being requested at the wrong position when editing quickly
---------
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Remote projects sent every completion request as `INVOKED`:
`GetCompletions` had no trigger fields, so a server never saw the
trigger character typed on a remote client.
`GetCompletions` now carries the trigger kind and character, and the
host checks the character against the trigger characters of the server
that answers, as local projects already do.
Requests from older peers without `server_id` first resolve the first
capable server, so they get the same check.
Reusing an open complete menu did not cancel a refresh that was still in
flight.
After a quick backspace and retype, that refresh replaced the menu with
items filtered for the shorter query.
The reuse path now drops pending completion tasks.
Refreshes of incomplete lists still send `INVOKED`, not
`TriggerForIncompleteCompletions`.
https://github.com/zed-industries/zed/pull/21755 removed the latter
after vtsls returned wrong edits for it.
vtsls answers it from one per-process cache without document or position
checks, and the spec describes typing an identifier as `Invoked`.
Release Notes:
- Fixed completion trigger characters being lost in remote projects, and
a stale completion list appearing after quickly deleting and retyping a
character
## Summary
Registry agents installed from an archive live in one directory per
version, and every launch removed all older version directories. An
agent still running from one of them then broke, because adapters
resolve files next to their own binary on demand. After another session
installed a newer Claude Agent, the older session failed with "The
Claude CLI is missing" (agentclientprotocol/claude-agent-acp#1596).
A running agent now holds a lease on the version it was launched from,
and cleanup only removes versions that nobody holds a lease on.
- **The lease** is a shared file lock on `<version dir>.lease`. Every
Zed process that shares the data directory (stable, preview, nightly)
honors it, and the operating system releases it if Zed crashes.
- **Taking it** happens before checking whether the version is
installed, so a cleanup in another process can't remove the version
between that check and the agent starting.
- **Releasing it** happens when the agent process exits, not when the
connection is dropped. Threads keep a connection alive long after its
agent has exited, and that should not pin the version.
- **Cleanup** retires a version only if it can lock that version's lease
exclusively. A per-agent `leases.lock` serializes taking and removing
leases, so a lease file is never deleted between another process opening
and locking it.
- **Retiring** renames the version to `retired_<name>` while the leases
are locked, and deletes it after the lock is released. A version is
therefore never left half-deleted under a name that still looks
installed, and launching an agent doesn't wait for a deletion. A later
cleanup deletes any `retired_` directory that an interrupted one left
behind.
- **Installing** takes an exclusive per-agent `install.lock` and
re-checks for the version afterwards. Installing replaces the version
directory, so two windows installing the same version at once could
previously remove the directory the first agent was already running
from.
- **Remote projects**: the client launches the agent, so the remote
server never sees it exit. The server keeps the lease of every version
it resolved until the server itself exits.
A failure on one stale version is logged and the remaining ones are
still cleaned up.
### File locks in `Fs`
Locking goes through the `Fs` trait, like the rest of the store's file
access. This adds `Fs::lock_file` (waits for conflicting locks) and
`Fs::try_lock_file` (returns `None` instead of waiting). Both take a
`FileLockKind` (`Shared` or `Exclusive`), create the file if needed, and
return a `FileLock` that is released on drop.
- `RealFs` takes OS file locks through std. To wait, it opens the file
once and retries a non-blocking lock with a backoff (5 ms up to 250 ms).
A wait uses no thread and stops when its future is dropped. Waiting
inside the operating system instead would hold a blocking-pool thread
per waiter, even after cancellation, and enough waiters would starve the
lock holder's own file operations.
- `FakeFs` keeps an in-memory lock table keyed by inode and resolves the
file once before waiting. A lock is therefore on the file that was at
the path when it was requested, even if that file is removed or
replaced, as on a real file system. To keep that true,
`FakeFs::create_file` with `overwrite: true` now keeps an existing
file's inode instead of assigning a new one, which is how `FakeFs`
already treats writes to an existing file.
### Other API changes
`get_command` now returns a `ResolvedAgentServerCommand`, which bundles
the command with its lease, and the connect functions take that type.
Callers without an installation to protect build one with
`ResolvedAgentServerCommand::without_installation_lease`.
### Known limits
- A Zed build without this change takes no lease and still removes old
versions unconditionally. Two channels running side by side stay exposed
until both have the fix.
- The terminal login command is not leased, because the terminal
outlives the task that resolves the command.
- On a file system without lock support, the agent launches without a
lease and cleanup removes nothing.
- A Zed process that hangs while installing an agent keeps other
processes from installing that agent until it exits.
- Lock waiters poll, so one can notice a released lock up to 250 ms
late, and waiters are not served in order.
- Agents distributed through npx install in place and are not covered by
this change.
## Testing
Ran locally on macOS; CI covers Linux and Windows.
```sh
cargo test -p fs
cargo test -p project --lib -- agent_server_store
cargo test -p agent_servers --lib
cargo test -p remote_server -- agent
./script/clippy
```
New or changed tests:
- `test_realfs_file_locks` and `test_fake_fs_file_locks` run the same
assertions against both implementations: shared locks coexist, shared
and exclusive locks conflict, a waiting lock is granted once the
conflicting ones are released, a cancelled wait doesn't take the lock, a
waiter is granted the lock on the file it started waiting on even if
that file is removed or replaced, locking a dangling symlink creates its
target (resolving `..` through symlinked directories), and truncating a
file keeps the locks on it. On Windows, `RealFs` skips the removed-file,
truncation and symlink cases.
- `test_realfs_lock_waiters_leave_threads_for_file_operations`: with 512
waiters queued on a held lock, the holder can still use the file system.
It times out if waiting blocks a pool thread.
- `test_remove_stale_versioned_archive_cache_dirs` (on `FakeFs`): stale
versions, leftover lease files and leftover `retired_` directories are
removed; an older version with a held lease survives until the lease is
released; a version that can't be deleted doesn't keep the others on
disk; and a lease file is kept if its version exists.
- `registry_archive_version_is_installed_once_by_concurrent_launches`
(on `RealFs`): two launches of the same uninstalled version download it
once. It fails without the install lock.
- `registry_archive_version_is_kept_while_its_lease_is_held` (on
`RealFs`): installs through `get_command`, checks the version survives
cleanup while the lease or a clone of it is held, is removed once
released, and reinstalls afterwards.
- `installation_lease_is_released_when_the_agent_exits`: the lease is
released when the agent process exits, while its owner is still alive.
Checked by hand, not in the repo:
- With a throwaway program: another process sees a lock as held, it is
released when the holder is killed with SIGKILL, and a child spawned by
the holder does not inherit it.
Not tried against a real adapter update in a running Zed.
## Self-review
- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [ ] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist). (No UI
changes.)
- [x] Tests cover the new or changed behavior.
Release Notes:
- Fixed external agents installed from the ACP registry breaking (for
example Claude Agent reporting "The Claude CLI is missing") when a newer
version was installed while an older one was still running.
Closes#58222Closes#59088Closes#58148
In a remote project (SSH, WSL, or a dev container), global skills came
from your local `~/.agents/skills`. The remote machine's own
`~/.agents/skills` was ignored, and when the agent tried to read or edit
a skill file it looked on the local disk.
Global skills in a remote project now come from the remote machine. The
remote server loads and watches its `~/.agents/skills` and tells Zed
when it changes.
What changed:
- The agent lists the remote's global skills, and picks up new, edited
and deleted ones without a restart.
- Using a skill, or mentioning one, reads its `SKILL.md` from the
remote.
- The agent's file tools (read, list, edit, write, create directory,
copy, move, delete) work on the remote's `~/.agents/skills`. They still
ask before changing anything there, even when the tool is set to always
allow.
- The User tab of the Skills settings page lists, creates and deletes
skills on the remote, and says which machine it is showing.
- Opening the global `AGENTS.md` from a remote project shows a read-only
copy. The file lives on your local machine, and Zed used to look for it
on the remote.
- Local projects work the same as before.
Some calls I made:
- A remote project uses only the remote's global skills, not both. The
agent's tools take a plain path, and
`~/.agents/skills/my-skill/SKILL.md` could then mean a file on either
machine. A local skill's scripts also wouldn't exist on the remote,
where the agent's terminal runs.
- The check for "is this path inside the skills folder" runs on the
remote. Only that machine can resolve `..` and symlinks in a path on its
disk.
- The remote only sends each skill's name and description. The body is
read when the skill is used.
- The agent now rebuilds its project context when the project's visible
folders change, not on every worktree added or removed. Reading a remote
skill file opens it outside the project, and that used to trigger a
rebuild each time.
Left out on purpose:
- The Skills settings page still doesn't list skills until a Zed Agent
thread has been started (#59543). That also happens in local projects.
- Collab guests keep using their own local global skills.
Release Notes:
- Added support for global skills from the remote machine's
`~/.agents/skills` in remote projects (SSH, WSL, and dev containers).
Remote files lose their `is_private` flag, leaving `.env` values visible
over SSH even with `redact_private_values` enabled. Preserve the flag in
file metadata so the editor's existing redaction works remotely.
Testing: all 71 remote-server tests pass. Both new regressions fail with
the original decoder. Verified masking over SSH from macOS to Linux.
## Self-review
- [x] Reviewed for quality, security, reliability, and performance.
- [x] UI [checklist](https://zed.dev/docs/development/ui-checklist):
verified dark/light themes and the redaction setting over SSH.
- [x] Tests cover the changed behavior.
Release Notes:
- Fixed `.env` values remaining visible over SSH when
`redact_private_values` is enabled.
Persist whole-store permission snapshots through desktop and remote settings adapters. Carry execution bills into approval requests and prompt locally or through the remote client when policy requires approval, while keeping missing user settings permissive.
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
Upgrades `agent-client-protocol` from 3.6.0 (schema 1.13.0) to 5.0.0
(schema 1.15.1), and brings Zed's v1 and v2 ACP clients in line with the
spec and schema changes made since then.
## SDK 5 port
- Schema types move from `schema::v1`/`schema::v2` to
`v1::schema`/`v2::schema`, builders to `Client.v1()`, and v2 handle
types to `agent_client_protocol::v2`.
- `agent_client_protocol::Error` is now the SDK's own type, not the v1
schema error. Zed uses it at the SDK boundary, and `ProtocolErrorInfo`
also recognizes it so auth-required detection keeps working.
- Foreground dispatch helpers are generic over the protocol marker, and
v2 request IDs come straight from the handles.
- SDK 5 only matches transport-closed errors that the SDK itself
produced, so peers can't forge them. A test that built one by hand now
covers only the local disconnect case. The `agent_servers` tests still
cover real transport loss.
## Spec changes
- `session/close` and `session/delete`: a `-32002` response counts as
success, on both v1 and v2.
- Permission and elicitation requests that name an unknown session get
`-32002` with `data.sessionId` instead of `-32603`. The v2 migration
guide makes this required for Clients too.
- v2 `usage_update.cost` is a patch field: omitted leaves it unchanged,
`null` clears it. A v1 update without a cost still leaves it unchanged.
- A `plan_update` whose type Zed can't render (`file`, `markdown`, or an
unknown type) still replaces the plan with that `planId`, so the old
entries stop showing.
- A diff `patch` with an unrecognized `format` renders from `changes`,
as if `patch` were omitted.
- v2 never sends an empty prompt.
- On v2, `session/cancel` no longer answers pending permission requests
locally. They stay open until the agent cancels them with
`$/cancel_request`, because requests for background work survive a
cancel. v1, including v1 subagents, keeps answering them with
`cancelled`.
## Follow-ups
These are left for separate PRs:
- Background-work UI: the `paused` status, the `background` list, and
cancel buttons for tool calls and terminals. Until then, `paused`
displays as in progress, which the spec allows.
- Subagent `cwd` and `additionalDirectories`.
- The new unstable methods: `auth/status`, `session/set_title`,
`session/status`, `session/archive`.
Release Notes:
- Improved compatibility with the latest Agent Client Protocol,
including handling of missing sessions, plan updates, diff formats, and
cancellation of permission requests.
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>
## 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.
## 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>
Closes#62283Closes#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.
## 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>
# Objective
- Fixes#64128 dragging a file onto a folder that already contains a
file with the same name showed only Error: renaming "/a/1.json into
"1.json". The reason why was buried inside the error because the pop-up
prints only the outermost layer.
## Solution
undo.rs:
-Extracted the existing already_exists check into a module level
pub(crate) function which walks the error chain for
io::ErrorKind::AlreadyExists with a fallback that looks for the text
"already exists." Undo's rename now calls that function so it behaves
exactly like before.
- Made project_path_display() a pub(crate) fn so the project panel can
format names the same way undo does.
project_panel.rs:
- move_worktree_entry() now hands back the destination path along with
the rename task instead of discarding it.
- drag_onto() builds (from, to) names from old_paths and the returned
destination. This hapens while the project can still be read and before
anything moves.
- explain_move_error(err, names) -> anyhow::Error when names are
available and the error is "already exists," it adds the clear message
with err.context(...), otherwise it returns the error unchanged.
- drag_onto() - both result loops (normal and folded folders) - each now
destructures three items and calls .map_err(|err|
explain_move_error(err, names.as_ref()) just before
.notify_workspace_async_err()
## Testing
- (#[gpui::test]) test_drag_onto_existing_name_shows_clear_error drags
a/1.json onto a root that already has 1.json. It checks that both files
keep their original contents and that exactly one notification appears.
- (#[test]) test_explain_move_error covers the three cases
1. an already-exists error gets the clear message.
2. a different error passes through untouched.
3. with no names, the error passes through untouched.
- Both new tests pass.
- The unit test fails when detection is broken on purpose by returning
false in the new pub(crate) fn already_exists_error, so it does guard
the message logic.
## 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
<details>
<summary>Click to view showcase</summary>
<img width="495" height="150" alt="before_zed_project_panel_name_error"
src="https://github.com/user-attachments/assets/735eb482-f4b9-4502-b810-782180c3b40c"
/>
<img width="495" height="150" alt="after_zed_project_panel_name"
src="https://github.com/user-attachments/assets/e7e9c30f-e171-4ce7-a3fd-c0f2690c08f5"
/>
<img width="217" height="186" alt="zed_test_panel_shot"
src="https://github.com/user-attachments/assets/8d76e18a-9695-4f4a-8231-785ae140c73e"
/>
</details>
---
Release Notes:
- Improved the error message in the project panel when moving a file or
folder onto a location where one with the same name already exists
---------
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
When connecting to a Windows host over SSH, the proxy fails to start the
daemon and the user sees "failed to spawn server."
**Root cause**
`spawn_server_windows` invokes the daemon via
`shell_execute_from_explorer`, which goes through COM `ShellWindows` /
`IShellDispatch2::ShellExecute`. That path requires both:
- `explorer.exe` running in the caller's session, and
- an interactive desktop / window station.
Neither is available when `zed-remote-server proxy` is launched by sshd:
sshd-spawned processes live in a non-interactive window station with no
Explorer. The COM call fails, the `run` daemon never starts, the proxy's
10s socket-existence poll times out, and the connection fails.
A commenter on #48966 reports the connection succeeds after first
logging in via RDP, which is consistent with this diagnosis: RDP login
populates the session with `explorer.exe` and an interactive window
station.
**Fix**
Replace the COM path with a direct `Command::spawn`, matching the
non-Windows branch. Use `DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP`
creation flags so the daemon has no inherited console and is not killed
by Ctrl+C/Break broadcast to the parent's group when the proxy exits.
Bypass `util::new_command` because it presets `CREATE_NO_WINDOW`, which
Win32 disallows combining with `DETACHED_PROCESS`. Drop one layer to
`smol::process::Command` directly to keep the disallowed-methods lint
happy.
Also drop the now-unused `shell_execute_from_explorer` module and the
`windows` crate dependency it pulled in.
No automated test is included: exercising this path requires a headless
OpenSSH-Server-on-Windows host with a non-interactive window station,
which CI doesn't currently provide. Verified manually that macOS client
-> Windows host over SSH establishes the connection successfully where
it previously timed out.
Closes#48966
Self-Review Checklist:
- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable
Release Notes:
- Fixed remote server failing to start when connecting to a Windows host
over SSH
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: John Tur <john-tur@outlook.com>
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
## Summary
I encountered the same issue as #48253, and it's really frustrating.
I asked GPT to analyze the potential causes, and the results suggest
this might be a contributing factor.
In the previous implementation, log writing could block RPC processing
and RPC read/write could also block each other, so I decoupled them in
this PR.
## Testing
Two new tests
## 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 remote server responsiveness when log or RPC response writes
are blocked.
# Objective
- Makes shell for remote configurable.
- fixes#35226
## Solution
- Adds rpc so client can retrieve terminal settings from remote server
- Vibe coded with codex Sol, I did my best to review it and make sure
it's the minimal changes.
- Added terminal dependency to remote_server, rather than a larger
change (e.g. adding something to project to expose terminal shell
setting to remote_server)
## Testing
- Tested and works Windows client / linux remote server
## Self-Review Checklist:
- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] Tests cover the new/changed behavior
- [ ] Performance impact has been considered and is acceptable
---
Release Notes:
- Added support for terminal.shell in remote sessions
---------
Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
LSP log streams can be consumed by split views and downstream clients.
Treating enablement as a single value lets one consumer disable a stream
that another consumer is still using.
Track the streams enabled by each view and reference-count each exact
server and log kind. Keep in-process view ownership separate from
downstream requests, preserve RPC capture while either has an active
consumer, and notify remote hosts only on the first enable and final
disable.
Represent log kinds independently so split views can consume logs,
traces, and RPC messages without overwriting one another.
---
This PR is a stacked follow-up to #61221. It is split out because
project isolation is independently mergeable, while reference-counting
changes the ownership and lifecycle semantics of LSP log streams and
benefits
from separate review.
---
Release Notes:
- Fixed closing one LSP Logs view stopping streams used by another view
or downstream client
---------
Co-authored-by: zed-zippy[bot] <234243425+zed-zippy[bot]@users.noreply.github.com>
# Objective
- This PR fixes#63760. According to git docs "Patterns read from
$GIT_DIR/info/exclude".
## Solution
- We were reading the directory's absolute path instead of reading the
absolute path to the repository's common .git directory.
## Self-Review Checklist:
- [x] I've reviewed my own diff for quality, security, and reliability
- [ ] 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
---
Release Notes:
- Fixed "Add to .git/info/exclude" not working when used from a
secondary git worktree
---------
Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
Closes https://github.com/zed-industries/zed/issues/64118https://github.com/user-attachments/assets/f2152411-6011-4d87-8c8e-d83bed0afbbc
`ty` returns completion text without a `textEdit` or a completion-list
default edit range:
```json
{"label":"value2=","insertText":"value2="}
```
The [LSP
specification](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#completionItem)
explicitly states:
> The `insertText` is subject to interpretation by the client side.
For the reported example, `ˇ` marks the cursor:
```py
test(value1, ˇvalue2)
```
Previously, Zed inferred only a range covering the existing `value2`.
Without an insert range, completion acceptance bypassed
`completions.lsp_insert_mode` and replaced that argument with `value2=`,
producing:
```py
test(value1, value2=)
```
The patch also infers an insert range, ending at the cursor rather than
the end of the word.
This lets the existing setting choose between inserting before `value2`
and replacing it.
When a prefix has already been typed, insertion replaces that prefix
while preserving the text after the cursor.
With the unchanged default, `"replace_suffix"`, Zed replaces text after
the cursor only when it is a suffix of the completion’s label.
Here, `value2` is not a suffix of `value2=`, so Zed inserts and
produces:
```py
test(value1, value2=value2)
```
The suffix and subsequence checks now use the raw LSP `label`, not
decorated menu text or `filterText`.
These checks select the edit range; `insertText` still supplies the
inserted text in this example.
Release Notes:
- Fixed insertion modes for completions without edit ranges
# Objective
Fix an issue in SSH remote mode where reopening a newly created file at
a path that was previously renamed could incorrectly reuse the buffer
for the renamed file.
## Solution
When handling UpdateBufferFile, remove the buffer's previous path from
path_to_buffer_id when the file path changes.
## Testing
Tested manually on Linux using SSH remote mode.
Reproduction before the fix:
touch A
Open A from the project panel
mv A B
touch A
Open the new A from the project panel
Before the fix, opening A reused the buffer for B.
After the fix:
B continues to use the original buffer.
The recreated A opens as a separate buffer.
Renaming an opened remote file still updates the existing buffer to the
new path correctly.
## 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 an issue in SSH remote mode where reopening a newly created file
at a path that was previously renamed could incorrectly reuse the buffer
for the renamed file.
---------
Signed-off-by: xiaoff <xiaoff0019@outlook.com>
Co-authored-by: Kirill Bulatov <kirill@zed.dev>
Zed did not advertise document highlight dynamic registration support or
handle `textDocument/documentHighlight` registrations. Dynamically
registered providers therefore fell through to the unhandled-capability
path, while servers with a fallback had to advertise a static provider
for every attached document.
Advertise dynamic registration support and track document highlight
registrations and unregistrations alongside the other selector-aware
dynamic text document capabilities. Refresh editors whenever the
effective document highlight registration state changes, including
selector-only changes that leave the merged provider unchanged, so
runtime registrations take effect immediately and unregistrations clear
stale or in-flight highlights.
Add coverage for the client capability, registration lifecycle with
multiple selectors sharing identical provider options, and editor
refresh behavior when an applicable selector is added or removed.
## 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:
- N/A
---------
Co-authored-by: GPT-5.6 Sol <noreply@openai.com>
Co-authored-by: Kirill Bulatov <kirill@zed.dev>
This is a pure refactoring PR to make our FS watching code more
testable. It does two things:
1. Make the `GlobalWatcher` be owned by `RealFs` or `FakeFs` instead of
being a process-wide global.
2. Delete `FakeWatcher` and its `Watcher` implementation, and instead
mock the notify crate itself in `FakeFs` tests via the existing
`WatchBackend` trait. Now all our FS watching code down to the notify
boundary runs the same in tests and production.
Release Notes:
- N/A
Zed previously discarded the documentSelector from dynamically
registered textDocument capabilities and treated those capabilities as
applicable to every buffer attached to the server. This could route
requests for documents outside a registration selector.
Track dynamic textDocument registrations by method and registration ID,
and use their selectors when routing local requests, checking
capabilities, and deriving completion triggers. Static capabilities
continue to apply to every attached buffer. Language and URI scheme
matching are supported, while unsupported pattern matching remains
fail-open.
Keep document color, symbol, link, code lens, and folding range caches
aligned with the selector-aware server set so incapable or non-matching
servers do not leave caches perpetually incomplete.
Require an advertised diagnostic provider before sending pull diagnostic
requests, and add integration coverage for selector-aware dynamic
completion registration and trigger updates.
---
Release Notes:
- Improved language server request routing to respect dynamically
registered document selectors.
---------
Co-authored-by: Kirill Bulatov <kirill@zed.dev>
The language registry and LSP log store are shared by every workspace in
a Zed process. The LSP Logs selector enumerated the shared log store
without filtering by project, while each activity indicator consumed
global binary status updates. This exposed servers from other windows as
"Unknown worktree" entries and surfaced their startup failures or
timeouts in unrelated status bars.
Key each logged server by its owning project or LSP store together with
its process-local language server ID. Use that identity consistently
when adding, removing, streaming, selecting, opening, and reselecting
log entries so local, remote, SSH, and supplementary servers cannot
collide across ownership domains.
Model Copilot and other servers outside the project LSP store as
project-scoped supplementary servers, while matching SSH servers by
their owning LSP store.
Tag project-originated binary status updates with the owning LSP store
entity ID. Carry that source through extension worktree delegates and
every worktree-based WASM language-server call, then let each local LSP
store forward only statuses for its project. Activity indicators rely
solely on their project LSP store, and remote projects continue to
receive host statuses through the existing protocol path instead of
subscribing to local registry events.
Own each binary-status subscription task in its local LSP store and
unregister its broadcaster sender when the store is dropped, so closing
windows cannot leave detached status tasks or stale senders behind.
Add regression coverage for duplicate process-local server IDs across
ownership domains, filtering remote, supplementary, and SSH servers from
other projects, retaining servers owned by the current project or LSP
store, preserving extension status sources, and unregistering dropped
status subscriptions.
Release Notes:
- Fixed language servers from other projects appearing in the LSP Logs
view and their statuses showing in unrelated windows' status bars
## Objective
Fixes an issue where language servers provided by extensions are not
included in the settings schemas served by remote servers. When
connecting to a remote server via the
`open_remote_project_with_existing_connection` flow (dev servers,
multi-workspace reopen, git worktree picker), setup-N servers never
received any extension sync, so their schemas omitted extension-provided
language servers, breaking language support for remote development.
## Solution
Three changes ensure that language servers provided by extensions are
included in the settings schemas served by remote servers:
1. **Register connections opened via
`open_remote_project_with_existing_connection` with the extension
store**: dev servers, multi-workspace reopen, and the git worktree
picker now register their connections with the extension store so that
extensions are synced to those servers. Previously only the
`open_remote_project` flow did this, so setup-N servers never received
any extension sync and their schemas omitted extension language servers.
2. **Emit `ExtensionsInstalledChanged` from `HeadlessExtensionStore`
after sync and install complete**: this allows the remote process to
invalidate its cached settings schemas. The local `ExtensionStore`
already emitted this event; without it, the remote schema cache stayed
stale for the lifetime of the server process.
3. **Include available LSP adapters in the project settings schema**:
this matches the user settings schema (this was fixed for `settings` in
#46766 but never applied to `project_settings`).
## Testing
- Manually verified that after connecting to a remote server via the
`open_remote_project_with_existing_connection` flow (including dev
servers and the git worktree picker), extension language servers appear
in the schema served by the remote server.
- Verified that `ExtensionsInstalledChanged` is emitted after sync and
install complete, and that the remote schema cache is correctly
invalidated and rebuilt.
- Verified that the `project_settings` schema includes the available LSP
adapters, matching the behavior of the user settings schema.
- Reviewers should focus on the multi-workspace reopen and git worktree
picker flows (the two previously unregistered flows) to confirm that
extension language servers are correctly synced and appear in the
schema.
## Self-Review Checklist:
- [x] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [ ] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable
## Showcase
**Server / Project** — before the fix
<img width="1061" height="749" alt="image"
src="https://github.com/user-attachments/assets/d6c5459f-58fb-4769-a701-f6fb317adc37"
/>
**Local**
<img width="1119" height="449" alt="image"
src="https://github.com/user-attachments/assets/fb30a1e2-74f0-4439-a25f-1022ed164074"
/>
---
Release Notes:
- Fixed an issue where language servers provided by extensions were
missing from settings schemas served by remote servers.
---------
Co-authored-by: vancez <vancez@users.noreply.github.com>
Co-authored-by: Kirill Bulatov <kirill@zed.dev>
Closes https://github.com/zed-industries/zed/issues/9318
Most of the diff is tests.
Notable behavior changes during this mode, compared to current mode:
* unsaved changes in multi buffer won't spawn any "save or not" pop-ups
during typing — submitting the query still does it, as before.
Unsaved files will stay so after being sorted out on typing: we cannot
save them by default as file-less buffers need a save modal; Zed should
already be able to persist and restore such changes on restart.
* gutter may jump during search, if new excerpts with large line numbers
appear during query input — yet it would not shrink back to avoid
excessive flickering and rewraps
Release Notes:
- Enabled project search on type by default (use `{ "search": {
"search_on_type": false } }` to restore the previous behavior)
Closes#39860
This PR resolves relative image paths from the Markdown source file's
project path and load images through the project image store. SVG images
over remote connections remain unsupported and are left for a follow-up.
Release Notes:
- Fixed images not rendering in Markdown Preview over remote.
This adds a dedicated `AvailableLanguages` struct in preparation for a
more cabable language matching based on a given language config. No
functional changes, just shuffling some code around for this round.
Also made the LanguageMatcher non-cloneable in favor of wrapping it in
an Arc, since cloning is rather expensive for this and having a
reference is sufficient in all cases right now.
Release Notes:
- N/A
---------
Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
extends the precedent set by #43703 (thanks @reflectronic) so that
`textDocument/inlayHint`, `textDocument/codeLens`, and
`textDocument/documentSymbol` correctly track multiple dynamic
registrations by id. previously each register call overwrote the slot on
`ServerCapabilities`, and unregister either silently did nothing
(inlayHint, documentSymbol — no match arm) or wiped the entire
capability (codeLens). now each method keeps its own id-keyed map on
`DynamicRegistrations`; the field on `ServerCapabilities` is cleared
only when the last registration is removed.
textDocument-sync notifications (`didChange`/`didSave`/`willSave`) are
deliberately out of scope — their fan-out semantics are ambiguous in the
spec and were flagged on @smitbarmase's earlier exploration in #36876.
verified with `cargo check -p project -p lsp -p editor`, `cargo test -p
project --test integration -- multi_registration` (3/3 passing), and
`cargo fmt -p project`.
closes part of #37838.
Release Notes:
- Improved support for language servers that dynamically register inlay
hints, code lens, or document symbols multiple times.
---------
Co-authored-by: Kirill Bulatov <kirill@zed.dev>
## Summary
Fixes the git commit template not loading in remote (SSH) projects. The
`load_commit_template_text` method in `git_store.rs` was a no-op for
`RepositoryState::Remote`, always returning `Ok(None)`. This patch adds
a `LoadCommitTemplate` RPC so the client can ask the remote host to read
its `commit.template` git config and return the file contents —
mirroring the existing `GetBlobContent` pattern.
## Changes
- **`crates/proto/proto/git.proto`** — new `LoadCommitTemplate` /
`LoadCommitTemplateResponse` messages.
- **`crates/proto/proto/zed.proto`** — registered envelope IDs 449/450.
- **`crates/proto/src/proto.rs`** — wired up message priority, request
pairing, and entity-message routing.
- **`crates/project/src/git_store.rs`** — added
`handle_load_commit_template` on the host side; replaced the `Ok(None)`
no-op on the remote side with the RPC call.
## Self-Review Checklist
- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments — *no unsafe code
added*
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
— *no UI changes*
- [ ] Tests cover the new/changed behavior — *see "Testing notes" below*
- [x] Performance impact has been considered and is acceptable — *one
extra RPC on commit panel open for remote projects only; payload is a
single optional string*
## Testing notes — why no automated test
I did write an integration test (`test_remote_git_commit_template` in
`collab/tests/integration/git_tests.rs`, modeled after
`test_remote_git_head_sha`) along with the supporting changes to
`FakeGitRepositoryState` (adding a `commit_template` field +
`set_commit_template_for_repo` setter on `FakeFs`, since the fake
hardcoded `load_commit_template` to `None`).
The test compiled and the smaller crates (`fs`, `proto`, `project`)
checked clean, but `cargo test -p collab --test collab_tests`
cold-compile takes a very long time on my machine and I wasn't able to
confirm the test actually passed locally. Rather than push a test I
hadn't seen pass, I removed it. Happy to add it back in a follow-up PR
(or in this one if reviewers prefer) once I can run the collab suite
end-to-end — the diff is small and I can share it on request.
Verification was done end-to-end manually using a Docker dev container
as the SSH remote:
#### Closes#55265
Video :
[Screencast from 2026-05-02
18-09-03.webm](https://github.com/user-attachments/assets/9cb7f375-57fa-4af3-bde4-871c28f61efc)
Release Notes:
- Added support for loading git commit template messages in both remote
and collab projects.
---------
Co-authored-by: dino <dinojoaocosta@gmail.com>