edit predictions: Improve UX when there's no keybinding for accepting predictions (#25815)
If the user already binds `tab`/`alt-tab`/`alt-l` to a different action in a conflicting context and hasn't assigned a different keybinding for `editor::AcceptEditPrediction`, we would show broken popovers with no bindings:  Instead, they will now see an error-variant of every popover which includes a tooltip with a short description and buttons to open the keymap, and open a new docs section explaining the issue in detail and how to fix it.  Note: I included the docs change in this PR because it's ok to deploy before the release, as it also applies to existing versions. Release Notes: - edit predictions: Improve UX when there's no keybinding for accepting predictions --------- Co-authored-by: Danilo Leal <daniloleal09@gmail.com> Co-authored-by: Danilo <danilo@zed.dev>
This commit is contained in:
parent
76a81607de
commit
f31749c81b
5 changed files with 167 additions and 26 deletions
|
@ -32,7 +32,7 @@ On Linux, `alt-tab` is often used by the window manager for switching windows, s
|
|||
|
||||
See the [Configuring GitHub Copilot](#github-copilot) and [Configuring Supermaven](#supermaven) sections below for configuration of other providers. Only text insertions at the current cursor are supported for these providers, whereas the Zeta model provides multiple predictions including deletions.
|
||||
|
||||
## Configuring Edit Prediction Keybindings
|
||||
## Configuring Edit Prediction Keybindings {#edit-predictions-keybinding}
|
||||
|
||||
By default, `tab` is used to accept edit predictions. You can use another keybinding by inserting this in your keymap:
|
||||
|
||||
|
@ -137,6 +137,40 @@ While `tab` and `alt-tab` are supported on Linux, `alt-l` is displayed instead.
|
|||
},
|
||||
```
|
||||
|
||||
### Missing keybind {#edit-predictions-missing-keybinding}
|
||||
|
||||
Zed requires at least one keybinding for the {#action editor::AcceptEditPrediction} action in both the `Editor && edit_prediction` and `Editor && edit_prediction_conflict` contexts ([learn more above](#edit-predictions-keybinding)).
|
||||
|
||||
If you have previously bound the default keybindings to different actions in the global context, you will not be able to preview or accept edit predictions. For example:
|
||||
|
||||
```json
|
||||
[
|
||||
// Your keymap
|
||||
{
|
||||
"bindings": {
|
||||
// Binds `alt-tab` to a different action globally
|
||||
"alt-tab": "menu::SelectNext"
|
||||
}
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
To fix this, you can specify your own keybinding for accepting edit predictions:
|
||||
|
||||
```json
|
||||
[
|
||||
// ...
|
||||
{
|
||||
"context": "Editor && edit_prediction_conflict",
|
||||
"bindings": {
|
||||
"alt-l": "editor::AcceptEditPrediction"
|
||||
}
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
If you would like to use the default keybinding, you can free it up by either moving yours to a more specific context or changing it to something else.
|
||||
|
||||
## Disabling Automatic Edit Prediction
|
||||
|
||||
To disable predictions that appear automatically as you type, set this within `settings.json`:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue