@ -1356,8 +1356,8 @@ impl HighlightConfiguration {
/// Tree-sitter syntax-highlighting queries specify highlights in the form of dot-separated
/// Tree-sitter syntax-highlighting queries specify highlights in the form of dot-separated
/// highlight names like `punctuation.bracket` and `function.method.builtin`. Consumers of
/// highlight names like `punctuation.bracket` and `function.method.builtin`. Consumers of
/// these queries can choose to recognize highlights with different levels of specificity.
/// these queries can choose to recognize highlights with different levels of specificity.
/// For example, the string `function.builtin` will match against `function. method. builtin`
/// For example, the string `function.builtin` will match against `function. builtin.constructor `
/// and `function.builtin.constructor`, but will not match `function.method`.
/// but will not match `function.method.builtin` and `function.method`.
///
///
/// When highlighting, results are returned as `Highlight` values, which contain the index
/// When highlighting, results are returned as `Highlight` values, which contain the index
/// of the matched highlight this list of highlight names.
/// of the matched highlight this list of highlight names.
@ -1377,13 +1377,15 @@ impl HighlightConfiguration {
let recognized_name = recognized_name ;
let recognized_name = recognized_name ;
let mut len = 0 ;
let mut len = 0 ;
let mut matches = true ;
let mut matches = true ;
for part in recognized_name . split ( '.' ) {
for ( i , part ) in recognized_name . split ( '.' ) . enumerate ( ) {
len + = 1 ;
match capture_parts . get ( i ) {
if ! capture_parts . contains ( & part ) {
Some ( capture_part ) if * capture_part = = part = > len + = 1 ,
_ = > {
matches = false ;
matches = false ;
break ;
break ;
}
}
}
}
}
if matches & & len > best_match_len {
if matches & & len > best_match_len {
best_index = Some ( i ) ;
best_index = Some ( i ) ;
best_match_len = len ;
best_match_len = len ;