Commit graph

3042 commits

Author SHA1 Message Date
Mikayla Maki
17adc40d61
Implement sidebar rendering of the configured worktrees (#51342)
Implements worktree support for the agent panel sidebar

Before you mark this PR as ready for review, make sure that you have:
- [x] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [x] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- N/A
2026-03-12 17:53:38 +00:00
Lukas Wirth
9ddf672d57
project: Fix semantic tokens coloring deleted diff hunks (#51386)
Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-03-12 14:26:16 +01:00
Nelson Campos
314b7e55fb
debugger: Fix restart only working once per session (#51247)
`Session::restart_task` is set to `Some` when a restart is initiated but
never cleared back to `None`. The guard at the top of `restart()` checks
`self.restart_task.is_some()` and returns early, so only the first
restart attempt succeeds.

This primarily affects debug adapters that advertise
`supportsRestartRequest` dynamically via a `CapabilitiesEvent` after
launch, such as the Flutter debug adapter.

Related: https://github.com/zed-extensions/dart/issues/45

Before you mark this PR as ready for review, make sure that you have:
- [x] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
(N/A — no UI changes)

Release Notes:

- debugger: Fixed debug session restart only working once when the
adapter supports DAP restart requests.

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Anthony Eid <anthony@zed.dev>
2026-03-12 13:05:52 +00:00
Imamuzzaki Abu Salam
e9e71431bb
Add size to DiskState to detect file changes (#49436)
## Summary

This fix addresses the cross-platform root cause identified in issue
#38109 where open buffers go stale or empty when external tools write
files.

## The Problem

The buffer's `file_updated()` method was only comparing `mtime` to
determine if a buffer needed to be reloaded. This caused a race
condition when external tools write files using `std::fs::write()`,
which uses `O_TRUNC` and creates a brief window where the file is 0
bytes:

1. Scanner re-stats → sees 0 bytes, mtime T
2. `file_updated()` sees mtime changed → emits `ReloadNeeded`
3. Buffer reloads to empty, stamps `saved_mtime = T`
4. Tool finishes writing → file has content, but mtime is still T (or
same-second granularity)
5. Scanner re-stats → mtime T matches `saved_mtime` → **no reload
triggered**
6. Buffer permanently stuck empty

## The Fix

Release Notes:

- Add the file `size` to `DiskState::Present`, so that even when mtime
stays the same, size changes (0 → N bytes) will trigger a reload. This
is the same fix that was identified in the issue by @lex00.

## Changes

- `crates/language/src/buffer.rs`: Add `size: u64` to
`DiskState::Present`, add `size()` method
- `crates/worktree/src/worktree.rs`: Pass size when constructing File
and DiskState::Present
- `crates/project/src/buffer_store.rs`: Pass size when constructing File
- `crates/project/src/image_store.rs`: Pass size when constructing File
- `crates/copilot/src/copilot.rs`: Update test mock

## Test plan

- [ ] Open a file in Zed
- [ ] Write to that file from an external tool (e.g., `echo "content" >
file`)
- [ ] Verify the buffer updates correctly without needing to reload

Fixes #38109

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: Ben Kunkle <ben.kunkle@gmail.com>
Co-authored-by: Jakub Konka <kubkon@jakubkonka.com>
2026-03-10 13:55:57 -05:00
Bennet Bo Fenner
e4b3c0fa84
agent: Re-use ACP connections per project (#51209)
Release Notes:

- N/A

---------

Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
2026-03-10 17:32:51 +00:00
lex00
50aef1f115
buffer: Reload after undo when file changed while dirty (#51037)
Closes #48697
Supersedes #48698
Related to #38109

## Problem

If you edit a file and an external tool writes to it while you have
unsaved changes, Zed tracks the new file but skips the reload to
preserve your edits. If you then undo everything, the buffer goes back
to clean but still shows the old content. The disk has moved on, but
nothing triggers a reload.

## Fix

In `did_edit()`, when the buffer transitions from dirty to clean, check
if the file's mtime changed while it was dirty. If so, emit
`ReloadNeeded`. Only fires for files that still exist on disk
(`DiskState::Present`).

7 lines in `crates/language/src/buffer.rs`.

### No double reload

`file_updated()` suppresses `ReloadNeeded` when the buffer is dirty
(that's the whole bug). So by the time `did_edit()` fires on
dirty-to-clean, no prior reload was emitted for this file change. The
two paths are mutually exclusive.

## Test plan

- New: `test_dirty_buffer_reloads_after_undo`
- No regression in `test_buffer_is_dirty` or other buffer tests
- All project integration tests pass
- clippy clean

Release Notes:

- Fixed an issue where buffer content could become stale after undoing
edits when an external tool wrote to the file while the buffer was
dirty.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Ben Kunkle <ben@zed.dev>
2026-03-10 16:22:03 +00:00
Lukas Wirth
b21f4a3deb
Prevent remote edits from triggering edit predictions when collaborating (#51196)
BufferEvent::Edited had no way to distinguish local edits from remote
(collaboration) edits. This caused edit prediction behavior to fire on
the guest's editor when the host made document changes.

Release Notes:

- Fixed edit predictions triggering on collaboration guests when the
host edits the document.

---------

Co-authored-by: Ben Kunkle <ben@zed.dev>
2026-03-10 15:23:49 +00:00
Anthony Eid
d18e4a75bc
git: Add SSH support for removing and renaming git worktrees (#50759)
This should be the last step in implementing full git worktree support
in the `GitStore`. We still need to add UI for that allows a user to
rename a git worktree and, by extension git branches if we use the git
picker to do so.

Also, I added a helper function called `disallow_guest_request::<T>` to
the `Collab::rpc` that is used to specify a proto request isn't allowed
to be sent by a guest. This enabled me to add a regression test that
checks that a guest isn't allowed to delete a git worktree, without the
test hanging forever because it's waiting for the proto server to
respond.

Since SSH connections send the proto message directly from client to
remote host, this won't affect those requests.

Before you mark this PR as ready for review, make sure that you have:
- [x] Added solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- git: Add SSH support for removing git worktrees
2026-03-10 14:57:06 +00:00
Ben Brandt
a99366a940
agent_servers: Use correct default settings (#51136)
These are edge cases, but there are a few ways you can get into a state
where you are setting favorites for registry agents and we don't have
the setting yet. This prioritizes `type: registry` for agents that we
have in the registry, especially the previous built-ins.

Release Notes:

- N/A
2026-03-09 22:41:59 +00:00
Piotr Osiewicz
97421c670e
Remove unreferenced dev dependencies (#51093)
This will help with test times (in some cases), as nextest cannot figure
out whether a given rdep is actually an alive edge of the build graph

Closes #ISSUE

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [ ] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- N/A
2026-03-09 13:22:12 +01:00
Shuhei Kadowaki
9663d059bc
extension_api: Add language server schema methods (#48334)
(This should be merged after #48332)

This PR exposes the LSP settings schema functionality to extensions,
allowing them to provide JSON schema for `initialization_options` and
`settings` fields to enable autocomplete in settings files.

New extension API methods (v0.8.0+):
- `language_server_initialization_options_schema`
- `language_server_settings_schema`

Both methods return an optional JSON string conforming to JSON schema.
Older extension versions gracefully return `None`.

Release Notes:

- Added support for settings schemas for the next version of the
extension API so that settings autocompletion can be provided for
language server settings.

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: MrSubidubi <finn@zed.dev>
2026-03-07 11:05:10 +01:00
Oliver Azevedo Barnes
ba3aea0a55
agent: Don't connect to MCP servers when AI is globally disabled (#47857)
Closes #46846

When `disable_ai: true` is set in user settings, Zed was still
connecting to configured MCP (context) servers and sending
initialization requests. This change adds checks for `DisableAiSettings`
in `ContextServerStore` to:

- Skip server connections when AI is disabled
- Disconnect from running servers when AI becomes disabled
- Connect to servers when AI is re-enabled
- Prevent registry changes from triggering connections while AI is
disabled

The fix tracks `ai_disabled` state to detect transitions and properly
manage server connections when AI is toggled.

Release Notes:

- Fixed Zed connecting to MCP servers when AI is disabled.

---------

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
2026-03-06 17:21:44 +01:00
Xin Zhao
09b4140b80
lsp: Use correct LSP adapter for completion labels in remote development (#50697)
Closes #47917

Currently, during remote development, Zed uses the first available local
LSP adapter to handle all label computing. This isn't ideal and causes
bugs because different adapters may expect different label formats. By
leveraging the `all_capable_for_proto_request` method, we can now
retrieve the specific language server name and use it as a key to find
the correct LSP adapter for label population. Even if this lookup fails,
we can still fall back to the first adapter, so this PR should provide
more accurate label population than before.

This addresses the root cause of #47917, which stems from two main
issues. For example, in remote Python development, the `basedpyright`
adapter might incorrectly handle labels even when the remote server is
actually `ty`. The completion items returned by `ty` are slightly
different from `basedpyright`: `ty` stores labels in
`labelDetails.detail`, while basedpyright uses
`labelDetails.description`. By matching the correct adapter, we ensure
labels are populated properly for completion items.
```json
// RPC message returned by `ty`, label is in `labelDetails.detail`
{
  ...
  "labelDetails": { "detail": " (import pathlib)" },
  ...
}

// RPC message returned by `basedpyright`, label is in `labelDetails.description`
{
  ...
  "labelDetails": { "description": "pathlib" },
  ...
}
```
Additionally, adapters registered via `register_available_lsp_adapter`
are lazy-loaded into the `LanguageRegistry` (which is the case for `ty`
before). In remote scenarios, the adapter might be loaded on the remote
server but not on the local host, making it hard to find in
`lsp_adapters`. This is partially resolved in #50662, and combined with
this PR, we can fully address #47917.

There is still more to do, however. In some cases, we still can't find
the correct local LSP adapter if the local host lacks the registry that
the remote server has; this typically happens when the adapter is
registered via `register_available_lsp_adapter`. I've opened a feature
discussion #49178 to track this. If it's decided that this needs further
refinement, I'm happy to continue working on it.


Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [x] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- Fixed missing labels for `ty` completion items in remote development.
2026-03-06 14:11:16 +00:00
João Soares
e3d0a35b73
Fix formatter: "auto" to skip language servers that can't format (#50661)
Closes #50631

Before you mark this PR as ready for review, make sure that you have:
- [x] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- Fixed `formatter: "auto"` silently doing nothing when the first
language server for a language doesn't support formatting (e.g., Dependi
before Tombi for
TOML).
2026-03-06 09:31:33 +00:00
Ben Brandt
90ae70874e
agent: Gate agent registry refresh behind Disable AI setting (#50868)
Make sure we don't download this file if disable_ai is enabled

Release Notes:

- N/A
2026-03-05 21:13:24 +00:00
David Alecrim
53fca25ba5
git_ui: Add ability to delete git worktrees from picker (#50015)
Adds the ability to delete a git worktree directly from the worktree
picker, inspired by the existing branch delete functionality.


(`cmd-shift-backspace` on macOS, `ctrl-shift-backspace` on
Linux/Windows).

Screenshot:
<img width="1288" height="466" alt="Screenshot 2026-02-24 at 16 01 05"
src="https://github.com/user-attachments/assets/6ca5048d-63fa-4295-a578-358904bb92eb"
/>

Release Notes:

- Added the ability to delete a git worktree from the worktree picker

---------

Co-authored-by: Anthony Eid <anthony@zed.dev>
2026-03-04 21:49:06 +00:00
Conrad Irwin
0fc5bc2e89
debugger: Reverse Python repr escaping (#50554)
Closes #37168

Authored-By: @ngauder

Release Notes:

- debugger: Unescape Python strings

Co-authored-by: Nikolas Gauder <nikolas.gauder@tum.de>
2026-03-04 12:55:20 -07:00
Anthony Eid
5c91ebf1fe
git: Move diff num stat calculation to repository snapshot layer (#50645)
Follow up on: https://github.com/zed-industries/zed/pull/49519

This PR reworks how Zed calculates diff num stats by moving the
calculation to the `RepositorySnapshot` layer, instead of the
`GitPanel`. This has a couple of benefits:

1. Snapshot recalculations are already set up to recompute on file
system changes and only update the affected files. This means that diff
stats don't need to manage their own subscription or states anymore like
they did in the original PR.
2. We're able to further separate the data layer from the UI. Before,
the git panel owned all the subscriptions and tasks that refreshed the
diff stat, now the repository does, which is more inline with the code
base.
3. Integration tests are cleaner because `FakeRepository` can handle all
the data and calculations of diff stat and make it accessible to more
tests in the codebase. Because a lot of tests wouldn't initialize the
git panel when they used the git repository.
4. This made implementing remote/collab support for this feature
streamline. Remote clients wouldn't get the same buffer events as local
clients, so they wouldn't know that the diff stat state has been updated
and invalidate their data.
5. File system changes that happened outside of Zed now trigger the diff
stat refresh because we're using the `RepositorySnapshot`.

I added some integration tests as well to make sure collab support is
working this time. Finally, adding the initial diff calculation to
`compute_snapshot` didn't affect performance for me when checking
against chromium's diff with HEAD~1000. So this should be a safe change
to make.

I decided to add diff stats on the status entry struct because it made
updating changed paths and the collab database much simpler than having
two separate SumTrees. Also whenever the UI got a file's status it would
check its diff stat as well, so this change makes that code more
streamlined as well.

Before you mark this PR as ready for review, make sure that you have:
- [x] Added a solid test coverage and/or screenshots from doing manual
testing.
- [x] Done a self-review taking into account security and performance
aspects.

Release Notes:

- N/A
2026-03-04 18:54:23 +00:00
Anthony Eid
d5137d76c1
git: Add trusted worktree support to git integrations (#50649)
This PR cleans up the git command spawning by wrapping everything in
GitBinary instead to follow a builder/factory pattern. It also extends
trusted workspace support to git commands.

I also added a `clippy.toml` configuration to our git crate that warns
against using `Command` struct to spawn git commands instead of going
through `GitBinary`. This should help us maintain the factory pattern in
the future

Before you mark this PR as ready for review, make sure that you have:
- [x] Added solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects

Release Notes:

- git: Add trusted workspace support for Zed's git integration
2026-03-04 12:19:13 +00:00
Anthony Eid
3d3a66dc98
collab: Fix unable to rejoin shared project after leaving a call (#50630)
When a downstream project was disconnected from the host (e.g. the guest
left the call), `disconnected_from_host_internal` did not clear
`client_subscriptions`. These subscriptions hold entries in the
`Client`'s entity subscription map, so a subsequent
`join_remote_project` with the same project ID would fail with "already
subscribed to entity".

The fix adds `self.client_subscriptions.clear()` to
`disconnected_from_host_internal`, matching what `unshare_internal`
already does for the host side.

Before you mark this PR as ready for review, make sure that you have:
- [x] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects

Release Notes:

- collab: Fix unable to rejoin project bug ("already subscribed to
entity")
2026-03-03 19:46:08 +00:00
Anthony Eid
0a1a92131f
git: Fix remote worktree support (#50614)
The main issue is that we weren't forwarding the proto messages through
the collab server to the host. After fixing that I added integration
tests to cover local worktrees, remote worktrees, and ssh worktrees.

I also fixed a bug with FakeRepository where it wouldn't name its
current branch as a worktree when calling git worktree, which doesn't
match the behavior of the git binary.

Before you mark this PR as ready for review, make sure that you have:
- [x] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects

Release Notes:

- git: Fix bug that caused the git worktree picker from displaying and
creating worktrees over collab
2026-03-03 19:01:28 +01:00
Chriss4123
c19cc4c51e
Fix Linux watcher cleanup for recreated directories (#50412)
## Problem
- On Linux, non-recursive watcher registrations remained path-cached
after deleting and recreating a directory in the same session.
- The recreated directory was not re-watched, so newly created child
entries under that path could be missing.

## Summary
- Remove directory watcher registrations when worktree paths are removed
from snapshot state.
- Ensure recreated directories can be watched again on Linux by allowing
`scan_dir` to re-add fresh watches.
- Add a Linux integration regression test for directory delete/recreate
path reuse and child file creation.

## Testing
- `cargo test -p project --features test-support --test integration
test_recreated_directory_receives_child_events -- --exact`
- `cargo test -p project --features test-support --test integration
test_rescan_and_remote_updates -- --exact`

## Related
- #46709

Release Notes:

- Fixed Linux worktree file watching so child entries appear after
deleting and recreating a directory at the same path.
2026-03-03 10:11:51 -06:00
Richard Feldman
7c9a9d40c0
Add "Start Thread in New Worktree" (#49141)
Add the thread target selector in the agent panel behind the
`agent-git-worktrees` flag:

<img width="590" height="121" alt="Screenshot 2026-03-02 at 11 50 47 PM"
src="https://github.com/user-attachments/assets/17ee3303-7e01-4e40-bb84-1e7e748a3196"
/>

- Add a "Start Thread In..." dropdown to the agent panel toolbar, gated
behind `AgentV2FeatureFlag`
- Options: "Local Project" (default) and "New Worktree"
- The "New Worktree" option is disabled when there's no git repository
or in collab mode

Closes AI-34

Release Notes:

- N/A

---------

Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Co-authored-by: Oleksiy Syvokon <oleksiy@zed.dev>
Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
Co-authored-by: Anthony Eid <56899983+Anthony-Eid@users.noreply.github.com>
Co-authored-by: Remco Smits <djsmits12@gmail.com>
Co-authored-by: morgankrey <morgan@zed.dev>
Co-authored-by: Danilo Leal <67129314+danilo-leal@users.noreply.github.com>
Co-authored-by: Ben Kunkle <ben@zed.dev>
Co-authored-by: Finn Evers <finn@zed.dev>
Co-authored-by: Bennet Bo Fenner <bennet@zed.dev>
Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
Co-authored-by: MostlyK <135974627+MostlyKIGuess@users.noreply.github.com>
Co-authored-by: cameron <cameron.studdstreet@gmail.com>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-authored-by: John Tur <john-tur@outlook.com>
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
Co-authored-by: Wuji Chen <chenwuji2000@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
Co-authored-by: Cole Miller <cole@zed.dev>
Co-authored-by: Kasper Nyhus <kanyhus@gmail.com>
Co-authored-by: dino <dinojoaocosta@gmail.com>
Co-authored-by: Anthony Eid <hello@anthonyeid.me>
Co-authored-by: Josh Robson Chase <josh@robsonchase.com>
Co-authored-by: ozacod <47009516+ozacod@users.noreply.github.com>
Co-authored-by: ozacod <ozacod@users.noreply.github.com>
Co-authored-by: Xiaobo Liu <cppcoffee@gmail.com>
Co-authored-by: Lena <241371603+zelenenka@users.noreply.github.com>
Co-authored-by: 0x2CA <2478557459@qq.com>
Co-authored-by: Joseph T. Lyons <JosephTLyons@gmail.com>
Co-authored-by: Albab Hasan <155961300+Albab-Hasan@users.noreply.github.com>
Co-authored-by: KyleBarton <kjb@initialcapacity.io>
Co-authored-by: Kunall Banerjee <hey@kimchiii.space>
Co-authored-by: Lukas Wirth <lukas@zed.dev>
Co-authored-by: Tom Houlé <13155277+tomhoule@users.noreply.github.com>
Co-authored-by: Nikhil Pandey <nikhil@nikhil.com.np>
Co-authored-by: Mikayla Maki <mikayla@zed.dev>
Co-authored-by: dancer <144584931+dancer@users.noreply.github.com>
Co-authored-by: Kirill Bulatov <kirill@zed.dev>
Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
2026-03-03 15:25:36 +00:00
dybucc
815c6f5141
Add small alloc and lookup optimizations (#49041)
A vector was being instantiated when the callsite only required an
iterable.

Another part of the code was performing multiple `contains()` lookups on
a vector, and now it does it on a hashed set. This change has required
some extra modifications across the codebase, but the affected sites are
minimal and have been adjusted without major issues.

The changes include some `Hash` derived implementations, which were
proposed in the original `lsp-types` in [[1]], and maybe could be merged
into Zed's fork. I went ahead and used a newtype with a custom `Hash`
implementation that simply called on the structure's public members'
implementations of `Hash`.

The next change includes the removal of a check of the request
capabilities after having already checked the same thing in the call to
`to_lsp_params_or_response()` right before. The result of the `match`
expression should already have returned a `Task::ready()` if the above
mentioned function failed in performing the check that was later
repeated and now removed.

Finally, in the `edits_from_lsp()` method, stable sorting was being
performed when only unstable sorting would suffice. The method can only
sort with respect to the key data, and not the satellite data, as the
latter are the literal strings of the edit. It matters not which one of
a sequence of overlapping edits (with same ranges that thus resolve the
edits for equivalence) should come before the other.

[1]:
https://github.com/gluon-lang/lsp-types/pull/295/changes#diff-b1a35a68f14e696205874893c07fd24fdb88882b47c23cc0e0c80a30c7d53759R540

- [ ] Tests or screenshots needed?
- [ ] Code Reviewed
- [ ] Manual QA

Release Notes:

- Removed a vector allocation where the callsite only required an
iterable.
- Improved multiple lookup operations when deserializing LSP edit
operations.
- Removed a double-check of capabilities after requesting and thus
determining LSP capabilities.
- Replaced stable sorting with unstable sorting of edits returned by the
LSP.
2026-03-02 21:28:12 -07:00
Oliver Azevedo Barnes
f9895c5468
devcontainer: Fix git output (#49230)
Closes #48434

In Dev Containers, failed git operations were surfaced with a generic
failure message, while the useful git output (stderr/stdout) was not
reliably available to users.

This happened because in devcontainers the git operation errors go
through an RPC layer and then got wrapped with `anyhow::Context` (e.g.
“sending pull request”); the toast displayed only that outer context via
`to_string()`, masking the underlying git stderr message.

This change ensures the full git operation output is preserved and
surfaced via Zed’s “See logs” flow in Dev Containers, matching the
information you get when running the same git command in a terminal.

### What you should expect in the UI
- You will see a generic toast like “git pull failed” / “git push
failed”.
- When clicking on the toast’s “See logs”, the log tab now contains the
full git error output (e.g. non-fast-forward hints, merge conflict
details, “local changes would be overwritten”, etc.), which previously
could be missing/too generic.
---

## Manual testing

Run inside a Dev Container and ensure git auth works (SSH keys/agent or
HTTPS credentials).

1. **Dirty-tree pull failure**
   - Make remote ahead by 1 commit (push from another clone).
   - Locally modify the same file without committing.
   - In Zed: **Pull**  
- **Expect:** toast “git pull failed” + **See logs** shows “local
changes would be overwritten…” (or equivalent).

2. **Non-fast-forward push failure**
   - Ensure remote ahead.
   - Locally create 1 commit.
   - In Zed: **Push**  
- **Expect:** toast “git push failed” + **See logs** shows “rejected
(non-fast-forward)” + hint to pull first.

3. **Merge-conflict pull failure**
- Create conflicting commits on the same lines (one local commit, one
remote commit).
   - In Zed: **Pull**  
- **Expect:** toast “git pull failed” + **See logs** shows conflict
output (“CONFLICT…”, “Automatic merge failed…”).

Release Notes:

- Fixed devcontainer git failure toasts so they show the actual git
error

---------

Co-authored-by: KyleBarton <kjb@initialcapacity.io>
2026-03-02 09:10:12 -08:00
Lukas Wirth
2b774e5cd2
extension_host: Allow extensions to define semantic highlighting rules (#49282)
for their given language via a `semantic_token_rules.json` file

Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-03-02 17:54:53 +01:00
Cole Miller
db02d09331
git: Fix conflicted paths not getting cleared (#50327)
Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [ ] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- Fixed a bug where files would still be marked as having git conflicts
after resolving them.

---------

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
2026-03-02 13:40:34 +00:00
Lukas Wirth
c05e5859c6
Detect leaked entities at the end of test runs (#50400)
This does not yet allow for finding task <-> entity cycles
unfortunately, but at least it does catch entity <-> entity cycles for
the time being

Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-03-02 12:04:13 +01:00
Finn Evers
6a14388d38
languages: Add support for passing user settings to Go LSP adapter (#50472)
Closes https://github.com/zed-industries/zed/issues/50276

Release Notes:

- Added support for specifying settings for the Go LSP adapter
2026-03-02 09:33:48 +00:00
Lukas Wirth
5a40e687e5
editor: Fix a bunch of inlay hint bugs (#50377)
Release Notes:

- Fixed multiple language servers applying to the same buffer
overwriting each others inlay hints
- Fixed multiple language servers applying to the same multibuffer
discarding each others inlay hints
- Fixed a bug that caused some inlay hints to sometimes duplicate
2026-02-28 09:44:36 +00:00
Ben Brandt
112b90c4a4
agent_servers: Use more stable hasher for binary artifact downloads (#50315)
Since there aren't as many guarantees on the default hasher, uses sha256
like our other github downloaders.

Release Notes:

- N/A
2026-02-27 16:08:57 +00:00
Conrad Irwin
e762bb96a2
Remove unwrap() from lsp::Uri::from_file_path (#50244)
Fixes ZED-3BM
Fixes ZED-1RT

Release Notes:

- Windows: Fixed a panic registering a path with language servers when
the UNC path cannot be represented by a Rust URI.

---------

Co-authored-by: MrSubidubi <finn@zed.dev>
2026-02-27 08:32:29 -07:00
Ben Brandt
f4e65d8988
agent_servers: Migrate all built-in agents to go via registry (#50094)
This has lots of benefits, but mainly allows users to uninstall agents.

Release Notes:

- N/A

---------

Co-authored-by: Anthony Eid <hello@anthonyeid.me>
Co-authored-by: cameron <cameron.studdstreet@gmail.com>
2026-02-26 12:24:39 +00:00
Anthony Eid
b4fe63b097
git_graph: Polish UX (#50123)
This is a follow-up on #50027

I address my comments by adding a hash map look-up to find the selected
pending commit. I also removed the limitation where we would only retry
finding the pending commit 5 times. The pending selection is removed
when the graph is fully loaded and doesn't contain the pending commit.

This PR also cleans up some internal code structure and starts work to
enable search and propagating git log error messages to the UI.

UI wise I made the git graph item show the repository name instead of
"Git Graph" in Zed.

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [x] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- N/A

---------

Co-authored-by: Remco Smits <djsmits12@gmail.com>
2026-02-25 19:45:01 +00:00
Bob Mannino
bbbe7239af
git: Add diff stats in git_panel (#49519)
This PR adds the small UI change of `git diff --numstat` to the git
panel so you can see the number of additions/deletions per file. There
is an option in the settings UI for this under `git_panel`.`diff_stats`.
This option is set to `false` by default.

<!-- initial version <img width="1648" height="977" alt="Screenshot
2026-02-18 at 18 42 47"
src="https://github.com/user-attachments/assets/b8b7f07c-9c73-4d06-9734-8f1cf30ce296"
/> -->

<img width="1648" height="977" alt="Screenshot 2026-02-18 at 21 25 02"
src="https://github.com/user-attachments/assets/73257854-6168-4d12-84f8-27c9e0abe89f"
/>


Release Notes:

- Added git diff stats to git panel entries

---------

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
Co-authored-by: Anthony Eid <anthony@zed.dev>
2026-02-25 18:32:22 +01:00
Kirill Bulatov
f4920f4651
Fix Zed panicking on invalid ranges in semantic token deltas (#50106)
Closes ZED-59J

Release Notes:

- Fixed Zed panicking on invalid ranges in semantic token deltas
2026-02-25 17:13:49 +00:00
Tom Houlé
21fdf703e8
Fix "add custom context server" modal hanging indefinitely (#50085) 2026-02-25 17:48:54 +01:00
Tom Houlé
f786e045f4
Notify after populating MCP server IDs (#50089) 2026-02-25 17:48:20 +01:00
Ben Brandt
afadd4bca4
agent_server: Remove root_dir from agent server connect APIs (#50093)
This isn't necessary and allows us to potentially share processes across
threads.

Release Notes:

- N/A
2026-02-25 15:40:10 +00:00
Kunall Banerjee
0103f151c2
agent_server_store: Broaden Windows asset detection to all architectures (#50061)
Previously only `x86_64` Windows used ZIP archives, but ARM64 Windows
builds also use ZIP format.

Closes #50039.

> [!NOTE]
> The P1 is two-fold: the user cannot download the ZIP file on Windows
ARM. BUT -- the Agent Panel is stalled because of that. This ONLY makes
it so that the ZIP download doesn’t fail, but if for some reason the
download fails, the panel is genuinely stuck with no recovery path.
Every restart attempts the same download, hits the same GZIP error, and
silently drops it again.

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [x] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- Broaden Windows asset detection to all architectures
2026-02-24 23:27:52 -07:00
Anthony Eid
c6a82b3b45
debugger: Open correct pane for breakpoints (#49390)
Closes #40602

### Summary

This PR ensures that active debug lines only open in a single pane and
new active debug lines are added to the most recent pane that contained
an active debug line. This fixes a bug where Zed could go to the active
debug line file and location in every pane a user had open, even if that
pane was focused on a different file.

I fixed this by storing the `entity_id` of the pane containing the most
recently active debug line on `BreakpointStore`, this is consistent with
where the selected stack frame is stored. I used an `entity_id` instead
of a strong type to avoid circular dependencies. Whenever an active
debug line is being set in the editor or by the debugger it now checks
if there's a specific pane it should be set in, and after setting the
line it updates `BreakpointStore` state.

I also added a new method on the `workspace::Item` trait called `fn
pane_changed(&mut self, new_pane_id: EntityId, cx: &mut Context<Self>)`
To enable `Editor` to update `BreakpointStore`'s active debug line pane
id whenever an `Editor` is moved to a new pane.


### PR review TODO list

Before you mark this PR as ready for review, make sure that you have:
- [x] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [x] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- debugger: Fix bug where active debug lines could be set in the wrong
pane
2026-02-24 12:49:52 +01:00
Cole Miller
a8043dcff8
editor: Prevent panic when attempting to resolve a breakpoint anchor against the wrong buffer (#49893)
Closes ZED-4HY

Release Notes:

- Fixed a crash when using breakpoints.
2026-02-23 16:28:40 -05:00
John Tur
a2f397be9d
Revert "Optimize workspace/didChangeWatchedFiles handler" (#49826)
Reverts zed-industries/zed#49778

This seems to have made things much worse in some cases, so I'll have to
think of a different way to fix the original issue.

Release Notes:
- N/A
2026-02-21 23:54:57 -05:00
Remco Smits
bb368ce1fe
git_graph: Improve loading time (#49736)
This PR Fixes a loading performance regresssion inside the git graph.
The main issue is that we always acted on the received repository
events, this is good in 9 out of 10 cases except for the initial loading
phase of the git graph. This is because we invalidate the graph data
every time we receive a `GitStoreEvent::ActiveRepositoryChanged`,
`RepositoryEvent::BranchChanged` or `RepositoryEvent::MergeHeadsChanged`
event this still sounds good, but the caveat is that we receive these 3
events on initial repository loading. This happens when you start up Zed
and is getting the active repository, branch ect. from your project.
When it detects a repository/branch etc. it checks if it has been
changed and emits an event for it. This is always the case for initial
repository loading, because the active repository/branch always start as
**None**. So receive an event for these non actual changes makes the git
graph cancel its initial loading and start fetching again on every
invalidated graph data call.

We fixed this by checking the **scan_id** of the repo to check if the
repo has been initialized, if its bigger then 1 we know we need to
invalidate the data because it was a actual user change instead of a
initial loading event.

**Before** (note you see the loading state twice):


https://github.com/user-attachments/assets/c25bfae1-0e2f-4c8b-a0d0-926acb33adff

**After** (almost instant):


https://github.com/user-attachments/assets/7e4ac116-65a2-4eb6-aa4c-37291d6acd0f

-----

**Before** (switching repositories shows empty commits pane)


https://github.com/user-attachments/assets/71b04285-49e7-47bb-9660-ad53bbf15c46

**After** (switching repositories shows correct graph from the cache)


https://github.com/user-attachments/assets/38c33d93-f592-4440-b63b-567fda0fbeb8

Before you mark this PR as ready for review, make sure that you have:
- [x] Added a solid test coverage and/or screenshots from doing manual
testing
- [x] Done a self-review taking into account security and performance
aspects
- [x] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- N/A

---------

Co-authored-by: Anthony <anthony@zed.dev>
Co-authored-by: Anthony Eid <hello@anthonyeid.me>
2026-02-21 23:05:23 +00:00
Xiaobo Liu
5205e54d7e
project: Remove unused BufferOpened event (#49775) 2026-02-21 10:10:51 +00:00
John Tur
21ac361663
Optimize workspace/didChangeWatchedFiles handler (#49778)
Previously, `didChangeWatchedFiles` registrations triggered a rebuild of
a single `GlobSet` containing all file watch patterns for the language
server. This means that, each time `didChangeWatchedFiles` is
registered, the work it takes to construct the `GlobSet` increases. This
quadratic blowup caused massive lag with language servers which register
thousands of watched files (like Roslyn).

Instead, create one `GlobSet` per registration and try matching them
one-by-one each time a file watcher event is raised.

---

Before you mark this PR as ready for review, make sure that you have:
- [X] Added a solid test coverage and/or screenshots from doing manual
testing
- [X] Done a self-review taking into account security and performance
aspects

Release Notes:

- Optimized performance for language servers which register many
file-watching notifications.
2026-02-21 04:29:42 +00:00
Lukas Wirth
9ad8c7a2a3
editor: Distribute lines across cursors when pasting from external sources (#48676)
Release Notes:

- When pasting multiple lines equaling the number of cursors Zed now
maps each line to each cursor
2026-02-20 16:33:06 +00:00
Lukas Wirth
d9ece42cf5
text: Inline text::Anchor's timestamp field, shrinking its size (#49703)
This shrinks the size of `text::Anchor` from 32 bytes to 24 and
`multi_buffer::Anchor` from 72 bytes to 56

Release Notes:

- Improved the memory usage of Zed a bit
2026-02-20 10:17:22 +00:00
Lukas Wirth
d6c0d3c8bd
project: Block less in Respository::paths_changed (#49584)
Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-02-19 11:25:36 +00:00
Lukas Wirth
2786d36786
editor: Yield less frequently in WrapSnapshot::update (#49497)
Every yield will cause the background task to get rescheduled causing
additional thread/context switching, so doing so for every wrapped row
is a bit excessive

Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-02-19 09:52:33 +00:00