This PR adds the ability to change the predict edits URL using the
`ZED_PREDICT_EDITS_URL` environment variable.
This allows for easily pointing Zed to a development version of the
Cloudflare Worker.
Release Notes:
- N/A
We were reading edit prediction settings too often, causing frames to be
dropped. We'll now cache them and update them from
`update_visible_inline_completion`.
Release Notes:
- N/A
This PR updates the edit predictions to include the prediction ID
returned from the server on the resulting telemetry events indicating
whether the prediction was accepted or discarded.
The `prediction_id` on the events can then be correlated with the
`request_id` on the server-side prediction events.
Release Notes:
- N/A
- [x] snake case keymap properties
- [x] flatten actions
- [x] keymap migration + notfication
- [x] settings migration + notification
- [x] inline completions -> edit predictions
### future:
- keymap notification doesn't show up on start up, only on keymap save.
this is existing bug in zed, will be addressed in seperate PR.
Release Notes:
- Added a notification for deprecated settings and keymaps, allowing you
to migrate them with a single click. A backup of your existing keymap
and settings will be created in your home directory.
- Modified some keymap actions and settings for consistency.
---------
Co-authored-by: Piotr Osiewicz <piotr@zed.dev>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
* When an edit prediction is present in non-insertion modes, hide it but
show `tab Jump to edit`.
* Removes discarding of edit predictions when going from insert mode to
normal mode, instead just hide them in non-insertion modes.
* Removes zeta-specific showing of predictions in normal mode. This
behavior was only happening in special cases anyway - where the discard
of completions wasn't happening due to some other thing taking
precedence in `dismiss_menus_and_popups`.
Release Notes:
- N/A
---------
Co-authored-by: Conrad <conrad@zed.dev>
Co-authored-by: Mikayla <mikayla@zed.dev>
This PR makes it so we send up the diagnostic groups as additional data
with the edit prediction request.
We're not yet making use of them, but we are recording them so we can
use them later (e.g., to train the model).
Release Notes:
- N/A
---------
Co-authored-by: Nathan <nathan@zed.dev>
Follow-up to https://github.com/zed-industries/zed/pull/24278
This PR ensures we're checking if there's a license-type file in both US
& UK English spelling, and fixes the error logging again, treating for
when the worktree contains just a single file or multiple.
Release Notes:
- N/A
Co-authored-by: Bennet Bo Fenner <53836821+bennetbo@users.noreply.github.com>
Logging an error in this case isn't super necessary.
Release Notes:
- N/A
Co-authored-by: Bennet Bo Fenner <53836821+bennetbo@users.noreply.github.com>
This PR updates the `zeta` crate to use the predictive edit DTOs defined
in the `zed_llm_client` crate.
This way we aren't duplicating their definitions (and risk them going
out of sync).
Release Notes:
- N/A
This PR renames some bindings from `data_collection_permission` back to
`can_collect_data`, as the latter name is clearer on account of being a
modal verb.
Release Notes:
- N/A
Note that this does *not* involve any breaking code changes.
cc @0xtimsb - I didn't change any settings or anything here. That can
happen separately!
Release Notes:
- N/A
## Context
While looking through the client crate, I noticed that some of the old
functions and variables were still using gpui::model name that was
deprecated during the gpui3 transition. This PR renames those instances
of model to entity to be more inline with gpui3.
In addition, I also renamed `model` to `entity` in cases found by the
below search terms given by @someone13574
- model = cx.
- model: Entity
- model: &Entity
- OpenedModelHandle
- model.update
- model.upgrade
- model = .*\.root (regex)
- parent_model
- model = cx.new
- cx.spawn(move |model
Release Notes:
- N/A
Also send the `speculated_output` (which is just the editable region) to
the llm backend
Closes #ISSUE
Release Notes:
- N/A
---------
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Follow-up to: https://github.com/zed-industries/zed/pull/24031
This PR adds a new function that allows the UI also to display the state
of the data collection. Previously, we only showed that if the project
adhered to the `is_open_source` condition. Now, we show it for all
projects.
Release Notes:
- N/A
After the user confirmation, only the current instance of the
completions provider had the answer stored.
In this PR, the changes are propagated by having each provider have an
`Entity<choice>`, and having a lookup map with one `Entity<choice>` for
each worktree that `Zeta` has seen.
Release Notes:
- N/A
This PR changes the edit predictions URL for Zed Staff back to
`llm.zed.dev/predict_edits`.
This endpoint is now being routed to the Cloudflare Workers instead of
the LLM service.
Release Notes:
- N/A
Realized that the logic in #23814 was more than needed, and harder to
maintain. Something like that could make sense if using the tokenizer
and wanting to precisely hit a token limit. However in the case of edit
predictions it's more of a latency+expense vs capability tradeoff, and
so such precision is unnecessary.
Happily this change didn't require much extra work, just copy-modifying
parts of that change was sufficient.
Release Notes:
- N/A
This ensures that we do not fetch a new completion when the edits of the
user can be interpolated.
E.g. (suggestions in `[]`):
```rust
s[truct Person {}]
```
Then if i type out `truct` we will not fetch a new completion
Release Notes:
- N/A
Limits the size of the buffer excerpt and the size of change history.
Release Notes:
- N/A
---------
Co-authored-by: Richard <richard@zed.dev>
Co-authored-by: Joao <joao@zed.dev>
This PR makes it so staff edit predictions now go through Cloudflare
Workers instead of going to the LLM service.
This will allow us to dogfood the new LLM worker to make sure it is
working as expected.
Release Notes:
- N/A
Previously we returned an error when the interpolation failed in
`process_completion_response`.
However, it is not an error when interpolation returns `None`. That just
means that the predicted edits can be discarded, because the user typed
something that is not a subset of what the model predicted OR if the
model responds with a no-op.
```
2025-01-29T09:44:30.221135+01:00 [ERROR] zeta prediction failed
Caused by:
Interpolated edits are empty
```
Release Notes:
- N/A
This fixes the panics we we're seeing in `EditPreview::highlight_edits`.
The reason for this was that we were interpolating edits incorrectly.
Here's an example:
```rust
let a = 0; // existing code
let c = 2; // suggested by edit prediction
```
The edits would look like this: `[(Point(1, 0)..Point(1, 0), "let c =
2;"]`
Now i type:
```rust
let a = 0; // existing code
let b = 1; // added this line
let c = 2; // suggested by edit prediction
```
Before this change, the `interpolate` function would allow insertions
before the edit prediction edits, the anchors will move to the next
line.
The edits would look now like this: `[(Point(2, 0)..Point(2, 0), "let c
= 2;"]`
However, now we end up with a call to `EditPreview::highlight_edits`,
with the following parameters:
- current_snapshot:
```rust
let a = 0;
let b = 1;
```
- edits: `[(Point(2, 0)..Point(2, 0), "let c = 2;"]`
- applied_edits_snapshot:
```rust
let a = 0;
let c = 2;
```
And here you can see the issue, applying the `edits` to the
`current_snapshot` should always end up re-creating the text that is
present in the `applied_edits_snapshot`. That is not the case here
though, meaning that the offsets in the new buffer are not correct,
which can either lead to a confusing popup or a crash if the suggestion
is at the end of the file.
Here's a real world example (edit prediction is ONLY suggesting to
delete a new line):
<img width="487" alt="Screenshot 2025-01-27 at 13 05 26"
src="https://github.com/user-attachments/assets/a0a8064e-8cfa-48b2-9f1c-efc2d0d9d7d4"
/>
We fixed this by only allowing interpolation if the user is editing
after all the edit predictions OR if the user edit is a subset of the
model suggestion.
Co-Authored-by: Antonio <antonio@zed.dev>
Release Notes:
- N/A
Co-authored-by: Antonio <antonio@zed.dev>
Fix a bug where a GPUI macro still used `ModelContext`
Rename `AsyncAppContext` -> `AsyncApp`
Rename update_model, read_model, insert_model, and reserve_model to
update_entity, read_entity, insert_entity, and reserve_entity
Release Notes:
- N/A
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>
#23460 brought up we are showing the new "tab Accept" marker for single
line suggestions for non-zeta providers. We think this might be valid
for any provider, but we only want to enable it for zeta initially so it
doesn't affect an existing user base.
Release Notes:
- N/A
Note: Design hasn't been reviewed yet, but the logic is done
When the user switches the inline completion provider to `zed`, we'll
show a modal prompting them to accept terms if they haven't done so:
https://github.com/user-attachments/assets/3fc6d368-c00a-4dcb-9484-fbbbb5eb859e
If they dismiss the modal, they'll be able to get to it again from the
inline completion button:
https://github.com/user-attachments/assets/cf842778-5538-4e06-9ed8-21579981cc47
This also stops zeta sending requests that will fail immediately when
ToS are not accepted.
Release Notes:
- N/A
---------
Co-authored-by: Richard <richard@zed.dev>
Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
Co-authored-by: Joao <joao@zed.dev>