configure method
Configures capture-to-highlight matching using upstream's component-set specificity rule.
Implementation
void configure(List<String> recognizedNames) {
for (var captureIndex = 0; captureIndex < names.length; captureIndex++) {
final captureParts = names[captureIndex].split('.');
int? bestIndex;
var bestMatchLength = 0;
for (var index = 0; index < recognizedNames.length; index++) {
var length = 0;
var matches = true;
for (final part in recognizedNames[index].split('.')) {
length++;
if (!captureParts.contains(part)) {
matches = false;
break;
}
}
if (matches && length > bestMatchLength) {
bestIndex = index;
bestMatchLength = length;
}
}
_highlightIndices[captureIndex] = bestIndex == null
? null
: TreeSitterHighlight(bestIndex);
}
}