edit prediction: Improve UX around disabled_globs
and show_inline_completions
(#24207)
Release Notes: - N/A --------- Co-authored-by: Danilo <danilo@zed.dev> Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
This commit is contained in:
parent
37db1dcd48
commit
e1a6d9a485
13 changed files with 580 additions and 421 deletions
|
@ -16,8 +16,8 @@ use gpui::{
|
|||
use search::{buffer_search, BufferSearchBar};
|
||||
use settings::{Settings, SettingsStore};
|
||||
use ui::{
|
||||
prelude::*, ButtonStyle, ContextMenu, IconButton, IconButtonShape, IconName, IconSize,
|
||||
PopoverMenu, PopoverMenuHandle, Tooltip,
|
||||
prelude::*, ButtonStyle, ContextMenu, ContextMenuEntry, IconButton, IconButtonShape, IconName,
|
||||
IconSize, PopoverMenu, PopoverMenuHandle, Tooltip,
|
||||
};
|
||||
use vim_mode_setting::VimModeSetting;
|
||||
use workspace::{
|
||||
|
@ -94,7 +94,8 @@ impl Render for QuickActionBar {
|
|||
git_blame_inline_enabled,
|
||||
show_git_blame_gutter,
|
||||
auto_signature_help_enabled,
|
||||
inline_completions_enabled,
|
||||
show_inline_completions,
|
||||
inline_completion_enabled,
|
||||
) = {
|
||||
let editor = editor.read(cx);
|
||||
let selection_menu_enabled = editor.selection_menu_enabled(cx);
|
||||
|
@ -103,7 +104,8 @@ 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);
|
||||
let show_inline_completions = editor.should_show_inline_completions(cx);
|
||||
let inline_completion_enabled = editor.inline_completions_enabled(cx);
|
||||
|
||||
(
|
||||
selection_menu_enabled,
|
||||
|
@ -112,7 +114,8 @@ impl Render for QuickActionBar {
|
|||
git_blame_inline_enabled,
|
||||
show_git_blame_gutter,
|
||||
auto_signature_help_enabled,
|
||||
inline_completions_enabled,
|
||||
show_inline_completions,
|
||||
inline_completion_enabled,
|
||||
)
|
||||
};
|
||||
|
||||
|
@ -294,12 +297,12 @@ impl Render for QuickActionBar {
|
|||
},
|
||||
);
|
||||
|
||||
menu = menu.toggleable_entry(
|
||||
"Edit Predictions",
|
||||
inline_completions_enabled,
|
||||
IconPosition::Start,
|
||||
Some(editor::actions::ToggleInlineCompletions.boxed_clone()),
|
||||
{
|
||||
let mut inline_completion_entry = ContextMenuEntry::new("Edit Predictions")
|
||||
.toggleable(IconPosition::Start, inline_completion_enabled && show_inline_completions)
|
||||
.disabled(!inline_completion_enabled)
|
||||
.action(Some(
|
||||
editor::actions::ToggleInlineCompletions.boxed_clone(),
|
||||
)).handler({
|
||||
let editor = editor.clone();
|
||||
move |window, cx| {
|
||||
editor
|
||||
|
@ -312,8 +315,14 @@ impl Render for QuickActionBar {
|
|||
})
|
||||
.ok();
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
if !inline_completion_enabled {
|
||||
inline_completion_entry = inline_completion_entry.documentation_aside(|_| {
|
||||
Label::new("You can't toggle edit predictions for this file as it is within the excluded files list.").into_any_element()
|
||||
});
|
||||
}
|
||||
|
||||
menu = menu.item(inline_completion_entry);
|
||||
|
||||
menu = menu.separator();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue