New J2K: check for element validity before applying fix in diagnostic-based post processings
This commit is contained in:
+2
@@ -44,6 +44,7 @@ class DiagnosticBasedPostProcessingGroup(diagnosticBasedProcessings: List<Diagno
|
|||||||
val range = rangeMarker?.range ?: file.textRange
|
val range = rangeMarker?.range ?: file.textRange
|
||||||
if (diagnostic.psiElement.isInRange(range)) {
|
if (diagnostic.psiElement.isInRange(range)) {
|
||||||
diagnosticToFix[diagnostic.factory]?.forEach { fix ->
|
diagnosticToFix[diagnostic.factory]?.forEach { fix ->
|
||||||
|
if (diagnostic.psiElement.isValid) {
|
||||||
runWriteAction { fix(diagnostic) }
|
runWriteAction { fix(diagnostic) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -51,6 +52,7 @@ class DiagnosticBasedPostProcessingGroup(diagnosticBasedProcessings: List<Diagno
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun analyzeFileRange(file: KtFile, rangeMarker: RangeMarker?): Diagnostics {
|
private fun analyzeFileRange(file: KtFile, rangeMarker: RangeMarker?): Diagnostics {
|
||||||
val elements = when {
|
val elements = when {
|
||||||
|
|||||||
Reference in New Issue
Block a user