2026.2 eap with writeAction and document.setText()

In a Gradle setup, I updated to the latest 2026.2 eap.

Now, this test fails:

    @Test
    fun `write testing`(): Unit = runBlocking {
        codeInsight.configureByText("a.txt", "")

        val document = codeInsight.editor.document

        writeAction {
            document.setText("new")
        }
    }

Apparently, with this EAP, writeAction is now executed in the background.

But document.setText explicitly requires a write action in the EDT, thus edtWriteAction.

https://youtrack.jetbrains.com/issue/IJPL-149765 mentions that edtWriteAction will be deprecated.

What’s the right way to this this?
Is it a problem of setText or are we expected to updates all such writeAction calls to the deprecated edtWriteAction?

Exception:

Access is allowed from Event Dispatch Thread (EDT) only; see https://jb.gg/ij-platform-threading for details
Current thread: Thread[#95,DefaultDispatcher-worker-30 @coroutine#1080,5,main] 1102984295 (EventQueue.isDispatchThread()=false)
SystemEventQueueThread: Thread[#50,AWT-EventQueue-0,6,main] 935160003
com.intellij.openapi.diagnostic.RuntimeExceptionWithAttachments: Access is allowed from Event Dispatch Thread (EDT) only; see https://jb.gg/ij-platform-threading for details
Current thread: Thread[#95,DefaultDispatcher-worker-30 @coroutine#1080,5,main] 1102984295 (EventQueue.isDispatchThread()=false)
SystemEventQueueThread: Thread[#50,AWT-EventQueue-0,6,main] 935160003
	at com.intellij.util.concurrency.ThreadingAssertions.createThreadRequirementException(ThreadingAssertions.java:281)
	at com.intellij.util.concurrency.ThreadingAssertions.throwThreadRequirementException(ThreadingAssertions.java:275)
	at com.intellij.util.concurrency.ThreadingAssertions.assertEventDispatchThread(ThreadingAssertions.java:78)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:105)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:80)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:68)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:46)
	at com.intellij.openapi.editor.impl.DocumentImpl.setText(DocumentImpl.java:1181)

Hi Joachim,

edtWriteAction is not deprecated, this is a stable API. It is the intended function for your use-case. Deprecation of edtWriteAction will not happen anytime soon, the Platform is not ready yet for this.

writeAction is promoted to stable for 2026.2, and with stabilization it changed its semantics one final time.

Thanks!

If I understand correctly, any plugin using writeAction to update documents (and possible other types of changes) will cause exceptions and will have to switch to edtWriteAction and thus update the baseline to 2025.1 because only that version has the edtWriteAction method?

Yes, that’s correct.