@@ -859,26 +859,24 @@ where
859859 }
860860 // If the node represents a reference, then try to find the corresponding
861861 // definition in the scope stack.
862− else if Some(capture.index) == layer.config.local_ref_capture_index {
863− if definition_highlight.is_none() {
864− definition_highlight = None;
865− if let Ok(name) = str::from_utf8(&self.source[range.clone()]) {
866− for scope in layer.scope_stack.iter().rev() {
867− if let Some(highlight) =
868− scope.local_defs.iter().rev().find_map(|def| {
869− if def.name == name && range.start >= def.value_range.end {
870− Some(def.highlight)
871− } else {
872− None
873− }
874− })
875− {
876− reference_highlight = highlight;
877− break;
878− }
879− if !scope.inherits {
880− break;
862+ else if Some(capture.index) == layer.config.local_ref_capture_index
863+ && definition_highlight.is_none()
864+ {
865+ definition_highlight = None;
866+ if let Ok(name) = str::from_utf8(&self.source[range.clone()]) {
867+ for scope in layer.scope_stack.iter().rev() {
868+ if let Some(highlight) = scope.local_defs.iter().rev().find_map(|def| {
869+ if def.name == name && range.start >= def.value_range.end {
870+ Some(def.highlight)
871+ } else {
872+ None
881873 }
874+ }) {
875+ reference_highlight = highlight;
876+ break;
877+ }
878+ if !scope.inherits {
879+ break;
882880 }
883881 }
884882 }