Commit graph

20690 commits

Author SHA1 Message Date
Piotr Osiewicz
c6e2d20a02
chore: Bump Rust version to 1.86 (#28021)
Closes #ISSUE

Release Notes:

- N/A
2025-04-03 23:32:50 +02:00
Marshall Bowers
7492ec3f67
Add tool use support for OpenAI models (#28051)
This PR adds support for using tools to the OpenAI models.

Release Notes:

- agent: Added support for tool use with OpenAI models (Preview only).
2025-04-03 20:55:11 +00:00
Kirill Bulatov
3f71ae9897
Use more appropriate action for Vim word completions (#28043)
Follow-up of https://github.com/zed-industries/zed/pull/26410

The action does not sort the items the way Vim does, but still better
than the previous state.

Release Notes:

- N/A

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2025-04-03 19:32:24 +00:00
Nate Butler
2086f7d85b
ui_input: TextField -> SingleLineInput (#28031)
- Rename `TextField` -> `SingleLineInput`
- Add a component preview for `SingleLineInput`
- Apply `SingleLineInput` to the AddContextServerModal

Release Notes:

- N/A

---------

Co-authored-by: Agus Zubiaga <hi@aguz.me>
Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
Co-authored-by: Danilo Leal <67129314+danilo-leal@users.noreply.github.com>
2025-04-03 16:00:43 -03:00
Agus Zubiaga
315f1bf168
agent: Snapshot context in user message instead of recreating it (#27967)
This makes context essentially work the same way as `read-file`,
increasing the likelihood of cache hits.

Just like with `read-file`, we'll notify the model when the user makes
an edit to one of the tracked files. In the future, we want to send a
diff instead of just a list of files, but that's an orthogonal change.


Release Notes:
- agent: Improved caching of files in context

---------

Co-authored-by: Antonio Scandurra <me@as-cii.com>
2025-04-03 15:52:28 -03:00
Kirill Bulatov
0c82541f0a
Allow to temporarily stop LSP servers (#28034)
Same as `editor::RestartLanguageServer`, now there's an
`editor::StopLanguageServer` action that stops all language servers,
related to the currently opened editor.

Opening another singleton editor with the same language or changing
selections in a multi buffer will bring the servers back up.

Release Notes:

- Added a way to temporarily stop LSP servers

---------

Co-authored-by: Michael Sloan <mgsloan@gmail.com>
2025-04-03 12:50:43 -06:00
Danilo Leal
b9724d9cbe
agent: Add token count in the thread view (#28037)
This PR adds the token count to the active thread view. It doesn't
behaves quite like Assistant 1 where it updates as you type, though; it
updates after you submit the message.

<img
src="https://github.com/user-attachments/assets/82d2a180-554a-43ee-b776-3743359b609b"
width="700" />

---

Release Notes:

- agent: Add token count in the thread view

---------

Co-authored-by: Agus Zubiaga <hi@aguz.me>
2025-04-03 15:43:58 -03:00
Marshall Bowers
e5b347b03a
Remove unused extract_tool_args_from_events functions (#28038)
This PR removes the unused `extract_tool_args_from_events` functions
that were defined in some of the LLM provider crates.

Release Notes:

- N/A
2025-04-03 18:38:35 +00:00
Antonio Scandurra
e123c4bced
Fix soft-wrapping with fold creases (#28029)
Release Notes:

- Fixed a rendering bug that caused context in the agent to not wrap
properly.

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
Co-authored-by: Zed AI <ai+claude-3.7@zed.dev>
2025-04-03 17:33:08 +00:00
Agus Zubiaga
ed3722023e
agent: Handle tool use without text (#28030)
### Context 

The Anthropic API fails if a request message contains a tool use and no
`Text` segments or it only contains empty `Text` segments. These are
cases that the model itself produces, but the API doesn't support
sending them back.

#27917 fixed this by appending "Using tool..." in the thread's message,
but this causes the actual conversation to include it, so it would
appear in the UI (we would actually display a gap because we never
rendered its markdown, but "Using tool..." would show up when the thread
was restored).

### Solution

We'll now only append this placeholder when we build the request, so the
API still sees it, but the UI/Thread doesn't.

Another issue we found is that the model starts mimicking these
placeholders in later tool uses which is undesirable. So unfortunately,
we had to add logic to filter them out.

Release Notes:

- agent: Improved rendering of tool uses without text

---------

Co-authored-by: Bennet <bennet@zed.dev>
2025-04-03 14:22:59 -03:00
Piotr Osiewicz
ece4a1cd7c
debugger: Start on tabless design (#27837)
![image](https://github.com/user-attachments/assets/1cd54b70-5457-4c64-95bd-45a7055ea165)

Release Notes:

- N/A

---------

Co-authored-by: Anthony Eid <hello@anthonyeid.me>
Co-authored-by: Anthony <anthony@zed.dev>
2025-04-03 16:11:14 +00:00
Danilo Leal
9986a21970
agent: Add button to continue iterating once all reviews are done (#28027)
This PR adds a button on the review tab empty state that toggles the
focus back to the agent panel so that users can keep iterating on the
thread that's active in the panel.

<img
src="https://github.com/user-attachments/assets/ace5cf93-8869-49bb-8106-e03a9e3c90f2"
width="700"/>

Release Notes:

- N/A
2025-04-03 12:32:02 -03:00
Kirill Bulatov
c674e8d62d
Clear path-based excerpt data properly (#28026)
Follow-up of https://github.com/zed-industries/zed/pull/27893

Release Notes:

- N/A

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2025-04-03 15:17:10 +00:00
Finn Evers
e5e3e9ac8c
rust: Improve runnable detection for test modules (#28024)
Closes #28002

This PR updates the `runnabless.scm` for Rust to improve detection of
test modules with non-standard names. Instead of matching on the module
name, we now check for the `#[cfg(test)]`-attribute above test modules.
This allows for generic matching whilst not regressing the previous
behaviour.

| `main` | <img width="922" alt="main"
src="https://github.com/user-attachments/assets/34fc4443-13a2-4e18-b806-7e14771c3df4"
/> |
| --- | --- |
| This PR | <img width="922" alt="PR"
src="https://github.com/user-attachments/assets/13e6a6d8-e177-4a83-89ab-24c0a69ade27"
/> |

Release Notes:

- Improved runnable detection for test modules in Rust.
2025-04-03 14:56:28 +00:00
Cole Miller
399d19231b
Temporarily disable flaky conflicted-cherry-pick test (#27950)
Closes #ISSUE

Release Notes:

- N/A
2025-04-03 10:51:23 -04:00
Bennet Bo Fenner
c98bcc72b8
agent: Fix thinking step showing up as pending when completion is cancelled (#28019)
Previously the "Thinking..." step would show up as pending, even though
the user cancelled the generation:
<img width="672" alt="image"
src="https://github.com/user-attachments/assets/c9cdce0a-d827-4e23-96f5-b150465911a7"
/>


Release Notes:

- Fixed an issue where the thinking step would show up as pending even
when the generation was cancelled
2025-04-03 13:35:06 +00:00
Agus Zubiaga
fe27d11f08
agent: Include active file in recent history (#27914)
This happened because of two reasons:

- `Workspace::recent_navigation_history` didn't include the current file
- The context picker added the current file to a exclude list

The latter was actually intentional because we already show the file in
the suggested context, but now that we actually have mentions, it's just
inconvenient not to have it there.

Release Notes:

- N/A
2025-04-03 13:29:41 +00:00
Finn Evers
9693eab098
editor: Fix active line number highlighting regression (#28015)
This PR resolves a small regression introduced by the
debugger-introduction, which causes the active line number to no longer
be highlighted in the gutter as long as it is not part of a selection. A
user reported this issue [on
Discord](https://discord.com/channels/869392257814519848/995403703894954060/1357153291913662567).

Prior to the debugger-commit, an active line number was highlighted if
it was part of the editor active line numbers:

ed4e654fdf/crates/editor/src/element.rs (L4295-L4303)

With the debugger-introduction, the code was changed to only highlight
lines which are part of a selection:

e2aaf9b704/crates/editor/src/element.rs (L2411-L2422)

However, the check whether it is within a selection is not neccesary, as
the line is an active line as long as it is within the map of active
lines.

This PR restores the previous behavior.

| `main` | <img width="922" alt="main"
src="https://github.com/user-attachments/assets/486a548d-fe09-450e-922e-1feb4366fb4f"
/> |
| --- | --- |
| This PR | <img width="922" alt="PR"
src="https://github.com/user-attachments/assets/80517880-14b5-4861-bf83-8364f7831c46"
/> |

Release Notes:

- Fixed an issue where the active line number in the editor was not
always highlighted.
2025-04-03 11:32:15 +00:00
Piotr Osiewicz
e2aaf9b704
chore: Remove stray eprintln (#28014)
Closes #ISSUE

Release Notes:

- N/A
2025-04-03 10:28:27 +00:00
张小白
9abfbdff43
Fix test_peers_following_each_other for Windows (#28008)
Release Notes:

- N/A
2025-04-03 15:47:33 +08:00
Thomas Mickley-Doyle
cd85b430e4
assistant_eval: Add ACE framework (#27181)
Release Notes:

- N/A

---------

Co-authored-by: Michael Sloan <michael@zed.dev>
2025-04-02 23:02:06 -05:00
Piotr Osiewicz
ee950f5bc4
Debugger: Add pretty printers for Cargo-located tasks (#27979)
Closes #ISSUE

Release Notes:

- N/A
2025-04-03 01:40:08 +02:00
Smit Barmase
501b539286
gpui: Fix background for WrappedLine (#27980)
https://github.com/zed-industries/zed/pull/26454 In this PR, we
separated painting for text line into two parts: `paint` and
`paint_background`. This allows selections to appear in front of the
text background but behind the text itself in the editor.

The `paint_background` method was implemented for `ShapedLine` but not
for `WrappedLine`. This PR adds that, fixing the background rendering
for inline code blocks in Markdown, as they use `WrappedLine`.

Before:
<img width="160" alt="image"
src="https://github.com/user-attachments/assets/81466c63-6835-4128-ba22-1b63f5fd7b1f"
/>

After:
<img width="160" alt="image"
src="https://github.com/user-attachments/assets/3b7044d7-265b-45db-904c-3b70fdf421fe"
/>

Release Notes:

- Fixed missing background for inline code blocks in the editor hover
tooltip.
2025-04-03 05:09:42 +05:30
Kirill Bulatov
8a6ed4a2ca
Use new multibuffer excerpts in project search (#27893)
Follow-up of https://github.com/zed-industries/zed/pull/27876
Closes https://github.com/zed-industries/zed/issues/13513

Release Notes:

- Improved multi buffer excerpts to merge when expanded

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2025-04-02 22:57:40 +00:00
5brian
b4af5b2ce0
agent: Update thread label to use plural form (#27971)
Update thread label to match the other contexts.

|Before|After|
|--|--|

|![image](https://github.com/user-attachments/assets/6e02808e-50d7-480f-a9ca-251e9519a71d)|![image](https://github.com/user-attachments/assets/174aad84-9e55-4531-bb4a-1a1adaa46418)|

Release Notes:

- N/A
2025-04-02 18:33:05 -04:00
Marshall Bowers
ee33d313e2
agent: Allow editing previous messages (#27965)
This PR adds the ability to edit previous user messages in the thread.

Release Notes:

- Agent: Added the ability to edit previous user messages
(Preview-only).
2025-04-02 21:05:49 +00:00
Danilo Leal
0a132779a1
agent: Change loading label if command is waiting on permission (#27955)
If there's a command pending confirmation, the label changes from
"Generating" to "Waiting for confirmation".

<img
src="https://github.com/user-attachments/assets/d804e382-5315-40b0-9588-c257cca2430c"
width="600"/>

Release Notes:

- N/A
2025-04-02 17:41:16 -03:00
Danilo Leal
d23c2d4b02
agent: Refine feedback message input (#27948)
<img
src="https://github.com/user-attachments/assets/cde37a88-9973-4c27-80b7-459f5e986c74"
width="650" />

Release Notes:

- N/A

---------

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
2025-04-02 17:41:07 -03:00
Max Brunsfeld
b9f10c0adb
Fix redundant FS file watches due to LSP path watching (#27957)
Release Notes:

- Fixed a bug where Zed sometimes added multiple redundant FS watchers
when language servers requested to watch paths. This could cause saves
and git operations to fail if Zed exceeded the file descriptor limit.

---------

Co-authored-by: Piotr <piotr@zed.dev>
2025-04-02 13:36:28 -07:00
Smit Barmase
9f9746872e
editor: Fix typing closing bracket skips it even when use_autoclose is disabled (#27960)
Closes #27769

When adding snippet we were not respecting autoclose setting, before
creating AutocloseRegion. This leads to cursor to skip over instead of
typing that character. This PR fixes it.

Release Notes:

- Fixed certain case where typing closing bracket would skip it when
auto close setting is turned off.
2025-04-03 02:00:44 +05:30
Julia Ryan
01ec6e0f77
Add workspace-hack (#27277)
This adds a "workspace-hack" crate, see
[mozilla's](https://hg.mozilla.org/mozilla-central/file/3a265fdc9f33e5946f0ca0a04af73acd7e6d1a39/build/workspace-hack/Cargo.toml#l7)
for a concise explanation of why this is useful. For us in practice this
means that if I were to run all the tests (`cargo nextest r
--workspace`) and then `cargo r`, all the deps from the previous cargo
command will be reused. Before this PR it would rebuild many deps due to
resolving different sets of features for them. For me this frequently
caused long rebuilds when things "should" already be cached.

To avoid manually maintaining our workspace-hack crate, we will use
[cargo hakari](https://docs.rs/cargo-hakari) to update the build files
when there's a necessary change. I've added a step to CI that checks
whether the workspace-hack crate is up to date, and instructs you to
re-run `script/update-workspace-hack` when it fails.

Finally, to make sure that people can still depend on crates in our
workspace without pulling in all the workspace deps, we use a `[patch]`
section following [hakari's
instructions](https://docs.rs/cargo-hakari/0.9.36/cargo_hakari/patch_directive/index.html)

One possible followup task would be making guppy use our
`rust-toolchain.toml` instead of having to duplicate that list in its
config, I opened an issue for that upstream: guppy-rs/guppy#481.

TODO:
- [x] Fix the extension test failure
- [x] Ensure the dev dependencies aren't being unified by Hakari into
the main dependencies
- [x] Ensure that the remote-server binary continues to not depend on
LibSSL

Release Notes:

- N/A

---------

Co-authored-by: Mikayla <mikayla@zed.dev>
Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
2025-04-02 13:26:34 -07:00
frederik-uni
07a77792c5
Add completions.lsp_insert_mode setting to control what ranges are replaced when a completion is inserted (#27453)
This PR adds `completions.lsp_insert_mode` and effectively changes the
default from `"replace"` to `"replace_suffix"`, which automatically
detects whether to use the LSP `replace` range instead of `insert`
range.

`"replace_suffix"` was chosen as a default because it's more
conservative than `"replace_subsequence"`, considering that deleting
text is usually faster and less disruptive than having to rewrite a long
replaced word.

Fixes #27197
Fixes #23395 (again)
Fixes #4816 (again)

Release Notes:

- Added new setting `completions.lsp_insert_mode` that changes what will
be replaced when an LSP completion is accepted. The default is
`"replace_suffix"`, but it accepts 4 values: `"insert"` for replacing
only the text before the cursor, `"replace"` for replacing the whole
text, `"replace_suffix"` that acts like `"replace"` when the text after
the cursor is a suffix of the completion, and `"replace_subsequence"`
that acts like `"replace"` when the text around your cursor is a
subsequence of the completion (similiar to a fuzzy match). Check [the
documentation](https://zed.dev/docs/configuring-zed#LSP-Insert-Mode) for
more information.

---------

Co-authored-by: João Marcos <marcospb19@hotmail.com>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2025-04-02 16:55:03 -03:00
Anthony Eid
108ae0b5b0
debugger: Add args argument to debugger launch config (#27953)
This also fixes a bug where debug cargo test code actions would debug
all tests in a mod instead of a specific test

Release Notes:

- N/A
2025-04-02 15:37:12 -04:00
Shardul Vaidya
0a58e54477
aws_http_client: Copy response headers (#27941)
Preemptive fixes required for #26734

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <git@maxdeviant.com>
2025-04-02 15:00:44 -04:00
Marshall Bowers
c7d27753ee
agent: Do some cleanup of feedback comments submission (#27940)
This PR does some stylistic cleanup of the feedback comments submission
code.

Release Notes:

- N/A
2025-04-02 18:03:18 +00:00
Michael Sloan
b7b7f1ccdd
Use worktree qualified paths in agent file context + some code cleanup (#27943)
Release Notes:

- N/A
2025-04-02 18:00:32 +00:00
Michael Sloan
142f9917d0
Fix clippy lints that don't currently appear in CI (#27944)
I may have a newer version of clippy than CI. Also removes some unused
code in `livekit_client.rs`

Release Notes:

- N/A
2025-04-02 18:00:16 +00:00
Joseph T. Lyons
f8092bf0d2
Bump Zed to v0.182 (#27945)
Release Notes:

-N/A
2025-04-02 13:45:42 -04:00
Anthony Eid
0ba8432b0b
Debugger: Add stop on entry support to debug adapter configs (#27942)
This PR adds passing in `stop_on_entry` to debug configs in debug.json
instead of going through initialization args.

This has two benefits:

1. It's more streamlined to a user since every internal adapter supports
`stop_on_entry` for launch requests and Go's adapter supports it for
attach requests too.
2. It will allow @osiewicz `NewSesssionModal` PR to use this field for
the stop on entry checkbox.

Release Notes:

- N/A
2025-04-02 13:45:26 -04:00
Cole Miller
e1a8a31fa4
Fix flickering when staging and unstaging files (#27931)
This fixes a bug in #27568 that caused flickering in the git panel's
checkbox state when staging and unstaging entire files. The problem is
that that stage/unstage action first saves the target path (if it's open
as a buffer), and we do a targeted git status scan in response to that
filesystem event, which makes its way to the git panel and causes it to
clear its pending state before the actual stage or unstage has gone
through.

The fix is to not clear the panel's pending state for git repository
events that originated from a targeted scan (i.e. one that was triggered
by FS events for repo paths, as opposed to events inside `.git` which
cause all statuses to be recomputed).

Release Notes:

- N/A
2025-04-02 17:43:48 +00:00
Danilo Leal
0be8bf1b12
agent: Improve action confirmation UX (#27932)
This PR makes the command permission prompt part of the tool card and
allow users to straight away change the `always_allow_tool_actions`
setting via the "Always Allow" button from that card. If that button is
clicked, that setting is turned on, and any command that requires
permission from that point on will auto-run.

Additionally, if a bash command spans multiple lines, we show the line
count at the end of the command string. (Note: this is not perfect yet
because it can likely be not visible by default, but we didn't think
this was a major blocker for now. We'll work on improving this next).

### Thread View

<img
src="https://github.com/user-attachments/assets/00f93c39-990f-4b79-84ec-0427b997167f"
width="500"/>

### Settings View

<img
src="https://github.com/user-attachments/assets/52d32435-7c8d-4ab4-a319-6cabc007267b"
width="500"/>


Release Notes:

- N/A

---------

Co-authored-by: Thomas Mickley-Doyle <tmickleydoyle@gmail.com>
Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Antonio Scandurra <me@as-cii.com>
2025-04-02 17:40:49 +00:00
Cole Miller
3e2ac3e7bc
Log error and proceed when failing to load repo environment (#27938)
Closes #ISSUE

Release Notes:

- N/A
2025-04-02 13:15:35 -04:00
Marshall Bowers
646f65511c
agent: Add newtype for profile IDs (#27939)
This PR adds an `AgentProfileId` newtype for profile IDs that we can use
instead of `Arc<str>` everywhere.

Release Notes:

- N/A
2025-04-02 17:12:52 +00:00
Smit Barmase
b2904e5d9f
file_finder: Prioritize file name matches over path matches (#27937)
Closes https://github.com/zed-industries/zed/issues/27936

Adds additional comparison after the existing history-based comparison.

This comparison checks whether the first position matched via fuzzy
search is in the file name. If so, we prioritize this match over one in
the path. If both items match either the file name or the path, the
existing comparison logic is used.

- [x] Tests

Before:
<img width="580" alt="image"
src="https://github.com/user-attachments/assets/011fdd01-3dfa-4950-abb1-dfda10885664"
/>

After:
<img width="614" alt="image"
src="https://github.com/user-attachments/assets/9c4944b0-83dc-4611-94bb-aae1758fab23"
/>


Release Notes:

- Fixed an issue where fuzzy matching in file finder did not properly
prioritize matches in file names.
2025-04-02 22:36:46 +05:30
Thomas Mickley-Doyle
45e7cd1638
Add comment box to negative feedback reaction (#27934)
Release Notes:

- N/A
2025-04-02 18:54:25 +02:00
Marshall Bowers
889bc13b7d
language_model: Remove use_any_tool method from LanguageModel (#27930)
This PR removes the `use_any_tool` method from the `LanguageModel`
trait.

It was not being used anywhere, and doesn't really fit in our new tool
use story.

Release Notes:

- N/A
2025-04-02 15:49:21 +00:00
Bennet Bo Fenner
da3383b10e
agent: Fix thinking step showing up as pending even though it is completed (#27926)
Release Notes:

- N/A
2025-04-02 15:43:39 +00:00
Antonio Scandurra
b413605f6b
Fix bug that prevented deletion-only hunks from being kept correctly (#27921)
Release Notes:

- N/A
2025-04-02 17:38:58 +02:00
Marshall Bowers
961bfadad9
agent: Return an error to the model when trying to use a tool that is disabled (#27928)
This PR makes it so we return an error to the model if it tries to use a
tool that is not currently enabled:

<img width="628" alt="Screenshot 2025-04-02 at 11 10 55 AM"
src="https://github.com/user-attachments/assets/e4bdf01c-f0ea-4c9c-805a-11868bd9c771"
/>

This allows the model to adapt based on that:

<img width="637" alt="Screenshot 2025-04-02 at 11 08 38 AM"
src="https://github.com/user-attachments/assets/41016b47-933c-4dcb-b791-847be0548c8a"
/>

Release Notes:

- N/A
2025-04-02 15:24:37 +00:00
Agus Zubiaga
2eed94ff23
agent: Include context with first message that introduced it (#27925)
We were including the context at the end which meant it never got
cached. We'll now include it with the first message that introduced it
so it's cached as long as it doesn't change.

This is an improvement, but we probably still need to think of ways to
optimize caching for cases where files in context change.

Release Notes:

- N/A
2025-04-02 12:14:48 -03:00