From 6ea018920065c10cca74989ce7e1abcd39696312 Mon Sep 17 00:00:00 2001 From: Petr Surkov Date: Fri, 8 Dec 2023 08:55:00 +0100 Subject: [PATCH] [full-line] ML-2050 Create two separate functions to find errors in CorrectnessCheckerBase GitOrigin-RevId: 9af72351028d04b11157d58b95c961e5ebd0de5d --- .../checker/CorrectnessCheckerBase.kt | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/platform/ml-impl/src/com/intellij/platform/ml/impl/correctness/checker/CorrectnessCheckerBase.kt b/platform/ml-impl/src/com/intellij/platform/ml/impl/correctness/checker/CorrectnessCheckerBase.kt index 62c9994caa34..37290c55e27f 100644 --- a/platform/ml-impl/src/com/intellij/platform/ml/impl/correctness/checker/CorrectnessCheckerBase.kt +++ b/platform/ml-impl/src/com/intellij/platform/ml/impl/correctness/checker/CorrectnessCheckerBase.kt @@ -5,6 +5,7 @@ import com.intellij.codeInspection.InspectionEngine import com.intellij.openapi.diagnostic.thisLogger import com.intellij.openapi.progress.ProgressManager import com.intellij.openapi.util.TextRange +import com.intellij.psi.PsiElement import com.intellij.psi.PsiFile import com.intellij.psi.SyntaxTraverser import com.intellij.util.PairProcessor @@ -39,6 +40,16 @@ abstract class CorrectnessCheckerBase(private val semanticCheckers: List, + file: PsiFile, + offset: Int, + prefix: String, + suggestion: String): List { return InspectionEngine.inspectElements( toolWrappers, fullPsi, @@ -51,7 +62,15 @@ abstract class CorrectnessCheckerBase(private val semanticCheckers: List + } + } + + private fun findCustomErrors(elements: List, + file: PsiFile, + offset: Int, + prefix: String, + suggestion: String): List { + return customSemanticCheckers.flatMap { analyzer -> elements.flatMap { element -> analyzer.findErrors(file, element, offset, prefix, suggestion) } } }