This is the core change:
https://github.com/zed-industries/zed/pull/26758/files#diff-044302c0d57147af17e68a0009fee3e8dcdfb4f32c27a915e70cfa80e987f765R1052
TODO:
- [x] Use AsyncFn instead of Fn() -> Future in GPUI spawn methods
- [x] Implement it in the whole app
- [x] Implement it in the debugger
- [x] Glance at the RPC crate, and see if those box future methods can
be switched over. Answer: It can't directly, as you can't make an
AsyncFn* into a trait object. There's ways around that, but they're all
more complex than just keeping the code as is.
- [ ] Fix platform specific code
Release Notes:
- N/A
In the process of adding `@mentions` we realized that we do not want to
make a distinction between Files & Directories in the UI, therefore this
PR combines the File & Directory pickers into a unified version
https://github.com/user-attachments/assets/f3bf189c-8b69-4f5f-90ce-0b83b12dbca3
(Ignore the `@mentions`, they are broken also on main)
Release Notes:
- N/A
Give the inline file crease inside of `assistant2`'s editor a
selection background when there is a selection over it
Release Notes:
- N/A
---------
Co-authored-by: Piotr <piotr@zed.dev>
Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
In both `thread` and `prompt editor` the context file picker, gitignored
files are hidden (as expected) when searching files by path, but they
are still shown initially as you create the file picker.
Plus, selecting gitignored files in the `prompt editor` is bugged and
collapses everything.
This PR settles on not showing gitignored files to solve these
inconsistencies.
Release Notes:
- Fix gitignored files filter occasionally not working in context file
picker.
There's still a bit more work to do on this, but this PR is compiling
(with warnings) after eliminating the key types. When the tasks below
are complete, this will be the new narrative for GPUI:
- `Entity<T>` - This replaces `View<T>`/`Model<T>`. It represents a unit
of state, and if `T` implements `Render`, then `Entity<T>` implements
`Element`.
- `&mut App` This replaces `AppContext` and represents the app.
- `&mut Context<T>` This replaces `ModelContext` and derefs to `App`. It
is provided by the framework when updating an entity.
- `&mut Window` Broken out of `&mut WindowContext` which no longer
exists. Every method that once took `&mut WindowContext` now takes `&mut
Window, &mut App` and every method that took `&mut ViewContext<T>` now
takes `&mut Window, &mut Context<T>`
Not pictured here are the two other failed attempts. It's been quite a
month!
Tasks:
- [x] Remove `View`, `ViewContext`, `WindowContext` and thread through
`Window`
- [x] [@cole-miller @mikayla-maki] Redraw window when entities change
- [x] [@cole-miller @mikayla-maki] Get examples and Zed running
- [x] [@cole-miller @mikayla-maki] Fix Zed rendering
- [x] [@mikayla-maki] Fix todo! macros and comments
- [x] Fix a bug where the editor would not be redrawn because of view
caching
- [x] remove publicness window.notify() and replace with
`AppContext::notify`
- [x] remove `observe_new_window_models`, replace with
`observe_new_models` with an optional window
- [x] Fix a bug where the project panel would not be redrawn because of
the wrong refresh() call being used
- [x] Fix the tests
- [x] Fix warnings by eliminating `Window` params or using `_`
- [x] Fix conflicts
- [x] Simplify generic code where possible
- [x] Rename types
- [ ] Update docs
### issues post merge
- [x] Issues switching between normal and insert mode
- [x] Assistant re-rendering failure
- [x] Vim test failures
- [x] Mac build issue
Release Notes:
- N/A
---------
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Cole Miller <cole@zed.dev>
Co-authored-by: Mikayla <mikayla@zed.dev>
Co-authored-by: Joseph <joseph@zed.dev>
Co-authored-by: max <max@zed.dev>
Co-authored-by: Michael Sloan <michael@zed.dev>
Co-authored-by: Mikayla Maki <mikaylamaki@Mikaylas-MacBook-Pro.local>
Co-authored-by: Mikayla <mikayla.c.maki@gmail.com>
Co-authored-by: joão <joao@zed.dev>
`@mention`ed files in assistant2 now get replaced by the full path of
the file in what gets sent to the model, while rendering visually as
just the filename (in a crease, so they can only be selected/deleted as
a whole unit, not character by character).
https://github.com/user-attachments/assets/a5867a93-d656-4a17-aced-58424c6e8cf6
Release Notes:
- N/A
---------
Co-authored-by: João Marcos <joao@zed.dev>
Co-authored-by: Conrad <conrad@zed.dev>
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
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
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>
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 adds an initial version of using `@` in the message editor to
add context to the thread.
We don't yet insert any sort of reference to it in the message body
itself.
Release Notes:
- N/A
This PR fixes an issue with the Assistant2 file context picker where
files weren't being attached properly.
We needed to retrieve the files from the worktree without the worktree
root name in the file path.
Release Notes:
- N/A
---------
Co-authored-by: Max <max@zed.dev>
This PR wire up the context picker with the inline assist.
UI is not finalized.
Release Notes:
- N/A
---------
Co-authored-by: Richard <richard@zed.dev>
Co-authored-by: Agus <agus@zed.dev>

- Adds the Switch component
- Updates `Selected`, `Selectable` -> `ToggleState`, `Toggleable`
- Adds `checkbox` and `switch` functions to align better with other
elements in our layout system.
We decided not to merge Switch and Checkbox. However, in a followup I'll
introduce a Toggle or AnyToggle enum so we can update
`CheckboxWithLabel` -> `ToggleWithLabel` as this component will work
exactly the same with either a Checkbox or a Switch.
Release Notes:
- N/A