File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
idea_plugin/src/main/java/com/google/googlejavaformat/intellij Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -64,14 +64,24 @@ public boolean supports(@NotNull PsiFile file) {
6464 return Runnables .doNothing ();
6565 }
6666
67+ /* pointless to change document text if it hasn't changed, plus this can interfere with
68+ e.g. GoogleJavaFormattingService's output, i.e. it can overwrite the results from the main
69+ formatter. */
70+ if (text .equals (origText )) {
71+ return Runnables .doNothing ();
72+ }
73+
6774 return () -> {
6875 if (documentManager .isDocumentBlockedByPsi (document )) {
6976 documentManager .doPostponedOperationsAndUnblockDocument (document );
70- String newText = document .getText ();
71- if (!newText .equals (origText )) {
72- return ;
73- }
7477 }
78+
79+ // similarly to above, don't overwrite new document text if it has changed
80+ String newText = document .getText ();
81+ if (!newText .equals (origText )) {
82+ return ;
83+ }
84+
7585 document .setText (text );
7686 };
7787 }
You can’t perform that action at this time.
0 commit comments