This PR adds some ergonomic improvements when working with GPUI
`Global`s.
Two new traits have been added—`ReadGlobal` and `UpdateGlobal`—that
provide associated functions on any type that implements `Global` for
accessing and updating the global without needing to call the methods on
the `cx` directly (which generally involves qualifying the type).
I looked into adding `ObserveGlobal` as well, but this seems a bit
trickier to implement as the signatures of `cx.observe_global` vary
slightly between the different contexts.
Release Notes:
- N/A
Additionally, the internal `ToolView` trait used by the registry is now
called `InternalToolView`.
This should make it a bit easier to understand that the `ToolView` is
intended for a `gpui::View` (implementing `Render`). It does still feel
like more could be merged here but I think the built tools are now a bit
clearer.
Release Notes:
- N/A
Improves the descriptions for some of the tools. I wish we had metrics
to back up changes in how the model responds to tool schema changes so
anecdotally I'm just going to say this _seems_ improved.
Release Notes:
- N/A
This PR updates the saved conversation picker to use a list of
conversations retrieved from disk instead of the static placeholder
values.
Release Notes:
- N/A
This shows "Researching..." as placeholder text as early as possible so
that the user can see the model is working on reading/researching/etc.
This also adds on an `Option<Value>` to the `render_running` function so
that tools can hopefully render based on partially completed JSON (still
to come).
Release Notes:
- N/A
This PR updates the new assistant with a button to start a new
conversation.
Clicking on it will reset the chat and put it into a fresh state.
The current conversation will be serialized and written to
`~/.config/zed/conversations`.
Release Notes:
- N/A
This PR adds the general structure for conversation history to the new
assistant.
Right now we have a placeholder button in the assistant panel that will
toggle a picker containing some placeholder saved conversations.
Release Notes:
- N/A
This PR restructures the way that tools and attachments add information
about the current project to a conversation with the assistant. Rather
than each tool call or attachment generating a new tool or system
message containing information about the project, they can all
collectively mutate a new type called a `ProjectContext`, which stores
all of the project data that should be sent to the assistant. That data
is then formatted in a single place, and passed to the assistant in one
system message.
This prevents multiple tools/attachments from including redundant
context.
Release Notes:
- N/A
---------
Co-authored-by: Kyle <kylek@zed.dev>
This PR adjusts the names of the negated style methods by moving the
`neg_` to after the property name instead of before.
This will help keep related style methods grouped together in
completions.
It also makes it a bit clearer that the negation applies to the value.
### Before
```rs
div()
.neg_mx_1()
.neg_mt_2()
```
### After
```rs
div()
.mx_neg_1()
.mt_neg_2()
```
Release Notes:
- N/A
This PR makes the `border` methods require an explicit width instead of
defaulting to 1px.
This breaks convention with Tailwind, but it makes GPUI more consistent
with itself. We already have an edge case where the parameterized method
had to be named `border_width`, since `border` was taken up by an alias
for the 1px variant.
### Before
```rs
div()
.border()
.border_t()
.border_r()
.border_b()
.border_l()
.border_width(px(7.))
```
### After
```rs
div()
.border_1()
.border_t_1()
.border_r_1()
.border_b_1()
.border_l_1()
.border(px(7.))
```
Release Notes:
- N/A
The CI was green at the time I've merged Rust 1.78, but a change that
violated clippy::empty_doc has slipped through into main in the
meantime. Mea culpa, I should've reran the CI.
Release Notes:
- N/A
Notable things I've had to fix due to 1.78:
- Better detection of unused items
- New clippy lint (`assigning_clones`) that points out places where assignment operations with clone rhs could be replaced with more performant `clone_into`
Release Notes:
- N/A
This fixes a tricky intermittent issue I was seeing, where failed to
chunk certain files correctly because of the way we reuse Tree-sitter
`Parser` instances across parses.
I've also accounted for leading comments in chunk boundaries, so that
items are grouped with their leading comments whenever possible when
chunking.
Finally, we've changed the `debug project index` action so that it opens
a simple debug view in a pane, instead of printing paths to the console.
This lets you click into a path and see how it was chunked.
Release Notes:
- N/A
---------
Co-authored-by: Marshall <marshall@zed.dev>
This PR updates the new assistant to use the new (temporary) icon in the
status bar to distinguish it.
We added the icon in #11257, but hadn't wired it up.
Release Notes:
- N/A
Previously, a failure to embed the search query (due to a rate limit
error) would appear the same as if there were no results.
* Avoid repeatedly embedding the search query for each worktree
* Unify tasks for searching all worktree
Release Notes:
- N/A
This PR refines the UX of editing a previous message, including the
following:
- Focus the prev message body editor on double-click
- Restore previous body text on cancel
- Cancel pending completion upon submission of previous message
- Drive-by: Remove min height on composer editor
Release Notes:
- N/A
---------
Co-authored-by: Marshall Bowers <marshall@zed.dev>
This PR sets up the `assistant2` crate with the storybook so that UI
elements can be iterated on in isolation.
To start, we have some stories for the `ChatMessage` component:
```sh
cargo run -p storybook -- components/assistant_chat_message
```
<img width="1233" alt="Screenshot 2024-04-30 at 5 20 03 PM"
src="https://github.com/zed-industries/zed/assets/1486634/510967ea-0e9b-4fa9-94fb-421ee74bcc45">
Release Notes:
- N/A
* [x] Fixed an issue where embeddings would be assigned incorrectly to
files if a subset of embedding batches failed
* [x] Added a command to debug which paths are present in the semantic
index
* [x] Determine why so many paths are often missing from the semantic
index
* we erroring out if an embedding batch contained multiple texts that
were the same, which can happen if a worktree contains multiple copies
of the same text (e.g. a license).
Release Notes:
- N/A
---------
Co-authored-by: Marshall <marshall@zed.dev>
Co-authored-by: Nathan <nathan@zed.dev>
Co-authored-by: Kyle <kylek@zed.dev>
Co-authored-by: Kyle Kelley <rgbkrk@gmail.com>
This PR adds a new tool to the `assistant2` crate that allows the
assistant to create a new buffer with some content.
Release Notes:
- N/A
---------
Co-authored-by: Nathan <nathan@zed.dev>
This PR does a slight restructuring of how tools are defined in the
`assistant2` crate to make it more amenable to adding more tools in the
near future.
Release Notes:
- N/A
This PR updates the new assistant panel to use the `ChatMessage`
component to render its chat messages.
This also lays the foundation for collapsing the messages, though that
has yet to be wired up.
Adapted from the work on the `assistant-chat-ui` branch.
Release Notes:
- N/A
This PR restores the `Global` trait's status as a marker trait.
This was the original intent from #7095, when it was added, that had
been lost in #9777.
The purpose of the `Global` trait is to statically convey what types can
and can't be accessed as `Global` state, as well as provide a way of
restricting access to said globals.
For example, in the case of the `ThemeRegistry` we have a private
`GlobalThemeRegistry` that is marked as `Global`:
91b3c24ed3/crates/theme/src/registry.rs (L25-L34)
We're then able to permit reading the `ThemeRegistry` from the
`GlobalThemeRegistry` via a custom getter, while still restricting which
callers are able to mutate the global:
91b3c24ed3/crates/theme/src/registry.rs (L46-L61)
Release Notes:
- N/A