Improve vim interactions with edit predictions (#24418)
* When an edit prediction is present in non-insertion modes, hide it but show `tab Jump to edit`. * Removes discarding of edit predictions when going from insert mode to normal mode, instead just hide them in non-insertion modes. * Removes zeta-specific showing of predictions in normal mode. This behavior was only happening in special cases anyway - where the discard of completions wasn't happening due to some other thing taking precedence in `dismiss_menus_and_popups`. Release Notes: - N/A --------- Co-authored-by: Conrad <conrad@zed.dev> Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
parent
92c21a2814
commit
f700268029
8 changed files with 102 additions and 88 deletions
|
@ -61,10 +61,6 @@ impl InlineCompletionProvider for CopilotCompletionProvider {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn show_completions_in_normal_mode() -> bool {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
|
|
||||||
fn is_refreshing(&self) -> bool {
|
fn is_refreshing(&self) -> bool {
|
||||||
self.pending_refresh.is_some()
|
self.pending_refresh.is_some()
|
||||||
}
|
}
|
||||||
|
|
|
@ -679,9 +679,7 @@ pub struct Editor {
|
||||||
active_inline_completion: Option<InlineCompletionState>,
|
active_inline_completion: Option<InlineCompletionState>,
|
||||||
/// Used to prevent flickering as the user types while the menu is open
|
/// Used to prevent flickering as the user types while the menu is open
|
||||||
stale_inline_completion_in_menu: Option<InlineCompletionState>,
|
stale_inline_completion_in_menu: Option<InlineCompletionState>,
|
||||||
// enable_inline_completions is a switch that Vim can use to disable
|
inline_completions_hidden_for_vim_mode: bool,
|
||||||
// edit predictions based on its mode.
|
|
||||||
show_inline_completions: bool,
|
|
||||||
show_inline_completions_override: Option<bool>,
|
show_inline_completions_override: Option<bool>,
|
||||||
menu_inline_completions_policy: MenuInlineCompletionsPolicy,
|
menu_inline_completions_policy: MenuInlineCompletionsPolicy,
|
||||||
previewing_inline_completion: bool,
|
previewing_inline_completion: bool,
|
||||||
|
@ -1390,8 +1388,8 @@ impl Editor {
|
||||||
hovered_cursors: Default::default(),
|
hovered_cursors: Default::default(),
|
||||||
next_editor_action_id: EditorActionId::default(),
|
next_editor_action_id: EditorActionId::default(),
|
||||||
editor_actions: Rc::default(),
|
editor_actions: Rc::default(),
|
||||||
|
inline_completions_hidden_for_vim_mode: false,
|
||||||
show_inline_completions_override: None,
|
show_inline_completions_override: None,
|
||||||
show_inline_completions: true,
|
|
||||||
menu_inline_completions_policy: MenuInlineCompletionsPolicy::ByProvider,
|
menu_inline_completions_policy: MenuInlineCompletionsPolicy::ByProvider,
|
||||||
custom_context_menu: None,
|
custom_context_menu: None,
|
||||||
show_git_blame_gutter: false,
|
show_git_blame_gutter: false,
|
||||||
|
@ -1829,11 +1827,19 @@ impl Editor {
|
||||||
self.input_enabled = input_enabled;
|
self.input_enabled = input_enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_show_inline_completions_enabled(&mut self, enabled: bool, cx: &mut Context<Self>) {
|
pub fn set_inline_completions_hidden_for_vim_mode(
|
||||||
self.show_inline_completions = enabled;
|
&mut self,
|
||||||
if !self.show_inline_completions {
|
hidden: bool,
|
||||||
self.take_active_inline_completion(cx);
|
window: &mut Window,
|
||||||
cx.notify();
|
cx: &mut Context<Self>,
|
||||||
|
) {
|
||||||
|
if hidden != self.inline_completions_hidden_for_vim_mode {
|
||||||
|
self.inline_completions_hidden_for_vim_mode = hidden;
|
||||||
|
if hidden {
|
||||||
|
self.update_visible_inline_completion(window, cx);
|
||||||
|
} else {
|
||||||
|
self.refresh_inline_completion(true, false, window, cx);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1902,6 +1908,15 @@ impl Editor {
|
||||||
self.refresh_inline_completion(false, true, window, cx);
|
self.refresh_inline_completion(false, true, window, cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn inline_completion_start_anchor(&self) -> Option<Anchor> {
|
||||||
|
let active_completion = self.active_inline_completion.as_ref()?;
|
||||||
|
let result = match &active_completion.completion {
|
||||||
|
InlineCompletion::Edit { edits, .. } => edits.first()?.0.start,
|
||||||
|
InlineCompletion::Move { target, .. } => *target,
|
||||||
|
};
|
||||||
|
Some(result)
|
||||||
|
}
|
||||||
|
|
||||||
fn inline_completions_disabled_in_scope(
|
fn inline_completions_disabled_in_scope(
|
||||||
&self,
|
&self,
|
||||||
buffer: &Entity<Buffer>,
|
buffer: &Entity<Buffer>,
|
||||||
|
@ -2566,7 +2581,7 @@ impl Editor {
|
||||||
|
|
||||||
pub fn dismiss_menus_and_popups(
|
pub fn dismiss_menus_and_popups(
|
||||||
&mut self,
|
&mut self,
|
||||||
should_report_inline_completion_event: bool,
|
is_user_requested: bool,
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
|
@ -2590,7 +2605,7 @@ impl Editor {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.discard_inline_completion(should_report_inline_completion_event, cx) {
|
if is_user_requested && self.discard_inline_completion(true, cx) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4634,12 +4649,7 @@ impl Editor {
|
||||||
}
|
}
|
||||||
|
|
||||||
if !user_requested
|
if !user_requested
|
||||||
&& (!self.show_inline_completions
|
&& (!self.should_show_inline_completions_in_buffer(&buffer, cursor_buffer_position, cx)
|
||||||
|| !self.should_show_inline_completions_in_buffer(
|
|
||||||
&buffer,
|
|
||||||
cursor_buffer_position,
|
|
||||||
cx,
|
|
||||||
)
|
|
||||||
|| !self.is_focused(window)
|
|| !self.is_focused(window)
|
||||||
|| buffer.read(cx).is_empty())
|
|| buffer.read(cx).is_empty())
|
||||||
{
|
{
|
||||||
|
@ -4752,7 +4762,7 @@ impl Editor {
|
||||||
let cursor = self.selections.newest_anchor().head();
|
let cursor = self.selections.newest_anchor().head();
|
||||||
let (buffer, cursor_buffer_position) =
|
let (buffer, cursor_buffer_position) =
|
||||||
self.buffer.read(cx).text_anchor_for_position(cursor, cx)?;
|
self.buffer.read(cx).text_anchor_for_position(cursor, cx)?;
|
||||||
if !self.show_inline_completions
|
if self.inline_completions_hidden_for_vim_mode
|
||||||
|| !self.should_show_inline_completions_in_buffer(&buffer, cursor_buffer_position, cx)
|
|| !self.should_show_inline_completions_in_buffer(&buffer, cursor_buffer_position, cx)
|
||||||
{
|
{
|
||||||
return None;
|
return None;
|
||||||
|
@ -4873,6 +4883,7 @@ impl Editor {
|
||||||
match &active_inline_completion.completion {
|
match &active_inline_completion.completion {
|
||||||
InlineCompletion::Move { target, .. } => {
|
InlineCompletion::Move { target, .. } => {
|
||||||
let target = *target;
|
let target = *target;
|
||||||
|
// Note that this is also done in vim's handler of the Tab action.
|
||||||
self.change_selections(Some(Autoscroll::newest()), window, cx, |selections| {
|
self.change_selections(Some(Autoscroll::newest()), window, cx, |selections| {
|
||||||
selections.select_anchor_ranges([target..target]);
|
selections.select_anchor_ranges([target..target]);
|
||||||
});
|
});
|
||||||
|
@ -5083,7 +5094,6 @@ impl Editor {
|
||||||
|| (!self.completion_tasks.is_empty() && !self.has_active_inline_completion()));
|
|| (!self.completion_tasks.is_empty() && !self.has_active_inline_completion()));
|
||||||
if completions_menu_has_precedence
|
if completions_menu_has_precedence
|
||||||
|| !offset_selection.is_empty()
|
|| !offset_selection.is_empty()
|
||||||
|| !self.show_inline_completions
|
|
||||||
|| self
|
|| self
|
||||||
.active_inline_completion
|
.active_inline_completion
|
||||||
.as_ref()
|
.as_ref()
|
||||||
|
@ -5138,8 +5148,11 @@ impl Editor {
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
let completion = if let Some(move_invalidation_row_range) = move_invalidation_row_range {
|
let is_move =
|
||||||
invalidation_row_range = move_invalidation_row_range;
|
move_invalidation_row_range.is_some() || self.inline_completions_hidden_for_vim_mode;
|
||||||
|
let completion = if is_move {
|
||||||
|
invalidation_row_range =
|
||||||
|
move_invalidation_row_range.unwrap_or(edit_start_row..edit_end_row);
|
||||||
let target = first_edit_start;
|
let target = first_edit_start;
|
||||||
let target_point = text::ToPoint::to_point(&target.text_anchor, &snapshot);
|
let target_point = text::ToPoint::to_point(&target.text_anchor, &snapshot);
|
||||||
// TODO: Base this off of TreeSitter or word boundaries?
|
// TODO: Base this off of TreeSitter or word boundaries?
|
||||||
|
@ -5158,7 +5171,10 @@ impl Editor {
|
||||||
snapshot,
|
snapshot,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if !self.inline_completion_visible_in_cursor_popover(true, cx) {
|
let show_completions_in_buffer = !self
|
||||||
|
.inline_completion_visible_in_cursor_popover(true, cx)
|
||||||
|
&& !self.inline_completions_hidden_for_vim_mode;
|
||||||
|
if show_completions_in_buffer {
|
||||||
if edits
|
if edits
|
||||||
.iter()
|
.iter()
|
||||||
.all(|(range, _)| range.to_offset(&multibuffer).is_empty())
|
.all(|(range, _)| range.to_offset(&multibuffer).is_empty())
|
||||||
|
|
|
@ -3636,7 +3636,7 @@ impl EditorElement {
|
||||||
self.editor.focus_handle(cx),
|
self.editor.focus_handle(cx),
|
||||||
window,
|
window,
|
||||||
cx,
|
cx,
|
||||||
);
|
)?;
|
||||||
let size = element.layout_as_root(AvailableSpace::min_size(), window, cx);
|
let size = element.layout_as_root(AvailableSpace::min_size(), window, cx);
|
||||||
let offset = point((text_bounds.size.width - size.width) / 2., PADDING_Y);
|
let offset = point((text_bounds.size.width - size.width) / 2., PADDING_Y);
|
||||||
element.prepaint_at(text_bounds.origin + offset, window, cx);
|
element.prepaint_at(text_bounds.origin + offset, window, cx);
|
||||||
|
@ -3649,7 +3649,7 @@ impl EditorElement {
|
||||||
self.editor.focus_handle(cx),
|
self.editor.focus_handle(cx),
|
||||||
window,
|
window,
|
||||||
cx,
|
cx,
|
||||||
);
|
)?;
|
||||||
let size = element.layout_as_root(AvailableSpace::min_size(), window, cx);
|
let size = element.layout_as_root(AvailableSpace::min_size(), window, cx);
|
||||||
let offset = point(
|
let offset = point(
|
||||||
(text_bounds.size.width - size.width) / 2.,
|
(text_bounds.size.width - size.width) / 2.,
|
||||||
|
@ -3665,7 +3665,7 @@ impl EditorElement {
|
||||||
self.editor.focus_handle(cx),
|
self.editor.focus_handle(cx),
|
||||||
window,
|
window,
|
||||||
cx,
|
cx,
|
||||||
);
|
)?;
|
||||||
|
|
||||||
let target_line_end = DisplayPoint::new(
|
let target_line_end = DisplayPoint::new(
|
||||||
target_display_point.row(),
|
target_display_point.row(),
|
||||||
|
@ -3740,7 +3740,7 @@ impl EditorElement {
|
||||||
self.editor.focus_handle(cx),
|
self.editor.focus_handle(cx),
|
||||||
window,
|
window,
|
||||||
cx,
|
cx,
|
||||||
);
|
)?;
|
||||||
|
|
||||||
element.prepaint_as_root(
|
element.prepaint_as_root(
|
||||||
text_bounds.origin + origin + point(PADDING_X, px(0.)),
|
text_bounds.origin + origin + point(PADDING_X, px(0.)),
|
||||||
|
@ -5742,24 +5742,32 @@ fn inline_completion_accept_indicator(
|
||||||
focus_handle: FocusHandle,
|
focus_handle: FocusHandle,
|
||||||
window: &Window,
|
window: &Window,
|
||||||
cx: &App,
|
cx: &App,
|
||||||
) -> AnyElement {
|
) -> Option<AnyElement> {
|
||||||
let use_hardcoded_linux_preview_binding;
|
let use_hardcoded_linux_bindings;
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
{
|
{
|
||||||
use_hardcoded_linux_preview_binding = false;
|
use_hardcoded_linux_bindings = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_os = "macos"))]
|
#[cfg(not(target_os = "macos"))]
|
||||||
{
|
{
|
||||||
use_hardcoded_linux_preview_binding = previewing;
|
use_hardcoded_linux_bindings = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
let accept_keystroke = if use_hardcoded_linux_preview_binding {
|
let accept_keystroke = if use_hardcoded_linux_bindings {
|
||||||
Keystroke {
|
if previewing {
|
||||||
modifiers: Default::default(),
|
Keystroke {
|
||||||
key: "enter".to_string(),
|
modifiers: Default::default(),
|
||||||
key_char: None,
|
key: "enter".to_string(),
|
||||||
|
key_char: None,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Keystroke {
|
||||||
|
modifiers: Default::default(),
|
||||||
|
key: "tab".to_string(),
|
||||||
|
key_char: None,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let bindings = window.bindings_for_action_in(&crate::AcceptInlineCompletion, &focus_handle);
|
let bindings = window.bindings_for_action_in(&crate::AcceptInlineCompletion, &focus_handle);
|
||||||
|
@ -5767,10 +5775,10 @@ fn inline_completion_accept_indicator(
|
||||||
.last()
|
.last()
|
||||||
.and_then(|binding| binding.keystrokes().first())
|
.and_then(|binding| binding.keystrokes().first())
|
||||||
{
|
{
|
||||||
// TODO: clone unnecessary once `use_hardcoded_linux_preview_binding` is removed.
|
// TODO: clone unnecessary once `use_hardcoded_linux_bindings` is removed.
|
||||||
keystroke.clone()
|
keystroke.clone()
|
||||||
} else {
|
} else {
|
||||||
return div().into_any();
|
return None;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -5793,26 +5801,28 @@ fn inline_completion_accept_indicator(
|
||||||
|
|
||||||
let padding_right = if icon.is_some() { px(4.) } else { px(8.) };
|
let padding_right = if icon.is_some() { px(4.) } else { px(8.) };
|
||||||
|
|
||||||
h_flex()
|
Some(
|
||||||
.py_0p5()
|
h_flex()
|
||||||
.pl_1()
|
.py_0p5()
|
||||||
.pr(padding_right)
|
.pl_1()
|
||||||
.gap_1()
|
.pr(padding_right)
|
||||||
.bg(cx.theme().colors().text_accent.opacity(0.15))
|
.gap_1()
|
||||||
.border_1()
|
.bg(cx.theme().colors().text_accent.opacity(0.15))
|
||||||
.border_color(cx.theme().colors().text_accent.opacity(0.8))
|
.border_1()
|
||||||
.rounded_md()
|
.border_color(cx.theme().colors().text_accent.opacity(0.8))
|
||||||
.shadow_sm()
|
.rounded_md()
|
||||||
.child(accept_key)
|
.shadow_sm()
|
||||||
.child(Label::new(label).size(LabelSize::Small))
|
.child(accept_key)
|
||||||
.when_some(icon, |element, icon| {
|
.child(Label::new(label).size(LabelSize::Small))
|
||||||
element.child(
|
.when_some(icon, |element, icon| {
|
||||||
div()
|
element.child(
|
||||||
.mt(px(1.5))
|
div()
|
||||||
.child(Icon::new(icon).size(IconSize::Small)),
|
.mt(px(1.5))
|
||||||
)
|
.child(Icon::new(icon).size(IconSize::Small)),
|
||||||
})
|
)
|
||||||
.into_any()
|
})
|
||||||
|
.into_any(),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
|
|
|
@ -376,10 +376,6 @@ impl InlineCompletionProvider for FakeInlineCompletionProvider {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn show_completions_in_normal_mode() -> bool {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
|
|
||||||
fn is_enabled(
|
fn is_enabled(
|
||||||
&self,
|
&self,
|
||||||
_buffer: &gpui::Entity<language::Buffer>,
|
_buffer: &gpui::Entity<language::Buffer>,
|
||||||
|
|
|
@ -42,7 +42,6 @@ pub trait InlineCompletionProvider: 'static + Sized {
|
||||||
fn name() -> &'static str;
|
fn name() -> &'static str;
|
||||||
fn display_name() -> &'static str;
|
fn display_name() -> &'static str;
|
||||||
fn show_completions_in_menu() -> bool;
|
fn show_completions_in_menu() -> bool;
|
||||||
fn show_completions_in_normal_mode() -> bool;
|
|
||||||
fn show_tab_accept_marker() -> bool {
|
fn show_tab_accept_marker() -> bool {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
@ -95,7 +94,6 @@ pub trait InlineCompletionProviderHandle {
|
||||||
cx: &App,
|
cx: &App,
|
||||||
) -> bool;
|
) -> bool;
|
||||||
fn show_completions_in_menu(&self) -> bool;
|
fn show_completions_in_menu(&self) -> bool;
|
||||||
fn show_completions_in_normal_mode(&self) -> bool;
|
|
||||||
fn show_tab_accept_marker(&self) -> bool;
|
fn show_tab_accept_marker(&self) -> bool;
|
||||||
fn data_collection_state(&self, cx: &App) -> DataCollectionState;
|
fn data_collection_state(&self, cx: &App) -> DataCollectionState;
|
||||||
fn toggle_data_collection(&self, cx: &mut App);
|
fn toggle_data_collection(&self, cx: &mut App);
|
||||||
|
@ -142,10 +140,6 @@ where
|
||||||
T::show_completions_in_menu()
|
T::show_completions_in_menu()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn show_completions_in_normal_mode(&self) -> bool {
|
|
||||||
T::show_completions_in_normal_mode()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn show_tab_accept_marker(&self) -> bool {
|
fn show_tab_accept_marker(&self) -> bool {
|
||||||
T::show_tab_accept_marker()
|
T::show_tab_accept_marker()
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,10 +110,6 @@ impl InlineCompletionProvider for SupermavenCompletionProvider {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn show_completions_in_normal_mode() -> bool {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
|
|
||||||
fn is_enabled(&self, _buffer: &Entity<Buffer>, _cursor_position: Anchor, cx: &App) -> bool {
|
fn is_enabled(&self, _buffer: &Entity<Buffer>, _cursor_position: Anchor, cx: &App) -> bool {
|
||||||
self.supermaven.read(cx).is_enabled()
|
self.supermaven.read(cx).is_enabled()
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ use anyhow::Result;
|
||||||
use collections::HashMap;
|
use collections::HashMap;
|
||||||
use editor::{
|
use editor::{
|
||||||
movement::{self, FindRange},
|
movement::{self, FindRange},
|
||||||
|
scroll::Autoscroll,
|
||||||
Anchor, Bias, Editor, EditorEvent, EditorMode, ToPoint,
|
Anchor, Bias, Editor, EditorEvent, EditorMode, ToPoint,
|
||||||
};
|
};
|
||||||
use gpui::{
|
use gpui::{
|
||||||
|
@ -344,7 +345,19 @@ impl Vim {
|
||||||
vim.push_count_digit(n.0, window, cx);
|
vim.push_count_digit(n.0, window, cx);
|
||||||
});
|
});
|
||||||
Vim::action(editor, cx, |vim, _: &Tab, window, cx| {
|
Vim::action(editor, cx, |vim, _: &Tab, window, cx| {
|
||||||
vim.input_ignored(" ".into(), window, cx)
|
let Some(anchor) = vim
|
||||||
|
.editor()
|
||||||
|
.and_then(|editor| editor.read(cx).inline_completion_start_anchor())
|
||||||
|
else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
vim.update_editor(window, cx, |_, editor, window, cx| {
|
||||||
|
editor.change_selections(Some(Autoscroll::fit()), window, cx, |s| {
|
||||||
|
s.select_anchor_ranges([anchor..anchor])
|
||||||
|
});
|
||||||
|
});
|
||||||
|
vim.switch_mode(Mode::Insert, true, window, cx);
|
||||||
});
|
});
|
||||||
Vim::action(editor, cx, |vim, _: &Enter, window, cx| {
|
Vim::action(editor, cx, |vim, _: &Enter, window, cx| {
|
||||||
vim.input_ignored("\n".into(), window, cx)
|
vim.input_ignored("\n".into(), window, cx)
|
||||||
|
@ -1274,7 +1287,7 @@ impl Vim {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn sync_vim_settings(&mut self, window: &mut Window, cx: &mut Context<Self>) {
|
fn sync_vim_settings(&mut self, window: &mut Window, cx: &mut Context<Self>) {
|
||||||
self.update_editor(window, cx, |vim, editor, _, cx| {
|
self.update_editor(window, cx, |vim, editor, window, cx| {
|
||||||
editor.set_cursor_shape(vim.cursor_shape(), cx);
|
editor.set_cursor_shape(vim.cursor_shape(), cx);
|
||||||
editor.set_clip_at_line_ends(vim.clip_at_line_ends(), cx);
|
editor.set_clip_at_line_ends(vim.clip_at_line_ends(), cx);
|
||||||
editor.set_collapse_matches(true);
|
editor.set_collapse_matches(true);
|
||||||
|
@ -1282,14 +1295,11 @@ impl Vim {
|
||||||
editor.set_autoindent(vim.should_autoindent());
|
editor.set_autoindent(vim.should_autoindent());
|
||||||
editor.selections.line_mode = matches!(vim.mode, Mode::VisualLine);
|
editor.selections.line_mode = matches!(vim.mode, Mode::VisualLine);
|
||||||
|
|
||||||
let enable_inline_completions = match vim.mode {
|
let hide_inline_completions = match vim.mode {
|
||||||
Mode::Insert | Mode::Replace => true,
|
Mode::Insert | Mode::Replace => false,
|
||||||
Mode::Normal => editor
|
_ => true,
|
||||||
.inline_completion_provider()
|
|
||||||
.map_or(false, |provider| provider.show_completions_in_normal_mode()),
|
|
||||||
_ => false,
|
|
||||||
};
|
};
|
||||||
editor.set_show_inline_completions_enabled(enable_inline_completions, cx);
|
editor.set_inline_completions_hidden_for_vim_mode(hide_inline_completions, window, cx);
|
||||||
});
|
});
|
||||||
cx.notify()
|
cx.notify()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1513,10 +1513,6 @@ impl inline_completion::InlineCompletionProvider for ZetaInlineCompletionProvide
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn show_completions_in_normal_mode() -> bool {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
|
|
||||||
fn show_tab_accept_marker() -> bool {
|
fn show_tab_accept_marker() -> bool {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue