Commit graph

20643 commits

Author SHA1 Message Date
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
Antonio Scandurra
7a54dd7190
Avoid requiring confirmation for tools that edit buffers (#27923)
It's super easy to undo those changes. In a future PR, we should also
avoid requiring confirmation in the batch tool if all the underlying
tools don't require confirmation.

Release Notes:

- N/A
2025-04-02 15:13:16 +00:00
Cole Miller
8ac4cbcbb9
Don't create repos for invisible worktrees (#27894)
Closes #ISSUE

Release Notes:

- Fixed git repositories being added for files outside the project
2025-04-02 15:11:12 +00:00
Marshall Bowers
d82bf132ca
agent: Remove unneeded branch in use_pending_tools (#27922)
This PR removes an unneeded `else if` branch that was the same as the
previous branch in the conditional.

Doesn't seem necessary to run this twice.

Release Notes:

- N/A
2025-04-02 14:50:24 +00:00
Danilo Leal
0f58d4f533
agent: Remove duplicate OpenConfiguration action registration (#27918)
I had introduced the same thing a few days ago without noticing there
was one in place already!

Release Notes:

- N/A
2025-04-02 10:16:59 -04:00
Antonio Scandurra
d340670fd4
Ensure rejecting a hunk dismisses the diff (#27919)
Release Notes:

- N/A
2025-04-02 14:06:36 +00:00
Danilo Leal
ad42a8ad9b
agent: Adjust permission card design (#27911)
<img
src="https://github.com/user-attachments/assets/76ae380c-6d5b-4ed6-9b47-9a4c44b00042"
width="500" />

Release Notes:

- N/A
2025-04-02 10:03:43 -03:00
Marshall Bowers
2846c55cde
agent: Account for tool use messages without any corresponding text (#27917)
This PR makes it so if we receive a tool use from the model without any
corresponding text, we'll insert some placeholder text to keep the
conversation in a well-structured format.

This aims to fix an error that Antonio was seeing:


![image](https://github.com/user-attachments/assets/eeba95ef-9b67-41d7-bce3-afe84bcdc7b1)

Release Notes:

- N/A
2025-04-02 12:56:50 +00:00
Marshall Bowers
5dcd0d37a6
language_models: Denote Copilot Chat as not supporting tools (#27909)
This PR updates the Copilot Chat language model to indicate it does not
yet support tool use in Zed.

Release Notes:

- N/A
2025-04-02 12:12:09 +00:00
Bennet Bo Fenner
b158ee60ca
Fix Gemini function calling (#27905)
This seems to improve the performance of `gemini-2.5-pro-exp-03-25`
significantly.
We know define a single `Tool` that has multiple `FunctionDeclaration`s,
instead of defining multiple `Tool`s with a single
`FunctionDeclaration`.
Oddly enough the `flash` models seemed to work perfectly fine with the
multiple `Tool { ... }` definitions

Release Notes:

- N/A
2025-04-02 10:35:17 +00:00
Bennet Bo Fenner
9b7b4a9d2d
assistant2: Use snake_case for tool names (#27903)
The [Gemini
docs](https://ai.google.dev/gemini-api/docs/function-calling?example=weather#function_declarations)
state that function names should be in `snake_case` or `camelCase`.

Release Notes:

- N/A
2025-04-02 12:17:58 +02:00
Antonio Scandurra
c1d6dfd832
Update selection when keeping/rejecting hunks (#27902)
Release Notes:

- N/A
2025-04-02 08:38:26 +00:00
0x2CA
57d7bc23ae
vim: Add g? convert to Rot13/Rot47 (#27824)
Release Notes:

- Added `g?` convert to `Rot13`/`Rot47`

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2025-04-02 02:17:00 +00:00
Conrad Irwin
7bc0dd1bf6
Don't unwrap on bad zstd data (#27891)
Closes #ISSUE

Release Notes:

- N/A
2025-04-01 20:09:18 -06:00
Marshall Bowers
dc83f1ad38
Rename assistant2 to agent (#27887)
This PR renames the `assistant2` crate to `agent`.

Release Notes:

- N/A
2025-04-02 00:40:47 +00:00
Marshall Bowers
8e0f70f3c7
Bump revision for livekit-rust-sdks (#27886)
This PR bumps the revision of the `livekit-rust-sdks` crate.

I was running into issue where Cargo was stuck on "Updating git
submodule `https://chromium.googlesource.com/libyuv/libyuv`".

I resolved the issue by forking `libyuv` to
https://github.com/zed-industries/libyuv and updating our
`livekit-rust-sdks` fork to use it in
https://github.com/zed-industries/livekit-rust-sdks/pull/4.

Release Notes:

- N/A
2025-04-02 00:24:08 +00:00
Cole Miller
6262a4638b
Fix a bug that prevented repositories from being deduplicated (#27884)
Closes #ISSUE

Release Notes:

- Ensure that only one repository is shown in the git UI when two
subdirectories of a repository root are open in Zed
2025-04-01 22:41:01 +00:00
Julia Ryan
4110928314
nix: Clean up build (#27881)
- bump our livekit version to include a fix for a crane bug (TODO: add
link when an issue is filed on crane)
- switch to a clang stdenv for both linux and macos
- manually unify versions of our notify crate
- remove old linker flags which were only needed for livekit
- fix an issue where RUSTFLAGS shadowed the rustflags from cargo configs

Release Notes:

- N/A
2025-04-01 22:35:15 +00:00
Marshall Bowers
a1b53e91e7
git: Use doc comments for ResetMode variants (#27882)
This PR updates the `ResetMode` enum to use doc comments for its
variants instead of line comments.

Release Notes:

- N/A
2025-04-01 22:19:29 +00:00
Antonio Scandurra
4a252515b1
Improve tracking for agent edits (#27857)
Release Notes:

- N/A

---------

Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2025-04-01 22:13:28 +00:00
Agus Zubiaga
d26c477d86
assistant2: Summarize threads in context and continue long ones (#27851)
We'll now prompt the user to start a new thread when the active one gets
too long.

<img width=500
src="https://github.com/user-attachments/assets/91445bc0-3e81-422f-aa4a-b8f0741f9d9a"></img>


When they click "Start New Thread", will create a new one with the
previous one added as context.

<img width=500
src="https://github.com/user-attachments/assets/c3b4223f-5bdd-4ba4-956f-5a5880d5e2c3"></img>

Instead of including the full thread text, we'll now add summarized
versions of threads to the context, allowing you to continue the
conversation even if it was near the token limit.

- Thread summaries are cached and persisted. 
- A cached summary is invalidated if the thread is continued.
- We start generating the thread summary as soon as it's selected from
the picker. Most times, the summary will be ready by the time the user
sends the message.
- If the summary isn't ready by the time a message is sent, the user
message will be displayed in the thread immediately, and a "Summarizing
context..." indicator will appear. After the summaries are ready, we'll
start generating the response and show the usual "Generating..."
indicator.

Release Notes:

- N/A

---------

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
Co-authored-by: Marshall Bowers <git@maxdeviant.com>
2025-04-01 21:48:56 +00:00
KyleBarton
16f625bd07
Add persistence to command palette history (#26948)
Closes #20391

### Summary
This adds a persistence layer to the command palette so that usages can
persist after Zed is closed and re-opened.

The current "usage" algorithm is unchanged, e.g.:
- Sorts by number of usages descending (no recency preference)
- Once a user's query is active, removes these suggestions in favor of
fuzzy matching

There are some additional considerations in order to keep the DB from
growing uncontrollably (and to make long-term use ergonomic):
- The "invocations" count handles max values (though at u16, it seems
unlikely a user will deal with this)
- If a command is un-invoked for more than a month, it stops being
considered a recent usage, and its next update will update its usages
back to 1

### Future Considerations
- Could make the "command expiry" configurable in settings, so the user
can decide how long to hold onto recent usages
- Could make a more sophisticated algorithm which balances recency and
total invocations - e.g. if I've used COMMAND_A 100 times in the last
month, but COMMAND_B 10 times today, should COMMAND_B actually be
preferred?
- Could do preferential fuzzy-matching against these matches once the
user starts a query.

Release Notes:

- Added persistent history of command palette usages.

---------

Co-authored-by: Peter Finn <mastion11@gmail.com>
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2025-04-01 15:46:35 -06:00
Conrad Irwin
9bc4697a33
Use new multibuffer excerpts in find-all-references and friends (#27876)
Release Notes:

- N/A

---------

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2025-04-01 15:42:32 -06:00
Cole Miller
e7290df02b
Finish removing git repository state and scanning logic from worktrees (#27568)
This PR completes the process of moving git repository state storage and
scanning logic from the worktree crate to `project::git_store`.

Release Notes:

- N/A

---------

Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-authored-by: Conrad <conrad@zed.dev>
2025-04-01 17:41:20 -04:00
Marshall Bowers
8f25251faf
assistant2: Rename assistant2 actions to agent (#27877)
This PR renames the `assistant2` actions to `agent`.

Note that any `assistant` actions have been left as-is for now so that
there aren't any changes to users not in the feature flag.

Release Notes:

- N/A
2025-04-01 21:25:30 +00:00
Agus Zubiaga
2d05537b59
assistant2: Fix notification max width (#27872)
<img width=400
src="https://github.com/user-attachments/assets/4132e075-3f2a-4c65-8c06-c3428f3ad477">

<img width=400
src="https://github.com/user-attachments/assets/95908b32-a9b9-45c3-9db9-dcbeedffc5e7">

Release Notes:

- N/A
2025-04-01 18:16:53 -03:00
5brian
95b963c87b
vim: Add :Git (#27874)
Just adding to the existing https://zed.dev/docs/vim#ex-commands

Captial G is not used by vim commands.

Release Notes:

- N/A
2025-04-01 15:12:36 -06:00
Marshall Bowers
5d1695ed1d
assistant2: Add affordances for when the selected model does not support tools (#27870)
This PR adds some affordances for when the currently-selected model does
not support tools.

We disable the profile selector and put it into a "No Tools" state:

<img width="1394" alt="Screenshot 2025-04-01 at 3 58 00 PM"
src="https://github.com/user-attachments/assets/de6ecb0f-7657-4e16-9d5d-7bbfbc2b0a5c"
/>

We will also only attach tools to the request to the model if the model
supports it.

Release Notes:

- N/A
2025-04-01 20:13:06 +00:00
Danilo Leal
192097f58f
assistant2: Ensure errors are also displayed in populated new thread view (#27869)
Follow-up to https://github.com/zed-industries/zed/pull/27812

This PR makes sure these errors cases also show up in the panel's empty
state even when there is past data.

| No ToS | Missing Provider |
|--------|--------|
| ![CleanShot 2025-04-01 at 4  49
36@2x](https://github.com/user-attachments/assets/6da6bdc9-daa6-4a7b-a224-989eb845e205)
| ![CleanShot 2025-04-01 at 4  50
04@2x](https://github.com/user-attachments/assets/bddf62cb-3727-44b5-b115-9a88313c6d85)
|

Release Notes:

- N/A
2025-04-01 17:06:34 -03:00
Agus Zubiaga
92059803fb
find-replace tool: Return diff in output (#27868)
This should help the model maintain an accurate picture of the file as
it makes changes

Release Notes:

- N/A
2025-04-01 19:57:32 +00:00
Marshall Bowers
5880271b11
language_model: Add supports_tools method to LanguageModel (#27867)
This PR adds a new `supports_tools` method to the `LanguageModel` trait
to indicate whether a given model supports tool use.

Release Notes:

- N/A
2025-04-01 19:56:05 +00:00
Cole Miller
4ff07bf789
Fix restore button (#27866)
ID collision!

Release Notes:

- N/A
2025-04-01 19:33:30 +00:00
Max Brunsfeld
b59967bbdf
Don't allow open excerpts in commit view for now (#27862)
Follow-up to https://github.com/zed-industries/zed/pull/27636

Release Notes:

- N/A
2025-04-01 11:40:45 -07:00
Marshall Bowers
133d3f052f
assistant2: Update some text to use "agent" nomenclature (#27864)
This PR updates some text in the Agent Panel to use the "agent"
nomenclature.

Release Notes:

- N/A
2025-04-01 18:33:28 +00:00
Cole Miller
0934cb58c4
Don't prompt twice when trashing added files from git panel (#27863)
Closes #ISSUE

Release Notes:

- N/A
2025-04-01 18:25:58 +00:00
Peter Finn
bda33ec436
vim: Fix space forward bug with non-ASCII characters at EOL (#27860)
Closes https://github.com/zed-industries/zed/issues/27619

Fixes issue with right wrapped movement when a multi-byte character is
at the end of the line. This is done by grabbing the last character on
the current row and using that characters size to calculate the
`max_column` variable, which is used to decide if the next right
movement should move down the line or not.

We did notice a bit of code that could be an issue that we wanted to
call out.
[Here](https://github.com/zed-industries/zed/blob/main/crates/editor/src/display_map.rs#L1070)
inside of `clip_at_line_end` it also does a saturating_sub(1), assuming
a single byte character. We didn't run into any issues due to this line
but felt like a similar bug. We can apply a similar fix if wanted to
pose the question first.

Test case: Moving to next line when eol is a multi-byte character


https://github.com/user-attachments/assets/1021ab1f-f49d-4986-8f9a-8cfc7e5c91bc


Release Notes:

- Fixed issue in vim forward spacing when a multi-byte character is at
the eol

---------

Co-authored-by: KyleBarton <kjbarton4@gmail.com>
2025-04-01 18:21:41 +00:00
Danilo Leal
64ef3ab09d
ui: Introduce Banner component (#27853)
This PR adds a new, generic `Banner` component so that we can
potentially replace the multiple, isolated implementations of it
throughout some places of the app.

<img
src="https://github.com/user-attachments/assets/a268f745-1747-48e6-9461-2732eb7c0be4"
width="750"/>

Release Notes:

- N/A
2025-04-01 14:36:38 -03:00
Elvis Pranskevichus
ac5a2b2122
python: Add recognition of worktree -> venv links (#26759)
Python envs created with virtualenvwrapper have the ability to link to
the project directory (via the `.project` file in the virtualenv).
`python-environment-tools` supports this and reports the project path.

Additionally, some tools (e.g virtualfish) recognize special
"environment activation" files in project directories (`.venv` by
default)
[1].

Use the above information to sort reported Python toolchains so that the
correct env for a given worktree is at the top.

[1]
https://virtualfish.readthedocs.io/en/latest/plugins.html#auto-activation-auto-activation

Release Notes:

- python: Improved detection of virtualenvwrapper environments in work
trees
2025-04-01 19:12:16 +02:00
Max Brunsfeld
ada8b0f822
Show commit author, not committer (#27856)
Release Notes:

- Fixed a bug where the git panel displayed a commit's committer in
place of its author.
2025-04-01 09:55:56 -07:00
Antonio Scandurra
76871056f5
Preserve cursor position when resetting excerpts (#27850)
Release Notes:

- N/A

---------

Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2025-04-01 16:55:10 +00:00
Marshall Bowers
f859b328f0
assistant2: Use "Agent Panel" nomenclature for panel tooltip (#27858)
This PR updates the Agent Panel tooltip in the status to use "Agent
Panel" instead of "Assistant Panel".

Also changes the name we use in workspace serialization.

Release Notes:

- N/A
2025-04-01 16:54:40 +00:00
Marshall Bowers
e63df58adc
assistant2: Rename key context to AgentPanel (#27859)
This PR renames the key context for the Agent Panel from
"AssistantPanel2" to "AgentPanel".

Release Notes:

- N/A
2025-04-01 16:42:31 +00:00
Marshall Bowers
0ad4656489
assistant_settings: Show JSON schema for profile settings (#27855)
This PR makes it so we include the `default_profile` and `profiles`
settings in the JSON schema.

This provides completions when editing the `settings.json`.

Release Notes:

- N/A
2025-04-01 16:34:48 +00:00
Piotr Osiewicz
992831ceb6
workspace: Do not call set_active when deserializing a dock if that dock was not visible (#27852)
This unblocks work on new debugger UI, where we don't want the
set_active function to be called unconditionally.

Release Notes:

- N/A

---------

Co-authored-by: Anthony Eid <hello@anthonyeid.me>
2025-04-01 16:33:52 +00:00
Bennet Bo Fenner
feb1d37798
assistant2: Allow clicking on @mentions (#27846)
https://github.com/user-attachments/assets/f6f7c115-5c40-48f9-a099-2b691993967b

Release Notes:

- N/A
2025-04-01 15:44:20 +00:00
Marshall Bowers
12037dc2c6
assistant2: Allow profiles to enable all context servers (#27847)
This PR adds a new `enable_all_context_servers` field to agent profiles
to allow them to enable all context servers without having to opt into
them individually.

The "Write" profile will now have all context servers enabled out of the
box.

Release Notes:

- N/A
2025-04-01 15:25:23 +00:00
Danilo Leal
ab31eb5d51
edit prediction: Show display mode options just for Zed (#27844)
Eager and Subtle modes are only supported for Zed as an edit prediction
provider and they were visible if your provider is Copilot, which is
misleading.

Release Notes:

- N/A
2025-04-01 11:07:24 -03:00
Danilo Leal
7d67bd480b
assistant2: Remove check icon from successful tool calls (#27840)
Just to streamline the UI more.

Release Notes:

- N/A
2025-04-01 10:02:21 -03:00