mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[Grazie][IDEA-348175] Show all corrections in rules examples
GitOrigin-RevId: 6a24c6602471dc9f68abead39a91bd67bcd3aeec
This commit is contained in:
committed by
intellij-monorepo-bot
parent
6af917033a
commit
e7ff7917be
@@ -11,7 +11,6 @@ import com.intellij.grazie.utils.text
|
||||
import com.intellij.openapi.progress.ProgressManager
|
||||
import com.intellij.util.containers.ContainerUtil
|
||||
import org.apache.commons.text.similarity.LevenshteinDistance
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import org.languagetool.JLanguageTool
|
||||
import org.languagetool.ResultCache
|
||||
import org.languagetool.Tag
|
||||
@@ -153,8 +152,8 @@ object LangTool : GrazieStateLifecycle {
|
||||
val accepted = ArrayList<IncorrectExample>()
|
||||
for (example in examples) {
|
||||
if (accepted.none { it.text.isSimilarTo(example.text) }) {
|
||||
val firstCorrection = example.corrections.find { it.isNotBlank() }
|
||||
accepted.add(IncorrectExample(example.example, ContainerUtil.createMaybeSingletonList(firstCorrection)))
|
||||
val corrections = example.corrections.filter { it.isNotBlank() }.take(3)
|
||||
accepted.add(IncorrectExample(example.example, corrections))
|
||||
if (accepted.size > 5) break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ fun FlowOrPhrasingContent.toCorrectHtml(example: IncorrectExample) {
|
||||
toHtml(example) { mistake ->
|
||||
if (example.corrections.isNotEmpty()) {
|
||||
strong {
|
||||
+example.corrections.first()
|
||||
+example.corrections.joinToString(separator = " / ")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user