Mark file writable before creating intention delegate (change of writable property can increment out-of-code-block modification count, which recreates the cached resolve session)
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.idea.quickfix
|
package org.jetbrains.kotlin.idea.quickfix
|
||||||
|
|
||||||
|
import com.intellij.codeInsight.FileModificationService
|
||||||
import com.intellij.codeInsight.intention.HighPriorityAction
|
import com.intellij.codeInsight.intention.HighPriorityAction
|
||||||
import com.intellij.codeInsight.intention.IntentionAction
|
import com.intellij.codeInsight.intention.IntentionAction
|
||||||
import com.intellij.codeInsight.intention.LowPriorityAction
|
import com.intellij.codeInsight.intention.LowPriorityAction
|
||||||
@@ -49,6 +50,10 @@ open class QuickFixWithDelegateFactory(
|
|||||||
override fun startInWriteAction() = startInWriteAction
|
override fun startInWriteAction() = startInWriteAction
|
||||||
|
|
||||||
override fun invoke(project: Project, editor: Editor?, file: PsiFile?) {
|
override fun invoke(project: Project, editor: Editor?, file: PsiFile?) {
|
||||||
|
if (!FileModificationService.getInstance().prepareFileForWrite(file)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
val action = delegateFactory() ?: return
|
val action = delegateFactory() ?: return
|
||||||
|
|
||||||
assert(action.detectPriority() == this.detectPriority()) {
|
assert(action.detectPriority() == this.detectPriority()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user