[][src]Struct lsp_types::CompletionItem

pub struct CompletionItem {
    pub label: String,
    pub kind: Option<CompletionItemKind>,
    pub detail: Option<String>,
    pub documentation: Option<Documentation>,
    pub deprecated: Option<bool>,
    pub preselect: Option<bool>,
    pub sort_text: Option<String>,
    pub filter_text: Option<String>,
    pub insert_text: Option<String>,
    pub insert_text_format: Option<InsertTextFormat>,
    pub text_edit: Option<CompletionTextEdit>,
    pub additional_text_edits: Option<Vec<TextEdit>>,
    pub command: Option<Command>,
    pub data: Option<Value>,
    pub tags: Option<Vec<CompletionItemTag>>,
}

Fields

label: String

The label of this completion item. By default also the text that is inserted when selecting this completion.

kind: Option<CompletionItemKind>

The kind of this completion item. Based of the kind an icon is chosen by the editor.

detail: Option<String>

A human-readable string with additional information about this item, like type or symbol information.

documentation: Option<Documentation>

A human-readable string that represents a doc-comment.

deprecated: Option<bool>

Indicates if this item is deprecated.

preselect: Option<bool>

Select this item when showing.

sort_text: Option<String>

A string that shoud be used when comparing this item with other items. When falsy the label is used.

filter_text: Option<String>

A string that should be used when filtering a set of completion items. When falsy the label is used.

insert_text: Option<String>

A string that should be inserted a document when selecting this completion. When falsy the label is used.

insert_text_format: Option<InsertTextFormat>

The format of the insert text. The format applies to both the insertText property and the newText property of a provided textEdit.

text_edit: Option<CompletionTextEdit>

An edit which is applied to a document when selecting this completion. When an edit is provided the value of insertText is ignored.

Most editors support two different operation when accepting a completion item. One is to insert a completion text and the other is to replace an existing text with a competion text. Since this can usually not predetermend by a server it can report both ranges. Clients need to signal support for InsertReplaceEdits via the textDocument.completion.insertReplaceSupport client capability property.

Note 1: The text edit's range as well as both ranges from a insert replace edit must be a [single line] and they must contain the position at which completion has been requested. Note 2: If an InsertReplaceEdit is returned the edit's insert range must be a prefix of the edit's replace range, that means it must be contained and starting at the same position.

@since 3.16.0 additional type InsertReplaceEdit - Proposed state

additional_text_edits: Option<Vec<TextEdit>>

An optional array of additional text edits that are applied when selecting this completion. Edits must not overlap with the main edit nor with themselves.

command: Option<Command>

An optional command that is executed after inserting this completion. Note that additional modifications to the current document should be described with the additionalTextEdits-property.

data: Option<Value>

An data entry field that is preserved on a completion item between a completion and a completion resolve request.

tags: Option<Vec<CompletionItemTag>>

Tags for this completion item.

Implementations

impl CompletionItem[src]

pub fn new_simple(label: String, detail: String) -> CompletionItem[src]

Create a CompletionItem with the minimum possible info (label and detail).

Trait Implementations

impl Clone for CompletionItem[src]

impl Debug for CompletionItem[src]

impl Default for CompletionItem[src]

impl<'de> Deserialize<'de> for CompletionItem[src]

impl PartialEq<CompletionItem> for CompletionItem[src]

impl Serialize for CompletionItem[src]

impl StructuralPartialEq for CompletionItem[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.