diff --git a/java/java-tests/testData/actions/reformatFileInEditor/formatSelection_DoNotTouchTrailingWhiteSpaces_after.java b/java/java-tests/testData/actions/reformatFileInEditor/formatSelection_DoNotTouchTrailingWhiteSpaces_after.java new file mode 100644 index 000000000000..3dfde165f400 --- /dev/null +++ b/java/java-tests/testData/actions/reformatFileInEditor/formatSelection_DoNotTouchTrailingWhiteSpaces_after.java @@ -0,0 +1,10 @@ +public class T { + + + public void tutu() { + + } + + + public void test() {} +} \ No newline at end of file diff --git a/java/java-tests/testData/actions/reformatFileInEditor/formatSelection_DoNotTouchTrailingWhiteSpaces_before.java b/java/java-tests/testData/actions/reformatFileInEditor/formatSelection_DoNotTouchTrailingWhiteSpaces_before.java new file mode 100644 index 000000000000..c8d45129804d --- /dev/null +++ b/java/java-tests/testData/actions/reformatFileInEditor/formatSelection_DoNotTouchTrailingWhiteSpaces_before.java @@ -0,0 +1,10 @@ +public class T { + + + public void tutu() { + + } + + + public void test() {} +} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/actions/ReformatCodeActionInEditorTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/actions/ReformatCodeActionInEditorTest.java index 058d165c3ddf..578ba79bad81 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/actions/ReformatCodeActionInEditorTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/actions/ReformatCodeActionInEditorTest.java @@ -102,4 +102,9 @@ public class ReformatCodeActionInEditorTest extends LightPlatformCodeInsightFixt public void testFormatOptimizeRearrangeVcsChanges() { doTest(new ReformatCodeRunOptions(VCS_CHANGED_TEXT).setOptimizeImports(true).setRearrangeCode(true)); } + + public void testFormatSelection_DoNotTouchTrailingWhiteSpaces() { + //todo actually test is not working, and working test is not working + doTest(new ReformatCodeRunOptions(SELECTED_TEXT)); + } } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatCodeProcessor.java b/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatCodeProcessor.java index e9f80bd23fad..0bfb4cc31238 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatCodeProcessor.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatCodeProcessor.java @@ -54,7 +54,7 @@ public class ReformatCodeProcessor extends AbstractLayoutCodeProcessor { } public ReformatCodeProcessor(@NotNull PsiFile file, @NotNull SelectionModel selectionModel) { - super(file.getProject(), file, COMMAND_NAME, PROGRESS_TEXT, false); + super(file.getProject(), file, PROGRESS_TEXT, COMMAND_NAME, false); mySelectionModel = selectionModel; }