From b0bd39e715e36b8e809983abf29e94104462e2dd Mon Sep 17 00:00:00 2001 From: Roman Golyshev Date: Tue, 24 Mar 2020 22:07:27 +0300 Subject: [PATCH] KT-36068 Remove redundant `commitAllDocuments` calls - Those calls seem to be redundant since the platform already commits all documents before invoking any intention - Also those calls are getting in the way of `Preview Intention` action by requiring write action, which is not granted by the platform at the moment --- .../kotlin/idea/inspections/IntentionBasedInspection.kt | 1 - .../jetbrains/kotlin/idea/intentions/SelfTargetingIntention.kt | 1 - 2 files changed, 2 deletions(-) diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/inspections/IntentionBasedInspection.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/inspections/IntentionBasedInspection.kt index 8559dc7d7f3..ea8a40873e9 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/inspections/IntentionBasedInspection.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/inspections/IntentionBasedInspection.kt @@ -169,7 +169,6 @@ abstract class IntentionBasedInspection private construct } override fun invoke(project: Project, editor: Editor?, file: PsiFile?) { - PsiDocumentManager.getInstance(project).commitAllDocuments() applyFix() } diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/intentions/SelfTargetingIntention.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/intentions/SelfTargetingIntention.kt index 3720670e988..b9f8def507c 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/intentions/SelfTargetingIntention.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/intentions/SelfTargetingIntention.kt @@ -94,7 +94,6 @@ abstract class SelfTargetingIntention( final override fun invoke(project: Project, editor: Editor?, file: PsiFile) { editor ?: return - PsiDocumentManager.getInstance(project).commitAllDocuments() val target = getTarget(editor, file) ?: return if (!FileModificationService.getInstance().preparePsiElementForWrite(target)) return applyTo(target, editor)