This PR makes it so the pending completion is cleared when an error
occurs.
This makes it so `Thread::is_streaming()` will return `false` in the
error case (and thus hide the streaming indicator in the UI).
Release Notes:
- N/A
Context pills are now focusable and intractable via the keyboard.
- <kbd>←</kbd> and <kbd>→</kbd> move the focus to the previous or next
item (wrapping if necessary)
- <kbd>↓</kbd> and <kbd>↑</kbd> move the focus vertically
- If the cursor is in the first/last row of the assistant/inline editor,
they will move the focus to the strip
- Inside the strip, they will move the focus to the pill horizontally
overlapping the most
- If already in the first/last row of the strip, they will move to the
first/last pill (like in editors)
- If the first/last pill is focused, they will move the focus back to
the editor
- <kbd>⌫</kbd> removes the focused pill (unless it's the suggested one)
- <kbd>⏎</kbd> accepts the suggested pill if focused
https://github.com/user-attachments/assets/040bc71c-a3ae-4961-9886-2d5c3d290a73
Release Notes:
- N/A
This PR is a follow-up to
https://github.com/zed-industries/zed/pull/22911 to further improve the
registration of code action providers for the Assistant in order to
prevent duplicates.
The `CodeActionProvider` trait now has an `id` method that is used to
return a unique ID for a code action provider. We use this to prevent
registering duplicates of the same provider.
The registration of the code action providers for Assistant1 and
Assistant2 have also been reworked. Previously we were not call the
registration function—and thus setting up the subscriptions—until we
resolved the feature flags. However, this could lead to the registration
happening too late for existing workspace items.
We now perform the registration right away and then remove the undesired
code action providers once the feature flags have been resolved.
Release Notes:
- N/A
The new `ContextMenu`-based `ContextPicker` requires initialization when
opened, but we were only doing this for the `ContextStrip` picker, not
the inline one.
Additionally, because we have a wrapper element around ContextMenu, we
need to propagate the `DismissEvent` so that it properly closes when
Escape is pressed.
Release Notes:
- N/A
This PR removes some unneeded `#[allow(unused)]`s from the context types
in Assistant2.
We're using these fields now, so we no longer need to suppress the
unused lint.
Release Notes:
- N/A
We weren't showing the keybinding in none of the places where the model
selector was visible. Also, I took advantage of the opportunity to
change the keybinding for two reasons:
1. `cmd-shift-m` caused conflict if on an editor (inline assistant case)
2. `cmd-opt-/` is the one Cursor uses; so consistency with something
that might be already consolidated sounds like a low-hanging fruit
| Editor Inline Assist | Terminal Inline Assist | Assistant Panel |
|--------|--------|--------|
| <img width="1336" alt="Screenshot 2025-01-10 at 11 01 24 AM"
src="https://github.com/user-attachments/assets/0782f217-025f-4bc0-b2fa-64b3524c968b"
/> | <img width="1336" alt="Screenshot 2025-01-10 at 11 01 29 AM"
src="https://github.com/user-attachments/assets/d05a3b5c-33fd-4593-b1d8-aa9944de816a"
/> | <img width="1336" alt="Screenshot 2025-01-10 at 11 01 33 AM"
src="https://github.com/user-attachments/assets/8cb075e7-ccde-46f5-aa05-d20a9d42b286"
/> |
Release Notes:
- N/A
The context picker will now display up to 6 recent files/threads to add
as a context:
<img
src="https://github.com/user-attachments/assets/80c87bf9-70ad-4e81-ba24-7a624378b991"
width=400>
Note: We decided to use a `ContextMenu` instead of `Picker` for the
initial one since the latter didn't quite fit the design for the
"Recent" section.
Release Notes:
- N/A
---------
Co-authored-by: Danilo <danilo@zed.dev>
Co-authored-by: Piotr <piotr@zed.dev>
Co-authored-by: Nathan <nathan@zed.dev>
* Now loads context on background threads.
- For file and directory context, buffer ropes can be shared between
threads as they are immutable. This allows for traversal and
accumulation of buffer text on a background thread.
- For url context, the request, parsing, and rendering is now done on a
background thread.
* Prepares for support of buffer reload by individually storing the text
of directory buffers.
* Avoids some string copying / redundant strings.
- When attaching message context, no longer builds a string for each
context type.
- For directory context, does not build a `SharedString` for the full
text, instead has a slice of `SharedString` chunks which are then
directly appended to the message context.
- Building a fenced codeblock for a buffer now computes a precise
capacity in advance.
Release Notes:
- N/A
This PR fixes the duplicated `Fix with Assistant` code actions that were
being shown in the code actions menu.
This fix isn't 100% ideal, as there is an edge case in buffers that are
already open when the workspace loads, as we may not observe the feature
flags in time to register the code action providers by the time we
receive the event that an item was added to the workspace.
Closes https://github.com/zed-industries/zed/issues/22400.
Release Notes:
- Fixed duplicate "Fix with Assistant" entries showing in the code
action list.
We'll now show an error message if the user tries to add a directory
that contains no text files or when they try to add a single non-text
file.
Release Notes:
- N/A
---------
Co-authored-by: Danilo <danilo@zed.dev>
Ensuring all of the assistant 2 actions have keybindings.
Release Notes:
- N/A
---------
Co-authored-by: Agus Zubiaga <hi@aguz.me>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This PR adds some intermediate bindings to the checks for if a
file/directory is already included to make the conditional a bit
clearer.
It wasn't immediately obvious what the boolean values corresponded to
when looking at it.
Release Notes:
- N/A
This PR makes it so the context is persistent in the thread, rather than
having to reattach it for each message.
This PR intentionally does not make an attempt to refresh the attached
context if it changes. That will come in a follow-up.
Release Notes:
- N/A
The most relevant change in this PR is ensuring that the path tooltip
doesn't overlap with the "Remove Context" tooltip. Now, the former
tooltip only shows if you hover over the context pill's label. This
avoids a little flicker that was happening as the path tooltip would
show first and then quickly followed by the icon button's one.
Release Notes:
- N/A
This PR is a small refactoring in advance of some other changes.
Previously we were storing the whole `Context` associated with each
message. However, it's likely that multiple messages may end up using
the same context.
We now store the deduped context in a separate collection and refer to
it from each message by its `ContextId`.
Release Notes:
- N/A
Context pills for files will now only display the basename of the file.
If two files have the same base name, we will also show their parent
directories, mimicking the behavior of editor tabs.
https://github.com/user-attachments/assets/ee88ee3b-80ff-4115-9ff9-8fe4845a67d8
Note: The double `/` in the file picker is a known separate issue.
Release Notes:
- N/A
---------
Co-authored-by: Danilo <danilo@zed.dev>
Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
This PR adds some missing calls to clear the sub-collections in the
`ThreadStore` when we call `ThreadStore::drain` or `ThreadStore::clear`.
Release Notes:
- N/A
- [x] Rewrite worktree git handling
- [x] Fix tests
- [x] Fix `test_propagate_statuses_for_repos_under_project`
- [x] Replace `WorkDirectoryEntry` with `WorkDirectory` in
`RepositoryEntry`
- [x] Add a worktree event for capturing git status changes
- [x] Confirm that the local repositories are correctly updating the new
WorkDirectory field
- [x] Implement the git statuses query as a join when pulling entries
out of worktree
- [x] Use this new join to implement the project panel and outline
panel.
- [x] Synchronize git statuses over the wire for collab and remote dev
(use the existing `worktree_repository_statuses` table, adjust as
needed)
- [x] Only send changed statuses to collab
Release Notes:
- N/A
---------
Co-authored-by: Cole Miller <cole@zed.dev>
Co-authored-by: Mikayla <mikayla@zed.com>
Co-authored-by: Nathan <nathan@zed.dev>
This PR adds another example thread to showcase a response with long
lines of code.
This example will be helpful when working to make the code blocks scroll
horizontally instead of wrapping.
Release Notes:
- N/A