From 608f8eeca4bf61710eeb534bcfbf2cbdcc60c637 Mon Sep 17 00:00:00 2001 From: Ilia Permiashkin Date: Tue, 30 Sep 2025 16:14:58 +0300 Subject: [PATCH] [grazie] IJPL-89649 Remove `[OMIT]` from suggestion / description GitOrigin-RevId: 2c55bfec488f2fef2fd267dd171fd2159bf53365 --- .../grazie/grammar/LanguageToolChecker.kt | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/plugins/grazie/src/main/kotlin/com/intellij/grazie/grammar/LanguageToolChecker.kt b/plugins/grazie/src/main/kotlin/com/intellij/grazie/grammar/LanguageToolChecker.kt index f45c5e26d5d7..9053e7d4d990 100644 --- a/plugins/grazie/src/main/kotlin/com/intellij/grazie/grammar/LanguageToolChecker.kt +++ b/plugins/grazie/src/main/kotlin/com/intellij/grazie/grammar/LanguageToolChecker.kt @@ -137,13 +137,22 @@ open class LanguageToolChecker : ExternalTextChecker() { override fun getShortMessage(): String = match.shortMessage.trimToNull() ?: match.rule.description.trimToNull() ?: match.rule.category.name + @Suppress("HardCodedStringLiteral") override fun getDescriptionTemplate(isOnTheFly: Boolean): String = if (testDescription) match.rule.id - else match.messageSanitized + else { + when (match.rule.id) { + "EN_PLAIN_ENGLISH_REPLACE" -> "'there are' is a wordy or complex expression. In some cases, it might be preferable to remove it entirely." + else -> match.messageSanitized + } + } - override fun getTooltipTemplate(): String = toTooltipTemplate(match) + override fun getTooltipTemplate(): String = toTooltipTemplate(this) - override fun getSuggestions(): List = match.suggestedReplacements.map { Suggestion.replace(highlightRanges[0], it) } + override fun getSuggestions(): List = when (match.rule.id) { + "EN_PLAIN_ENGLISH_REPLACE" -> listOf(Suggestion.replace(highlightRanges[0], "")) + else -> match.suggestedReplacements.map { Suggestion.replace(highlightRanges[0], it) } + } override fun getPatternRange() = TextRange(match.patternFromPos, match.patternToPos) @@ -277,10 +286,10 @@ private fun isPathPart(startOffset: Int, endOffset: Int, text: TextContent): Boo } @NlsSafe -private fun toTooltipTemplate(match: RuleMatch): String { +private fun toTooltipTemplate(problem: TextProblem): String { val html = html { p { - +match.messageSanitized + +problem.getDescriptionTemplate(true) } p {