pub trait Completer: Send {
// Required method
fn complete(&mut self, line: &str, pos: usize) -> Vec<Suggestion>;
// Provided methods
fn complete_with_base_ranges(
&mut self,
line: &str,
pos: usize
) -> (Vec<Suggestion>, Vec<Range<usize>>) { ... }
fn partial_complete(
&mut self,
line: &str,
pos: usize,
start: usize,
offset: usize
) -> Vec<Suggestion> { ... }
fn total_completions(&mut self, line: &str, pos: usize) -> usize { ... }
}
Expand description
A trait that defines how to convert some text and a position to a list of potential completions in that position. The text could be a part of the whole line, and the position is the index of the end of the text in the original line.
Required Methods§
Provided Methods§
sourcefn complete_with_base_ranges(
&mut self,
line: &str,
pos: usize
) -> (Vec<Suggestion>, Vec<Range<usize>>)
fn complete_with_base_ranges( &mut self, line: &str, pos: usize ) -> (Vec<Suggestion>, Vec<Range<usize>>)
same as Completer::complete
but it will return a vector of ranges of the strings
the suggestions are based on
sourcefn partial_complete(
&mut self,
line: &str,
pos: usize,
start: usize,
offset: usize
) -> Vec<Suggestion>
fn partial_complete( &mut self, line: &str, pos: usize, start: usize, offset: usize ) -> Vec<Suggestion>
action that will return a partial section of available completions this command comes handy when trying to avoid to pull all the data at once from the completer
sourcefn total_completions(&mut self, line: &str, pos: usize) -> usize
fn total_completions(&mut self, line: &str, pos: usize) -> usize
number of available completions