New J2K: do not commit document after each inspection in post-processing
Related to #KT-31848
This commit is contained in:
+2
-8
@@ -18,7 +18,6 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticFactory
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.getResolutionFacade
|
||||
import org.jetbrains.kotlin.idea.core.util.EDT
|
||||
import org.jetbrains.kotlin.idea.core.util.range
|
||||
import org.jetbrains.kotlin.idea.formatter.commitAndUnblockDocument
|
||||
import org.jetbrains.kotlin.idea.inspections.AbstractApplicabilityBasedInspection
|
||||
import org.jetbrains.kotlin.idea.inspections.AbstractKotlinInspection
|
||||
import org.jetbrains.kotlin.idea.intentions.SelfTargetingIntention
|
||||
@@ -60,10 +59,10 @@ class InspectionLikeProcessingGroup(val inspectionLikeProcessings: List<Inspecti
|
||||
if (element.isValid) {
|
||||
if (writeActionNeeded) {
|
||||
runWriteAction {
|
||||
runAction(action, element)
|
||||
action()
|
||||
}
|
||||
} else {
|
||||
runAction(action, element)
|
||||
action()
|
||||
}
|
||||
} else {
|
||||
modificationStamp = null
|
||||
@@ -81,11 +80,6 @@ class InspectionLikeProcessingGroup(val inspectionLikeProcessings: List<Inspecti
|
||||
PROCESS
|
||||
}
|
||||
|
||||
private inline fun runAction(action: () -> Unit, element: PsiElement) {
|
||||
val file = element.containingFile //element can be deleted after action performed
|
||||
action()
|
||||
runWriteAction { file.commitAndUnblockDocument() }
|
||||
}
|
||||
|
||||
private data class ActionData(val element: PsiElement, val action: () -> Unit, val priority: Int, val writeActionNeeded: Boolean)
|
||||
|
||||
|
||||
+1
-1
@@ -29,6 +29,6 @@ internal class A {
|
||||
fun foo(param1: String?, param2: String?, param3: String?) {}
|
||||
|
||||
companion object {
|
||||
/*it's public*/ /*and static*/ const val/*and final*/ C = 1
|
||||
/*it's public*/const /*and static*/ val/*and final*/ C = 1
|
||||
}
|
||||
}
|
||||
+14
-14
@@ -83,14 +83,14 @@ internal class A {
|
||||
s.regionMatches(0, "st", 1, 2)
|
||||
s.replace("\\w+".toRegex(), "---").replaceFirst("([s-t])".toRegex(), "A$1")
|
||||
/* TODO
|
||||
s.matches("\\w+");
|
||||
useSplit(s.split("\\s+"));
|
||||
useSplit(s.split("\\s+", 0));
|
||||
useSplit(s.split("\\s+", -1));
|
||||
useSplit(s.split("\\s+", 2));
|
||||
int limit = 5;
|
||||
useSplit(s.split("\\s+", limit));
|
||||
*/
|
||||
s.matches("\\w+");
|
||||
useSplit(s.split("\\s+"));
|
||||
useSplit(s.split("\\s+", 0));
|
||||
useSplit(s.split("\\s+", -1));
|
||||
useSplit(s.split("\\s+", 2));
|
||||
int limit = 5;
|
||||
useSplit(s.split("\\s+", limit));
|
||||
*/
|
||||
s.trim { it <= ' ' }
|
||||
"$s another"
|
||||
|
||||
@@ -123,17 +123,17 @@ internal class A {
|
||||
String(chars, 1, 2)
|
||||
String(chars)
|
||||
String(chars, 1, 2)
|
||||
val order: Comparator<String?> = String.CASE_INSENSITIVE_ORDER
|
||||
val order: Comparator<String?>? = java.lang.String.CASE_INSENSITIVE_ORDER
|
||||
}
|
||||
|
||||
fun unsupportedMethods() {
|
||||
val s = "test string"
|
||||
/* TODO:
|
||||
s.indexOf(32);
|
||||
s.indexOf(32, 2);
|
||||
s.lastIndexOf(32);
|
||||
s.lastIndexOf(32, 2);
|
||||
*/
|
||||
s.indexOf(32);
|
||||
s.indexOf(32, 2);
|
||||
s.lastIndexOf(32);
|
||||
s.lastIndexOf(32, 2);
|
||||
*/
|
||||
}
|
||||
|
||||
fun useSplit(result: Array<String?>?) {}
|
||||
|
||||
Reference in New Issue
Block a user