Skip to main content

AutocompleteProvider

Trait AutocompleteProvider 

Source
pub trait AutocompleteProvider {
    // Required methods
    fn trigger_characters(&self) -> &[char];
    fn get_suggestions(
        &self,
        lines: &[String],
        cursor_line: usize,
        cursor_col: usize,
        force: bool,
    ) -> Option<AutocompleteSuggestions>;
    fn apply_completion(
        &self,
        lines: &[String],
        cursor_line: usize,
        cursor_col: usize,
        item: &AutocompleteItem,
        prefix: &str,
    ) -> (Vec<String>, usize, usize);
    fn should_trigger_file_completion(
        &self,
        lines: &[String],
        cursor_line: usize,
        cursor_col: usize,
    ) -> bool;
}
Expand description

Provider that generates autocomplete suggestions.

Required Methods§

Source

fn trigger_characters(&self) -> &[char]

Characters that should naturally trigger this provider at token boundaries.

Source

fn get_suggestions( &self, lines: &[String], cursor_line: usize, cursor_col: usize, force: bool, ) -> Option<AutocompleteSuggestions>

Get suggestions for the current text/cursor position. Returns None if no suggestions available.

Source

fn apply_completion( &self, lines: &[String], cursor_line: usize, cursor_col: usize, item: &AutocompleteItem, prefix: &str, ) -> (Vec<String>, usize, usize)

Apply the selected completion item.

Source

fn should_trigger_file_completion( &self, lines: &[String], cursor_line: usize, cursor_col: usize, ) -> bool

Whether to trigger file completion on Tab.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§