From ece99aaef72f47088ec1f60c4f6aeeb5e33e7f62 Mon Sep 17 00:00:00 2001 From: Alexander Zolotov Date: Thu, 15 Jan 2026 21:49:33 +0100 Subject: [PATCH] refactoring [text-matching]: allow creating matchers with fallback and typo tolerant fixing layout matcher NameUtil, which previously constructed these matchers, is moving to the IJ platform. This change allows clients to create the matchers directly. GitOrigin-RevId: f6addda191ee471d65af9ada6fef93de7ab45b16 --- platform/util/text-matching/api-dump.txt | 3 +++ .../psi/codeStyle/FixingLayoutTypoTolerantMatcher.kt | 2 +- .../src/com/intellij/psi/codeStyle/MatcherWithFallback.kt | 6 ++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/platform/util/text-matching/api-dump.txt b/platform/util/text-matching/api-dump.txt index 87f19e4bfb40..14e5a2791a58 100644 --- a/platform/util/text-matching/api-dump.txt +++ b/platform/util/text-matching/api-dump.txt @@ -20,6 +20,9 @@ c:com.intellij.psi.codeStyle.FixingLayoutMatcher - sf:fixLayout(java.lang.String,com.intellij.util.text.matching.KeyboardLayoutConverter):java.lang.String f:com.intellij.psi.codeStyle.FixingLayoutMatcher$Companion - f:fixLayout(java.lang.String,com.intellij.util.text.matching.KeyboardLayoutConverter):java.lang.String +f:com.intellij.psi.codeStyle.FixingLayoutTypoTolerantMatcher +- sf:INSTANCE:com.intellij.psi.codeStyle.FixingLayoutTypoTolerantMatcher +- sf:create(java.lang.String,com.intellij.util.text.matching.MatchingMode,java.lang.String,com.intellij.util.text.matching.KeyboardLayoutConverter):com.intellij.psi.codeStyle.MinusculeMatcher a:com.intellij.psi.codeStyle.MinusculeMatcher - com.intellij.util.text.Matcher - sf:Companion:com.intellij.psi.codeStyle.MinusculeMatcher$Companion diff --git a/platform/util/text-matching/src/com/intellij/psi/codeStyle/FixingLayoutTypoTolerantMatcher.kt b/platform/util/text-matching/src/com/intellij/psi/codeStyle/FixingLayoutTypoTolerantMatcher.kt index 77a3e7dd49f2..5d42a51ed335 100644 --- a/platform/util/text-matching/src/com/intellij/psi/codeStyle/FixingLayoutTypoTolerantMatcher.kt +++ b/platform/util/text-matching/src/com/intellij/psi/codeStyle/FixingLayoutTypoTolerantMatcher.kt @@ -6,7 +6,7 @@ import com.intellij.util.text.matching.KeyboardLayoutConverter import com.intellij.util.text.matching.MatchingMode import kotlin.jvm.JvmStatic -internal object FixingLayoutTypoTolerantMatcher { +object FixingLayoutTypoTolerantMatcher { @JvmStatic fun create(pattern: String, matchingMode: MatchingMode, hardSeparators: String, keyboardLayoutConverter: KeyboardLayoutConverter): MinusculeMatcher { val mainMatcher = TypoTolerantMatcher(pattern, matchingMode, hardSeparators) diff --git a/platform/util/text-matching/src/com/intellij/psi/codeStyle/MatcherWithFallback.kt b/platform/util/text-matching/src/com/intellij/psi/codeStyle/MatcherWithFallback.kt index 8b0141ff8719..5e4840c594d1 100644 --- a/platform/util/text-matching/src/com/intellij/psi/codeStyle/MatcherWithFallback.kt +++ b/platform/util/text-matching/src/com/intellij/psi/codeStyle/MatcherWithFallback.kt @@ -9,10 +9,8 @@ import com.intellij.util.text.matching.undeprecate import org.jetbrains.annotations.ApiStatus @ApiStatus.Internal -open class MatcherWithFallback internal constructor( - private val myMainMatcher: MinusculeMatcher, - private val myFallbackMatcher: MinusculeMatcher?, -) : MinusculeMatcher() { +open class MatcherWithFallback(private val myMainMatcher: MinusculeMatcher, private val myFallbackMatcher: MinusculeMatcher?) : + MinusculeMatcher() { override val pattern: String get() = myMainMatcher.pattern