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


  • CompletionItem



Optional detail

detail: string

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

Optional documentation

documentation: string

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

Optional filterText

filterText: string

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

Optional insertText

insertText: string | SnippetString

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


kind: CompletionItemKind.Text | CompletionItemKind.Method | CompletionItemKind.Function | CompletionItemKind.Constructor | CompletionItemKind.Field | CompletionItemKind.Variable | CompletionItemKind.Class | CompletionItemKind.Interface | CompletionItemKind.Module | CompletionItemKind.Property | CompletionItemKind.Unit | CompletionItemKind.Value | CompletionItemKind.Enum | CompletionItemKind.Keyword | CompletionItemKind.Snippet | CompletionItemKind.Color | CompletionItemKind.File | CompletionItemKind.Reference | CompletionItemKind.Folder

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


label: string

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

Optional range

range: Range

A range of text that should be replaced by this completion item.

Defaults to a range from the start of the current word to the current position.

Note: The range must be a single line and it must contain the position at which completion has been requested.

Optional sortText

sortText: string

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

Optional textEdit


Deprecated in favor of CompletionItem.insertText and CompletionItem.range.

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

The range of the edit must be single-line and on the same line completions were requested at.