pub enum CompletionStyle {
List(MoveDir1D),
None,
Prefix,
Single,
}Expand description
What type of phrase we are completing.
Variants§
List(MoveDir1D)
Navigate through the list of completion candidates.
§Example: Using action!
use editor_types::prelude::*;
use editor_types::{action, Action, EditorAction};
let ct = CompletionType::Auto;
let style = CompletionStyle::List(MoveDir1D::Next);
let display = CompletionDisplay::List;
let act: Action = EditorAction::Complete(style, ct, display).into();
assert_eq!(act, action!("complete -s (list next) -T auto -D list"));None
Generate completion candidates, but don’t select any from the list.
This is most helpful for keybindings that allow the user to get a list of potential candidates that they can read through without actually picking any, in case they don’t know what the first character to type is.
§Example: Using action!
use editor_types::prelude::*;
use editor_types::{action, Action, EditorAction};
let ct = CompletionType::Auto;
let style = CompletionStyle::None;
let display = CompletionDisplay::List;
let act: Action = EditorAction::Complete(style, ct, display).into();
assert_eq!(act, action!("complete -s none -T auto -D list"));Prefix
Complete only the longest common prefix from the completion candidates.
§Example: Using action!
use editor_types::prelude::*;
use editor_types::{action, Action, EditorAction};
let ct = CompletionType::Auto;
let style = CompletionStyle::Prefix;
let display = CompletionDisplay::List;
let act: Action = EditorAction::Complete(style, ct, display).into();
assert_eq!(act, action!("complete -s prefix -T auto -D list"));Single
If there is only a single completion candidate, select it.
§Example: Using action!
use editor_types::prelude::*;
use editor_types::{action, Action, EditorAction};
let ct = CompletionType::Auto;
let style = CompletionStyle::Single;
let display = CompletionDisplay::List;
let act: Action = EditorAction::Complete(style, ct, display).into();
assert_eq!(act, action!("complete -s single -T auto -D list"));Trait Implementations§
Source§impl Clone for CompletionStyle
impl Clone for CompletionStyle
Source§fn clone(&self) -> CompletionStyle
fn clone(&self) -> CompletionStyle
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CompletionStyle
impl Debug for CompletionStyle
Source§impl PartialEq for CompletionStyle
impl PartialEq for CompletionStyle
impl Eq for CompletionStyle
impl StructuralPartialEq for CompletionStyle
Auto Trait Implementations§
impl Freeze for CompletionStyle
impl RefUnwindSafe for CompletionStyle
impl Send for CompletionStyle
impl Sync for CompletionStyle
impl Unpin for CompletionStyle
impl UnwindSafe for CompletionStyle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more