capturesForHighlighting method
List<TreeSitterQueryCapture>
capturesForHighlighting(
- TreeSitterNode node, {
- String? source,
- TreeSitterUtf16Range? range,
- TreeSitterQueryTextProvider? textProvider,
Returns the winning capture for each syntax node using the complete structural query semantics.
Highlighting needs the same pattern matching and last-pattern-wins rule as matches, but it does not need the intermediate match objects. This path keeps those semantics while avoiding the allocation, global sort, and de-duplication of every completed TreeSitterQueryMatch.
Implementation
List<TreeSitterQueryCapture> capturesForHighlighting(
TreeSitterNode node, {
String? source,
TreeSitterUtf16Range? range,
TreeSitterQueryTextProvider? textProvider,
}) => _evaluate(
node,
source: source,
range: range,
textProvider: textProvider,
includeMatchPatterns: true,
collectCaptures: false,
selectCapturesByNode: true,
).captures;