Skip to content

Commit 10cef1b

Browse files
committed
Fix java.lang.RuntimeException: Document is locked by write PSI operations errors
1 parent 81cb908 commit 10cef1b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

idea_plugin/src/main/java/com/google/googlejavaformat/intellij/GoogleJavaFormatImportOptimizer.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ public boolean supports(@NotNull PsiFile file) {
6565
return Runnables.doNothing();
6666
}
6767

68-
return () -> document.setText(text);
68+
return () -> {
69+
if (documentManager.isDocumentBlockedByPsi(document)) {
70+
documentManager.doPostponedOperationsAndUnblockDocument(document);
71+
}
72+
document.setText(text);
73+
};
6974
}
7075
}

0 commit comments

Comments
 (0)