pub struct CompletionItem {
pub insert_text: String,
pub label: String,
pub detail: Option<String>,
pub documentation: Option<String>,
pub source: &'static str,
pub kind: CompletionKind,
pub sort_priority: u32,
pub filter_text: Option<String>,
pub score: u32,
pub match_indices: Vec<u32>,
}Expand description
A completion item returned by a completion provider
Fields§
§insert_text: StringText to insert when this item is selected
label: StringDisplay label shown in the completion menu
detail: Option<String>Optional detail text (e.g., type info, signature)
documentation: Option<String>Optional documentation for preview
source: &'static strSource identifier (e.g., “buffer”, “lsp”, “path”)
kind: CompletionKindKind of completion for icon/styling
sort_priority: u32Sort priority (lower = higher priority)
filter_text: Option<String>Custom filter text (defaults to label if None)
score: u32Score from fuzzy matching (set by completion engine)
match_indices: Vec<u32>Indices of matched characters in filter_text (for highlighting)
Implementations§
Source§impl CompletionItem
impl CompletionItem
Sourcepub fn new(
insert_text: impl Into<String>,
source: &'static str,
) -> CompletionItem
pub fn new( insert_text: impl Into<String>, source: &'static str, ) -> CompletionItem
Create a new completion item with minimal data
Sourcepub fn with_label(self, label: impl Into<String>) -> CompletionItem
pub fn with_label(self, label: impl Into<String>) -> CompletionItem
Set custom label
Sourcepub fn with_detail(self, detail: impl Into<String>) -> CompletionItem
pub fn with_detail(self, detail: impl Into<String>) -> CompletionItem
Set detail text
Sourcepub fn with_documentation(self, doc: impl Into<String>) -> CompletionItem
pub fn with_documentation(self, doc: impl Into<String>) -> CompletionItem
Set documentation
Sourcepub const fn with_kind(self, kind: CompletionKind) -> CompletionItem
pub const fn with_kind(self, kind: CompletionKind) -> CompletionItem
Set completion kind
Sourcepub const fn with_priority(self, priority: u32) -> CompletionItem
pub const fn with_priority(self, priority: u32) -> CompletionItem
Set sort priority
Sourcepub fn with_filter_text(self, text: impl Into<String>) -> CompletionItem
pub fn with_filter_text(self, text: impl Into<String>) -> CompletionItem
Set filter text
Sourcepub fn filter_text(&self) -> &str
pub fn filter_text(&self) -> &str
Get the text to use for filtering
Trait Implementations§
Source§impl Clone for CompletionItem
impl Clone for CompletionItem
Source§fn clone(&self) -> CompletionItem
fn clone(&self) -> CompletionItem
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 moreAuto Trait Implementations§
impl Freeze for CompletionItem
impl RefUnwindSafe for CompletionItem
impl Send for CompletionItem
impl Sync for CompletionItem
impl Unpin for CompletionItem
impl UnwindSafe for CompletionItem
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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