File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,8 @@ abstract class ElmAtCaretIntentionActionBase<Ctx> : BaseElementAtCaretIntentionA
4141
4242 abstract fun invoke (project : Project , editor : Editor , context : Ctx )
4343
44+ override fun startInWriteAction (): Boolean = true
45+
4446 final override fun invoke (project : Project , editor : Editor , element : PsiElement ) {
4547 val context = findApplicableContext(project, editor, element) ? : return
4648 checkWriteAccessAllowed()
@@ -51,4 +53,4 @@ abstract class ElmAtCaretIntentionActionBase<Ctx> : BaseElementAtCaretIntentionA
5153 checkReadAccessAllowed()
5254 return findApplicableContext(project, editor, element) != null
5355 }
54- }
56+ }
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import com.intellij.openapi.vfs.VirtualFile
2121import com.intellij.openapi.vfs.VirtualFileManager
2222import com.intellij.psi.PsiFile
2323import com.intellij.psi.PsiManager
24+ import com.intellij.codeInsight.intention.preview.IntentionPreviewUtils
2425import org.jdom.Element
2526import org.jdom.input.SAXBuilder
2627import java.nio.file.Path
@@ -38,6 +39,9 @@ val Project.modules: Collection<Module>
3839
3940
4041fun checkWriteAccessAllowed () {
42+ // In preview we must not assert write access; the platform runs without it.
43+ if (IntentionPreviewUtils .isIntentionPreviewActive()) return
44+
4145 check(ApplicationManager .getApplication().isWriteAccessAllowed) {
4246 " Needs write action"
4347 }
You can’t perform that action at this time.
0 commit comments