IJPL-188477 Search Everywhere: highlighting of matched symbols in the result list doesn't work properly

GitOrigin-RevId: 6ed1189203e14838a4e2d5772e6f1856191cc9e7
This commit is contained in:
Tatiana Elfimova
2025-07-24 12:15:59 +00:00
committed by intellij-monorepo-bot
parent a4b716ef03
commit f3aebf133e
2 changed files with 5 additions and 5 deletions
@@ -65,7 +65,7 @@ class SeTargetsProviderDelegate(private val contributorWrapper: SeAsyncWeightedC
val weight = t.weight
val legacyItem = t.item as? ItemWithPresentation<*> ?: return true
val matchers = (contributorWrapper.contributor as? PSIPresentationBgRendererWrapper)
?.getNonComponentItemMatchers({ _ -> defaultMatchers }, t.item)
?.getNonComponentItemMatchers({ _ -> defaultMatchers }, legacyItem.getItem())
return collector.put(SeTargetItem(legacyItem, matchers, weight, contributorWrapper.contributor, getExtendedDescription(legacyItem)))
}
@@ -144,7 +144,7 @@ class SeTargetItemPresentation(
SeTargetItemPresentation(backgroundColorId = tp.backgroundColor?.rpcId(),
iconId = tp.icon?.rpcId(),
presentableText = tp.presentableText,
presentableTextMatchedRanges = matchers?.calcMatchedRanges(tp.presentableText),
presentableTextMatchedRanges = (matchers?.nameMatcher as? MinusculeMatcher)?.calcMatchedRanges(tp.presentableText),
presentableTextFgColorId = tp.presentableTextAttributes?.foregroundColor?.rpcId(),
presentableTextErrorHighlight = tp.presentableTextAttributes?.let { attrs ->
val simpleAttrs = SimpleTextAttributes.fromTextAttributes(attrs)
@@ -155,14 +155,14 @@ class SeTargetItemPresentation(
attrs.additionalEffects?.contains(EffectType.STRIKEOUT) == true
} == true,
containerText = tp.containerText,
containerTextMatchedRanges = matchers?.calcMatchedRanges(tp.containerText),
containerTextMatchedRanges = (matchers?.locationMatcher as? MinusculeMatcher)?.calcMatchedRanges(tp.containerText),
locationText = tp.locationText,
locationIconId = tp.locationIcon?.rpcId(),
extendedDescription = extendedDescription)
private fun ItemMatchers.calcMatchedRanges(text: String?): List<SerializableRange>? {
private fun MinusculeMatcher.calcMatchedRanges(text: String?): List<SerializableRange>? {
text ?: return null
return (nameMatcher as? MinusculeMatcher)?.matchingFragments(text)?.map { SerializableRange(it) }
return matchingFragments(text)?.map { SerializableRange(it) }
}
}
}