ReplOutputProcessor: cleanup code
This commit is contained in:
@@ -30,9 +30,9 @@ import com.intellij.openapi.editor.markup.HighlighterTargetArea
|
|||||||
import com.intellij.openapi.editor.markup.TextAttributes
|
import com.intellij.openapi.editor.markup.TextAttributes
|
||||||
import com.intellij.psi.PsiDocumentManager
|
import com.intellij.psi.PsiDocumentManager
|
||||||
import org.jetbrains.kotlin.console.actions.logError
|
import org.jetbrains.kotlin.console.actions.logError
|
||||||
import org.jetbrains.kotlin.console.gutter.IconWithTooltip
|
|
||||||
import org.jetbrains.kotlin.console.gutter.ConsoleErrorRenderer
|
import org.jetbrains.kotlin.console.gutter.ConsoleErrorRenderer
|
||||||
import org.jetbrains.kotlin.console.gutter.ConsoleIndicatorRenderer
|
import org.jetbrains.kotlin.console.gutter.ConsoleIndicatorRenderer
|
||||||
|
import org.jetbrains.kotlin.console.gutter.IconWithTooltip
|
||||||
import org.jetbrains.kotlin.console.gutter.ReplIcons
|
import org.jetbrains.kotlin.console.gutter.ReplIcons
|
||||||
import org.jetbrains.kotlin.diagnostics.Severity
|
import org.jetbrains.kotlin.diagnostics.Severity
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
@@ -83,7 +83,10 @@ class ReplOutputProcessor(
|
|||||||
|
|
||||||
fun printBuildInfoWarningIfNeeded() {
|
fun printBuildInfoWarningIfNeeded() {
|
||||||
if (ApplicationManager.getApplication().isUnitTestMode) return
|
if (ApplicationManager.getApplication().isUnitTestMode) return
|
||||||
if (runner.previousCompilationFailed) return printWarningMessage("There were compilation errors in module ${runner.module.name}", false)
|
if (runner.previousCompilationFailed) return printWarningMessage(
|
||||||
|
"There were compilation errors in module ${runner.module.name}",
|
||||||
|
false
|
||||||
|
)
|
||||||
if (runner.compilerHelper.moduleIsUpToDate()) return
|
if (runner.compilerHelper.moduleIsUpToDate()) return
|
||||||
|
|
||||||
val compilerWarningMessage = "You’re running the REPL with outdated classes: "
|
val compilerWarningMessage = "You’re running the REPL with outdated classes: "
|
||||||
@@ -156,9 +159,21 @@ class ReplOutputProcessor(
|
|||||||
Severity.ERROR ->
|
Severity.ERROR ->
|
||||||
getAttributesForSeverity(HighlightInfoType.ERROR, HighlightSeverity.ERROR, CodeInsightColors.ERRORS_ATTRIBUTES, start, end)
|
getAttributesForSeverity(HighlightInfoType.ERROR, HighlightSeverity.ERROR, CodeInsightColors.ERRORS_ATTRIBUTES, start, end)
|
||||||
Severity.WARNING ->
|
Severity.WARNING ->
|
||||||
getAttributesForSeverity(HighlightInfoType.WARNING, HighlightSeverity.WARNING, CodeInsightColors.WARNINGS_ATTRIBUTES, start, end)
|
getAttributesForSeverity(
|
||||||
|
HighlightInfoType.WARNING,
|
||||||
|
HighlightSeverity.WARNING,
|
||||||
|
CodeInsightColors.WARNINGS_ATTRIBUTES,
|
||||||
|
start,
|
||||||
|
end
|
||||||
|
)
|
||||||
Severity.INFO ->
|
Severity.INFO ->
|
||||||
getAttributesForSeverity(HighlightInfoType.WEAK_WARNING, HighlightSeverity.WEAK_WARNING, CodeInsightColors.WEAK_WARNING_ATTRIBUTES, start, end)
|
getAttributesForSeverity(
|
||||||
|
HighlightInfoType.WEAK_WARNING,
|
||||||
|
HighlightSeverity.WEAK_WARNING,
|
||||||
|
CodeInsightColors.WEAK_WARNING_ATTRIBUTES,
|
||||||
|
start,
|
||||||
|
end
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getAttributesForSeverity(
|
private fun getAttributesForSeverity(
|
||||||
@@ -168,7 +183,8 @@ class ReplOutputProcessor(
|
|||||||
start: Int,
|
start: Int,
|
||||||
end: Int
|
end: Int
|
||||||
): TextAttributes {
|
): TextAttributes {
|
||||||
val highlightInfo = HighlightInfo.newHighlightInfo(infoType).range(start, end).severity(severity).textAttributes(insightColors).create()
|
val highlightInfo =
|
||||||
|
HighlightInfo.newHighlightInfo(infoType).range(start, end).severity(severity).textAttributes(insightColors).create()
|
||||||
|
|
||||||
val psiFile = PsiDocumentManager.getInstance(project).getPsiFile(consoleView.consoleEditor.document)
|
val psiFile = PsiDocumentManager.getInstance(project).getPsiFile(consoleView.consoleEditor.document)
|
||||||
val colorScheme = consoleView.consoleEditor.colorsScheme
|
val colorScheme = consoleView.consoleEditor.colorsScheme
|
||||||
|
|||||||
Reference in New Issue
Block a user