Moves loading of the history connection to once we have a new
connection, not on every thread view.
Release Notes:
- N/A
---------
Signed-off-by: rabi <ramishra@redhat.com>
Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
When a completion request fails with a retryable error (e.g. a 500 from
the upstream provider), the retry loop waits on a timer before trying
again. This timer did not race with the cancellation signal, so if the
user switched models and submitted a new message during the retry delay,
the old turn would continue retrying with the stale model for up to 15
seconds — making requests to the wrong provider and corrupting the
thread's message list with spurious Resume entries.
Now the retry delay races with the cancellation receiver, so the old
turn exits immediately when cancelled.
Release Notes:
- Fixed cancelled turns in a conversation that failed (e.g. 500 from the
LLM provider) bein retried even after cancellation
Removes unused `edit_agent_output` from `EditFileTool`. This makes it
easier to maintain compatibility between the `EditFileTool` and
`StreamingEditFileTool`.
Release Notes:
- N/A
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.
Store the user's unsent message editor text in DbThread so it survives
quitting and reloading Zed. The draft flows through Thread → AcpThread →
AcpThreadView on load, and back via a debounced observer on the message
editor for saves.
Currently works for native Zed agents only; external ACP agents will
pick this up once general ACP history persistence lands.
## Changes
- **`DbThread`** / **`Thread`**: New `draft_prompt: Option<String>`
field, included in `to_db()`/`from_db()`
- **`AcpThread`**: Bridge field with getter/setter, populated during
`register_session()`
- **`NativeAgent::save_thread()`**: Copies draft from `AcpThread` →
`Thread` before persisting
- **`AcpThreadView`**: Restores draft into `MessageEditor` on load;
syncs editor text → `AcpThread` via observer; debounced (500ms) Thread
notify triggers DB save
Co-authored-by: Anthony Eid <anthony@zed.dev>
Co-authored-by: Mikayla Maki <mikayla@zed.dev>
When pinned tabs are present, activating an unpinned tab passed the
absolute tab index to the scroll handle, which only contains unpinned
tabs. This caused the scroll-into-view to silently fail.
Subtract `pinned_tab_count` from the index so it maps to the correct
child in the unpinned tabs scroll container.
Release Notes:
- Fixed tab bar not reliably scrolling to the active tab when pinned
tabs are present.
Closes#48812
## Summary
`editor::SplitSelectionIntoLines` currently triggers autoscroll and can
jump to the end of a long file.
This PR makes the action explicitly no-scroll.
## What changed
- Disabled autoscroll in the `unfold_ranges` call inside
`split_selection_into_lines`.
- Switched selection update to `SelectionEffects::no_scroll()`.
## Testing
- Added `test_split_selection_into_lines_does_not_scroll`.
### Screenshots:
- Before: see issue video
- After:
<img width="2486" height="1299" alt="image"
src="https://github.com/user-attachments/assets/8408a2f1-7dd7-4984-aa89-927d5a588322"
/>
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:
- Stop scrolling on `editor::SplitSelectionIntoLines` called in the long
files
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 *or* Added/Fixed/Improved ...
---------
Co-authored-by: Max <max@zed.dev>
Fix a bug in the editor's handling of the
`multi_buffer::Event::ExcerptsRemoved` event, where the display map's
`folded_buffers` set was not updated according to the list of removed
buffer ids.
Since the `ProjectSearchView` now relies on the
`Editor.has_any_buffer_folded` method in order to decide the state of
the expand/collapse all excerpts button this could lead to a
bug where, after an initial project search, all excerpts would be
collapsed, and performing a new search would leave the button in a wrong
state, as all excerpts from the new search result would be expanded, but
the button would still consider that there were folded excerpts for the
buffers.
Closes#50521
Release Notes:
- Fixed bug in project search where collapsing a single buffer then
performing a new search in the same view, would break the
expand/collapse all button behavior
Closes#45466
Emojis like 🧑✈️ are grapheme clusters formed using zero-width joiners
and variation selectors. Iterating over the string by individual chars
in `highlight_invisibles` breaks these clusters, even though they
represent a single visible character.
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
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
Release Notes:
- Zed now supports compound emojis
This uses the compositor hints if available to pick the best GPU. If
none is
available, it tries each GPU in turn, and the first that actually works
is chosen
Release Notes:
- Linux: Select a more appropriate GPU
---------
Co-authored-by: John Tur <john-tur@outlook.com>
Subagents now forward buffer reads/writes/edits to a parent action log,
allowing the parent's review experience to track all file changes made
by subagents alongside its own.
Release Notes:
- N/A
---------
Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
When the model, summarization model, thinking settings, speed, or
profile are updated on a thread, apply the same settings to any
currently running subagents.
Release Notes:
- N/A
Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
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>
Removes a bunch of `dbg!`'s from strings in test code. It's annoying
cause these show up in project search, when you are removing
`dbg!(...)`'s after debugging something
Release Notes:
- N/A
Fixes#50245
### Summary :
This PR fixes linked tag renaming when typing . in tag names like
<Table.Headers>...</Table.Headers>.
Previously, linked editing treated . as punctuation (unless a language
explicitly configured it as a linked-edit character), so renaming could
stop syncing at the dot and produce mismatched closing tags.
### What changed
Updated linked-edit input handling to preserve linked edits when the
typed input is exactly ".", even if the active language does not
explicitly include dot in linked_edit_characters.
Added a regression test covering dot typing in linked edits without
language override.
Kept existing punctuation behavior (e.g. >) unchanged.
### Files changed
[editor.rs]
[editor_tests.rs]
### Why this approach
Minimal, targeted fix in shared linked-edit path.
Works for .svelte and similar markup contexts where dot-separated
component names are valid in practice.
Avoids requiring every language/extension to add dot config
individually.
### Validation
Manual repro confirmed: opening tag rename with dot now keeps closing
tag synced.
Added test: test_linked_edits_on_typing_dot_without_language_override.
Existing related test remains relevant:
test_linked_edits_on_typing_punctuation.
In cases where sticky headers are enabled, count the number of sticky
headers that would be present when performing `editor:scroll cursor
top`. Take the maximum of that number and `verical_scroll_margin` so
that we don't inadvertently bury the cursor behind the sticky headers.
https://github.com/user-attachments/assets/6d49fe3a-2017-4c76-bd92-c4ec9794f898Closes#48864
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:
- Fixed scroll top behavior when there are more sticky headers than
vertical_scroll_margin
This PR changes the behavior of editing queued messages. Previously, you
could type directly in the editor that was used to displayed a queued
message. However, that felt a bit anxiety-inducing because there was a
chance the message would get sent before you could've wrapped up your
edits. And even if we blocked the message to get sent while focused on
the editor, it could still be a bit unpredictable. So, with this PR, if
you type on a queued message, the content of that message goes
immediately back to the main message editor. Effectively, you're taking
that message off the queue so you can edit it, and then if you hit enter
(while there's a generation ongoing), that content goes back into the
queue.
I believe this allows for a calmer editing experience when wanting to
touch up or increment a queued message.
Here's a video of the flow:
https://github.com/user-attachments/assets/ec60ccad-2b04-4b7c-a8f5-95baa443d9f2
In the video, I'm showcasing a few things:
- in case the main message editor already had content, the content from
the edited queued message is appended to it. That avoids the user
surprisingly losing information.
- the fact that mention creases still work well and are not converted
back into plain text
Release Notes:
- Agent: Made editing queued messages better by moving the contnet back
to the main message editor, avoiding the chance of it getting sent
mid-editing.
In the thread view, when the last block is an ongoing terminal tool
call, we're not waiting for the LLM to generate content, but rather,
we're waiting for the command to run so its output can be sent to the
model. With that in mind, it doesn't make sense for the generating
loading spinner to be visible. So, this PR, removes it. But I also took
the opportunity to refine the terminal card header a bit, as well as
make the "command running" spinner, as well as the stop button, visible
for external agents, too.
https://github.com/user-attachments/assets/c7e2865a-af9b-416b-a06a-908dffb916da
In the video, you can see that given we only have a running-terminal
tool call, there's no generation loading spinner.
Release Notes:
- Agent: Improved loading state for the thread view when there's only a
running terminal command.
Release Notes:
- agent: Add new `spawn_agent` tool which allows the Zed Agent to
utilize subagents for doing tasks in parallel and better context
management.
Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
This is pure computation work that is disconnected from main thread
entity state yet it can still block for a couple milliseconds depending
on the file
Release Notes:
- N/A *or* Added/Fixed/Improved ...
We were trying to mitigate these by passing `.` instead of ``, but it
turns out that git2 also panics internally for that. It also just
doesn't make sense to look up the index text (or committed text) for an
empty path, because a file should always have a nonempty repo path.
Closes ZED-560
Release Notes:
- N/A
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>
Deferred draws previously didn't use a content mask, so you could
horizontally scroll an EP popover all the way out of the containing
pane.
This also affects other UI elements that use the deferred draw system; I
think in practice it doesn't make much difference because most of those
seem to require something in the editor to be hovered, so if you scroll
horizontally the element goes away.
Release Notes:
- Fixed being able to scroll the edit prediction popover out of the
containing pane.
The iteration range was `(seed..num_iterations)`, which produces an
empty range whenever `seed >= num_iterations`. Changed it to
`(seed..seed + num_iterations)` so the range always runs the correct
number of iterations starting from the given seed.
Release Notes:
- N/A
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 ...