ParseTreeMatch

A ParseTreeMatch object describes a match found during evaluation of a Tree-sitter query.

Such objects are currently only provided as part of the Completions API when evaluating a language’s highlights query before completion items are requested from providers.

Added in Nova 12.

Properties

captures

An object mapping strings to ParseTreeCapture objects, describing the parse tree nodes captured during evaluation of the match. The keys of the object are the capture names assigned using the Tree-sitter @foobar syntax (excluding the @ symbol itself; for a query capture named @foobar, the metadata key will be foobar).

This property is readonly.

metadata

An object mapping strings to strings, describing any metadata collected as part of query evaluation using the #set...! family of directives. When metadata is set on a match using a variable name, it will be reflected in this object using that variable name as the key. If no value is specified when setting the value in the query, the value will be an empty string.

This property is readonly.