Refactor script reports: introduce getter, check that report are changed inside attach method
This commit is contained in:
+1
-1
@@ -71,7 +71,7 @@ object KotlinHighlightingUtil {
|
||||
private fun shouldHighlightScript(ktFile: KtFile): Boolean {
|
||||
if (isRunningInCidrIde) return false // There is no Java support in CIDR. So do not highlight errors in KTS if running in CIDR.
|
||||
if (!ScriptsCompilationConfigurationUpdater.areDependenciesCached(ktFile)) return false
|
||||
if (ktFile.virtualFile.getUserData(IdeScriptReportSink.Reports)?.any { it.severity == ScriptReport.Severity.FATAL } == true) {
|
||||
if (IdeScriptReportSink.getReports(ktFile.virtualFile).any { it.severity == ScriptReport.Severity.FATAL }) {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ class ScriptExternalHighlightingPass(
|
||||
|
||||
if (!file.isScript()) return
|
||||
|
||||
val reports = file.virtualFile.getUserData(IdeScriptReportSink.Reports) ?: return
|
||||
val reports = IdeScriptReportSink.getReports(file.virtualFile)
|
||||
|
||||
val annotations = reports.mapNotNull { (message, severity, position) ->
|
||||
val (startOffset, endOffset) = position?.let { computeOffsets(document, position) } ?: 0 to 0
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ class ScriptExternalHighlightingPass(
|
||||
}
|
||||
}
|
||||
|
||||
val reports = file.virtualFile.getUserData(IdeScriptReportSink.Reports) ?: return
|
||||
val reports = IdeScriptReportSink.getReports(file.virtualFile)
|
||||
|
||||
val annotations = reports.mapNotNull { (message, severity, position) ->
|
||||
val (startOffset, endOffset) = position?.let { computeOffsets(document, position) } ?: 0 to 0
|
||||
|
||||
Reference in New Issue
Block a user