ZIm/crates/project/src
João Marcos b15ee1b1cc
Add dedicated actions for LSP completions insertion mode (#28121)
Adds actions so you can have customized keybindings for `insert` and
`replace` modes.

And add `shift-enter` as a default for `replace`, this will override the
default setting
`completions.lsp_insert_mode` which is set to `replace_suffix`, which
tries to "smartly"
decide whether to replace or insert based on the surrounding text.

For those who come from VSCode, if you want to mimic their behavior, you
only have to
set `completions.lsp_insert_mode` to `insert`.

If you want `tab` and `enter` to do different things, you need to remap
them, here is
an example:

```jsonc
[
  // ...
  {
    "context": "Editor && showing_completions",
    "bindings": {
      "enter": "editor::ConfirmCompletionInsert",
      "tab": "editor::ConfirmCompletionReplace"
    }
  },
]
```

Closes #24577

- [x] Make LSP completion insertion mode decision in guest's machine
(host is currently deciding it and not allowing guests to have their own
setting for it)
- [x] Add shift-enter as a hotkey for `replace` by default.
- [x] Test actions.
- [x] Respect the setting being specified per language, instead of using
the "defaults".
- [x] Move `insert_range` of `Completion` to the Lsp variant of
`.source`.
- [x] Fix broken default, forgotten after
https://github.com/zed-industries/zed/pull/27453#pullrequestreview-2736906628,
should be `replace_suffix` and not `insert`.

Release Notes:

- LSP completions: added actions `ConfirmCompletionInsert` and
`ConfirmCompletionReplace` that control how completions are inserted,
these override `completions.lsp_insert_mode`, by default, `shift-enter`
triggers `ConfirmCompletionReplace` which replaces the whole word.
2025-04-08 22:03:03 +00:00
..
debugger chore: Replace as_any functions with trait upcasting (#28221) 2025-04-08 22:16:27 +02:00
git_store Finish removing git repository state and scanning logic from worktrees (#27568) 2025-04-01 17:41:20 -04:00
lsp_command Remove language::markdown (#25136) 2025-02-19 08:55:36 -07:00
lsp_store Support tasks from rust-analyzer (#28359) 2025-04-08 15:07:56 -06:00
manifest_tree chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
buffer_store.rs Finish removing git repository state and scanning logic from worktrees (#27568) 2025-04-01 17:41:20 -04:00
color_extractor.rs Simplify static expression to a constant (#23193) 2025-01-15 19:31:21 +00:00
connection_manager.rs Finish removing git repository state and scanning logic from worktrees (#27568) 2025-04-01 17:41:20 -04:00
debounced_delay.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
debugger.rs Set up Rust debugger code runner tasks (#27571) 2025-03-29 02:10:40 -04:00
direnv.rs Environment loading fixes (#19144) 2024-10-16 12:14:40 +02:00
environment.rs Log error and proceed when failing to load repo environment (#27938) 2025-04-02 13:15:35 -04:00
git_store.rs Git activity indicator (#28204) 2025-04-07 18:10:01 +00:00
image_store.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
lsp_command.rs Add dedicated actions for LSP completions insertion mode (#28121) 2025-04-08 22:03:03 +00:00
lsp_store.rs Add dedicated actions for LSP completions insertion mode (#28121) 2025-04-08 22:03:03 +00:00
manifest_tree.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
prettier_store.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
project.rs Add dedicated actions for LSP completions insertion mode (#28121) 2025-04-08 22:03:03 +00:00
project_settings.rs Support tasks from rust-analyzer (#28359) 2025-04-08 15:07:56 -06:00
project_tests.rs Add dedicated actions for LSP completions insertion mode (#28121) 2025-04-08 22:03:03 +00:00
search.rs Use new multibuffer excerpts in project search (#27893) 2025-04-02 22:57:40 +00:00
search_history.rs project search: Persist search history across session (#9932) 2024-04-02 11:13:18 +02:00
task_inventory.rs Support tasks from rust-analyzer (#28359) 2025-04-08 15:07:56 -06:00
task_store.rs Finish removing git repository state and scanning logic from worktrees (#27568) 2025-04-01 17:41:20 -04:00
terminals.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
toolchain_store.rs Finish removing git repository state and scanning logic from worktrees (#27568) 2025-04-01 17:41:20 -04:00
worktree_store.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
yarn.rs Move "async move" a few characters to the left in cx.spawn() (#26758) 2025-03-19 02:09:02 +00:00