CompletionItem class

A completion item represents a text snippet that is proposed to complete text that is being typed.

It is sufficient to create a completion item from just a {@link CompletionItem.labellabel}. In that case the completion item will replace the {@link TextDocument.getWordRangeAtPositionword} until the cursor with the given label or {@link CompletionItem.insertTextinsertText}. Otherwise the given {@link CompletionItem.textEditedit} is used.

When selecting a completion item in the editor its defined or synthesized text edit will be applied to all cursors/selections whereas {@link CompletionItem.additionalTextEditsadditionalTextEdits} will be applied as provided.

Available extensions
Annotations
  • @JS()
  • @staticInterop

Constructors

CompletionItem(Object label, [CompletionItemKind? kind])
factory

Properties

additionalTextEdits List<TextEdit>

Available on CompletionItem, provided by the CompletionItem$Typings extension

An optional array of additional {@link TextEdit text edits} that are applied when selecting this completion. Edits must not overlap with the main {@link CompletionItem.textEdit edit} nor with themselves.
getter/setter pair
command Command

Available on CompletionItem, provided by the CompletionItem$Typings extension

An optional {@link Command} that is executed after inserting this completion. Note that additional modifications to the current document should be described with the {@link CompletionItem.additionalTextEdits additionalTextEdits}-property.
getter/setter pair
commitCharacters List<String>

Available on CompletionItem, provided by the CompletionItem$Typings extension

An optional set of characters that when pressed while this completion is active will accept it first and then type that character. Note that all commit characters should have length=1 and that superfluous characters will be ignored.
getter/setter pair
detail String

Available on CompletionItem, provided by the CompletionItem$Typings extension

A human-readable string with additional information about this item, like type or symbol information.
getter/setter pair
documentation Object

Available on CompletionItem, provided by the CompletionItem$Typings extension

A human-readable string that represents a doc-comment.
getter/setter pair
filterText String

Available on CompletionItem, provided by the CompletionItem$Typings extension

A string that should be used when filtering a set of completion items. When falsy the {@link CompletionItem.label label} is used.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
insertText Object

Available on CompletionItem, provided by the CompletionItem$Typings extension

A string or snippet that should be inserted in a document when selecting this completion. When falsy the {@link CompletionItem.label label} is used.
getter/setter pair
keepWhitespace bool

Available on CompletionItem, provided by the CompletionItem$Typings extension

Keep whitespace of the {@link CompletionItem.insertText insertText} as is. By default, the editor adjusts leading whitespace of new lines so that they match the indentation of the line for which the item is accepted - setting this to true will prevent that.
getter/setter pair
kind CompletionItemKind

Available on CompletionItem, provided by the CompletionItem$Typings extension

The kind of this completion item. Based on the kind an icon is chosen by the editor.
getter/setter pair
label Object

Available on CompletionItem, provided by the CompletionItem$Typings extension

The label of this completion item. By default this is also the text that is inserted when selecting this completion.
getter/setter pair
preselect bool

Available on CompletionItem, provided by the CompletionItem$Typings extension

Select this item when showing. Note that only one completion item can be selected and that the editor decides which item that is. The rule is that the first item of those that match best is selected.
getter/setter pair
range Object

Available on CompletionItem, provided by the CompletionItem$Typings extension

A range or a insert and replace range selecting the text that should be replaced by this completion item.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sortText String

Available on CompletionItem, provided by the CompletionItem$Typings extension

A string that should be used when comparing this item with other items. When falsy the {@link CompletionItem.label label} is used.
getter/setter pair
tags List<CompletionItemTag>

Available on CompletionItem, provided by the CompletionItem$Typings extension

Tags for this completion item.
getter/setter pair
textEdit TextEdit

Available on CompletionItem, provided by the CompletionItem$Typings extension

@deprecated Use CompletionItem.insertText and CompletionItem.range instead.
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited