inline completions: Add action to toggle inline completions (#16947)

This adds a new action: `editor: toggle inline completions`.

It allows users to toggle inline completions on/off for the current
buffer.

That toggling is not persistent and when the editor is closed, it's
gone.

That makes it easy to disable inline completions for a single text
buffer, for example, even if you want them on for other buffers.

When toggling on/off, the toggling also overwrites any language
settings. So if you have inline completions disabled for Go buffers,
toggling them on takes precedence over those settings.


Release Notes:

- Added a new editor action to allow toggling inline completions
(Copilot, Supermaven) on and off for the current buffer, taking
precedence over any settings.

Co-authored-by: Antonio <antonio@zed.dev>
This commit is contained in:
Thorsten Ball 2024-08-27 15:51:57 +02:00 committed by GitHub
parent 5586397f95
commit ad43bbbf5e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 56 additions and 16 deletions

View file

@ -495,7 +495,7 @@ impl PromptLibrary {
editor.set_text(prompt_metadata.title.unwrap_or_default(), cx);
if prompt_id.is_built_in() {
editor.set_read_only(true);
editor.set_show_inline_completions(false);
editor.set_show_inline_completions(Some(false), cx);
}
editor
});
@ -510,7 +510,7 @@ impl PromptLibrary {
let mut editor = Editor::for_buffer(buffer, None, cx);
if prompt_id.is_built_in() {
editor.set_read_only(true);
editor.set_show_inline_completions(false);
editor.set_show_inline_completions(Some(false), cx);
}
editor.set_soft_wrap_mode(SoftWrap::EditorWidth, cx);
editor.set_show_gutter(false, cx);