CompletionContext

A CompletionContext object defines information about the request for completion items within an editor. A completion context is used when building CompletionItem objects.

Properties

text

The word immediately proceeding the cursor, or an empty string if no word exists. The cursor will be positioned directly after the last character in this string.

This property is readonly.

line

The text of the entire line preceding the cursor, not including indentation whitespace. The cursor will be positioned directly after the last character in this string.

This property is readonly.

identifierChars

A Charset object defining the set of identifier characters valid for the syntax used for the completion request. This represents the set of characters that are normally valid for automatically invoking completion requests.

This property is readonly.

Added in Nova 3.

matches

An array of ParseTreeMatch objects that reflect the Tree-sitter syntax highlighting matches in effect at the completion position.

This property is readonly.

Added in Nova 12.

position

The character position of the cursor within the requesting text editor, as a number.

This property is readonly.

reason

The reason the completion was triggered, as a value from the CompletionReason enumeration.

The values for the CompletionReason enumeration are:

This property is readonly.

selectors

An array of ScopeSelector objects that reflect the tree of syntax grammar selectors for the completion position. The array will be ordered depth, with deepest first, where the first item in the array is the syntax scope encompassing the completion position, the next item is its ancestor, onwards to the final item which represents the root of the tree.

triggerCharacter

The character that triggered the completion request as a String. If the request was not triggered by a character (such as if the reason is Invoke), this will return null or undefined.

This property is readonly.

Added in Nova 3.