lineeditor/completion/
mod.rs

1use crate::styled_buffer::StyledBuffer;
2
3/// A span of source code, with positions
4pub struct Span {
5    pub start: usize,
6    pub end: usize,
7}
8
9impl Span {
10    pub fn new(start: usize, end: usize) -> Self {
11        Span { start, end }
12    }
13}
14
15/// Suggestion returned by the Completer
16pub struct Suggestion {
17    /// Suggestion content and styles
18    pub content: StyledBuffer,
19    /// Replacement span
20    pub span: Span,
21}
22
23/// The Completer trait, Implementers of this trait will return a list of suggestions as styled buffers
24pub trait Completer {
25    /// The action that will return a list of suggestions
26    fn complete(&self, input: &StyledBuffer) -> Vec<Suggestion>;
27}