pub struct AutocompleteEngine { /* private fields */ }Implementations§
Source§impl AutocompleteEngine
impl AutocompleteEngine
Sourcepub fn update(&mut self, text_before_cursor: &str)
pub fn update(&mut self, text_before_cursor: &str)
Update completions based on the text before the cursor.
Call this on every keystroke (or after a small debounce).
Sourcepub fn accept(&mut self) -> Option<(String, usize)>
pub fn accept(&mut self) -> Option<(String, usize)>
Accept the currently selected completion.
Returns the text to insert and the number of characters to delete before the cursor (the trigger + partial word).
Sourcepub fn select_prev(&mut self)
pub fn select_prev(&mut self)
Move selection up.
Sourcepub fn select_next(&mut self)
pub fn select_next(&mut self)
Move selection down.
Sourcepub fn is_visible(&self) -> bool
pub fn is_visible(&self) -> bool
Whether the popup is currently visible.
Sourcepub fn items(&self) -> &[CompletionItem]
pub fn items(&self) -> &[CompletionItem]
Currently visible completion items.
Sourcepub fn selected_index(&self) -> usize
pub fn selected_index(&self) -> usize
Index of the selected item.
Sourcepub fn render_popup(&self) -> Vec<(String, String, bool)>
pub fn render_popup(&self) -> Vec<(String, String, bool)>
Render the popup as a list of formatted display lines.
Each line is (label, description, is_selected).
Sourcepub fn record_frecency(&mut self, text: &str)
pub fn record_frecency(&mut self, text: &str)
Register a frecency access for the given text.
Sourcepub fn add_commands(&mut self, commands: &[SlashCommand])
pub fn add_commands(&mut self, commands: &[SlashCommand])
Add custom slash commands (extends the built-in set).
Sourcepub fn set_working_dir(&mut self, dir: PathBuf)
pub fn set_working_dir(&mut self, dir: PathBuf)
Update the working directory for file completion.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for AutocompleteEngine
impl !RefUnwindSafe for AutocompleteEngine
impl Send for AutocompleteEngine
impl !Sync for AutocompleteEngine
impl Unpin for AutocompleteEngine
impl UnsafeUnpin for AutocompleteEngine
impl UnwindSafe for AutocompleteEngine
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more