Migrate keymap and settings + edit predictions rename (#23834)

- [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>
This commit is contained in:
smit 2025-02-07 21:17:07 +05:30 committed by GitHub
parent a1544f47ad
commit 00c2a30059
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
58 changed files with 2106 additions and 617 deletions

View file

@ -29,7 +29,7 @@ To use GitHub Copilot (enabled by default), add the following to your `settings.
```json
{
"features": {
"inline_completion_provider": "copilot"
"edit_prediction_provider": "copilot"
}
}
```
@ -43,7 +43,7 @@ To use Supermaven, add the following to your `settings.json`:
```json
{
"features": {
"inline_completion_provider": "supermaven"
"edit_prediction_provider": "supermaven"
}
}
```
@ -56,23 +56,23 @@ Once you have configured an Edit Prediction provider, you can start using edit p
There are a number of actions/shortcuts available to interact with edit predictions:
- `editor: accept inline completion` (`tab`): To accept the current edit prediction
- `editor: accept partial inline completion` (`ctrl-cmd-right`): To accept the current edit prediction up to the next word boundary
- `editor: show inline completion` (`alt-tab`): Trigger an edit prediction request manually
- `editor: next inline completion` (`alt-tab`): To cycle to the next edit prediction
- `editor: previous inline completion` (`alt-shift-tab`): To cycle to the previous edit prediction
- `editor: accept edit prediction` (`tab`): To accept the current edit prediction
- `editor: accept partial edit prediction` (`ctrl-cmd-right`): To accept the current edit prediction up to the next word boundary
- `editor: show edit prediction` (`alt-tab`): Trigger an edit prediction request manually
- `editor: next edit prediction` (`alt-tab`): To cycle to the next edit prediction
- `editor: previous edit prediction` (`alt-shift-tab`): To cycle to the previous edit prediction
### Disabling Inline-Completions
### Disabling Edit Prediction
To disable completions that appear automatically as you type, add the following to your `settings.json`:
To disable predictions that appear automatically as you type, add the following to your `settings.json`:
```json
{
"show_inline_completions": false
"show_edit_predictions": false
}
```
You can trigger edit predictions manually by executing `editor: show inline completion` (`alt-tab`).
You can trigger edit predictions manually by executing `editor: show edit prediction` (`alt-tab`).
You can also add this as a language-specific setting in your `settings.json` to disable edit predictions for a specific language:
@ -80,7 +80,7 @@ You can also add this as a language-specific setting in your `settings.json` to
{
"language": {
"python": {
"show_inline_completions": false
"show_edit_predictions": false
}
}
}

View file

@ -378,11 +378,11 @@ There are two options to choose from:
## Edit Predictions
- Description: Settings for edit predictions.
- Setting: `inline_completions`
- Setting: `edit_predictions`
- Default:
```json
"inline_completions": {
"edit_predictions": {
"disabled_globs": [
"**/.env*",
"**/*.pem",
@ -409,7 +409,7 @@ List of `string` values
## Edit Predictions Disabled in
- Description: A list of language scopes in which edit predictions should be disabled.
- Setting: `inline_completions_disabled_in`
- Setting: `edit_predictions_disabled_in`
- Default: `[]`
**Options**
@ -434,7 +434,7 @@ List of `string` values
{
"languages": {
"Go": {
"inline_completions_disabled_in": ["comment", "string"]
"edit_predictions_disabled_in": ["comment", "string"]
}
}
}
@ -1478,7 +1478,7 @@ The following settings can be overridden for each specific language:
- [`hard_tabs`](#hard-tabs)
- [`preferred_line_length`](#preferred-line-length)
- [`remove_trailing_whitespace_on_save`](#remove-trailing-whitespace-on-save)
- [`show_inline_completions`](#show-inline-completions)
- [`show_edit_predictions`](#show-edit-predictions)
- [`show_whitespaces`](#show-whitespaces)
- [`soft_wrap`](#soft-wrap)
- [`tab_size`](#tab-size)
@ -1654,8 +1654,8 @@ Or to set a `socks5` proxy:
## Show Edit Predictions
- Description: Whether to show edit predictions as you type or manually by triggering `editor::ShowInlineCompletion`.
- Setting: `show_inline_completions`
- Description: Whether to show edit predictions as you type or manually by triggering `editor::ShowEditPrediction`.
- Setting: `show_edit_predictions`
- Default: `true`
**Options**

View file

@ -119,7 +119,7 @@ command palette, by looking in the default keymaps for
or
[Linux](https://github.com/zed-industries/zed/blob/main/assets/keymaps/default-linux.json), or by using Zed's autocomplete in your keymap file.
Most actions do not require any arguments, and so you can bind them as strings: `"ctrl-a": "language_selector::Toggle"`. Some require a single argument, and must be bound as an array: `"ctrl-a": ["workspace::ActivatePaneInDirection", "down"]`. Some actions require multiple arguments, and are bound as an array of a string and an object: `"ctrl-a": ["pane::DeploySearch", { "replace_enabled": true }]`.
Most actions do not require any arguments, and so you can bind them as strings: `"ctrl-a": "language_selector::Toggle"`. Some require a single argument, and must be bound as an array: `"cmd-1": ["workspace::ActivatePane", 0]`. Some actions require multiple arguments, and are bound as an array of a string and an object: `"ctrl-a": ["pane::DeploySearch", { "replace_enabled": true }]`.
### Precedence

View file

@ -368,10 +368,10 @@ But you cannot use the same shortcuts to move between all the editor docks (the
{
"context": "Dock",
"bindings": {
"ctrl-w h": ["workspace::ActivatePaneInDirection", "Left"],
"ctrl-w l": ["workspace::ActivatePaneInDirection", "Right"],
"ctrl-w k": ["workspace::ActivatePaneInDirection", "Up"],
"ctrl-w j": ["workspace::ActivatePaneInDirection", "Down"]
"ctrl-w h": "workspace::ActivatePaneLeft",
"ctrl-w l": "workspace::ActivatePaneRight",
"ctrl-w k": "workspace::ActivatePaneUp",
"ctrl-w j": "workspace::ActivatePaneDown"
// ... or other keybindings
}
}
@ -399,12 +399,7 @@ Vim mode comes with shortcuts to surround the selection in normal mode (`ys`), b
{
"context": "vim_mode == visual",
"bindings": {
"shift-s": [
"vim::PushOperator",
{
"AddSurrounds": {}
}
]
"shift-s": ["vim::PushAddSurrounds", {}]
}
}
```
@ -416,8 +411,8 @@ The [Sneak motion](https://github.com/justinmk/vim-sneak) feature allows for qui
{
"context": "vim_mode == normal || vim_mode == visual",
"bindings": {
"s": ["vim::PushOperator", { "Sneak": {} }],
"S": ["vim::PushOperator", { "SneakBackward": {} }]
"s": ["vim::PushSneak", {}],
"S": ["vim::PushSneakBackward", {}]
}
}
]