Introduce UI affordances to make enabling/disabling inline completions easier (#22894)

Release Notes:

- N/A

---------

Co-authored-by: Thorsten <thorsten@zed.dev>
This commit is contained in:
Antonio Scandurra
2025-01-09 13:33:30 +00:00
committed by GitHub
co-authored by Thorsten
parent 38fbc73ac4
commit 341972c79c
3 changed files with 62 additions and 15 deletions
+23
View File
@@ -94,6 +94,7 @@ impl Render for QuickActionBar {
git_blame_inline_enabled,
show_git_blame_gutter,
auto_signature_help_enabled,
inline_completions_enabled,
) = {
let editor = editor.read(cx);
let selection_menu_enabled = editor.selection_menu_enabled(cx);
@@ -102,6 +103,7 @@ impl Render for QuickActionBar {
let git_blame_inline_enabled = editor.git_blame_inline_enabled();
let show_git_blame_gutter = editor.show_git_blame_gutter();
let auto_signature_help_enabled = editor.auto_signature_help_enabled(cx);
let inline_completions_enabled = editor.inline_completions_enabled(cx);
(
selection_menu_enabled,
@@ -110,6 +112,7 @@ impl Render for QuickActionBar {
git_blame_inline_enabled,
show_git_blame_gutter,
auto_signature_help_enabled,
inline_completions_enabled,
)
};
@@ -283,6 +286,26 @@ impl Render for QuickActionBar {
},
);
menu = menu.toggleable_entry(
"Inline Completions",
inline_completions_enabled,
IconPosition::Start,
Some(editor::actions::ToggleInlineCompletions.boxed_clone()),
{
let editor = editor.clone();
move |cx| {
editor
.update(cx, |editor, cx| {
editor.toggle_inline_completions(
&editor::actions::ToggleInlineCompletions,
cx,
);
})
.ok();
}
},
);
menu = menu.separator();
menu = menu.toggleable_entry(