Smart trailing spaces filter and implementation for indents on empty lines (IDEA-163554, IDEA-144196)

This commit is contained in:
Rustam Vishnyakov
2016-12-16 13:50:40 +03:00
parent af9083d027
commit 2e88acdebc
4 changed files with 111 additions and 24 deletions
@@ -186,12 +186,12 @@ public class JavaFormatterInEditorTest extends LightPlatformCodeInsightTestCase
"<caret>package com.acme;\n" +
"\n" +
"class Foo {\n" +
" Integer[] foo() {\n" +
" \n" +
" \n" +
" return new Integer[]{0, 1};\n" +
" }\n" +
" \n" +
" Integer[] foo() {\n" +
" \n" +
" \n" +
" return new Integer[]{0, 1};\n" +
" }\n" +
" \n" +
"}";
final String expected =
@@ -207,8 +207,8 @@ public class JavaFormatterInEditorTest extends LightPlatformCodeInsightTestCase
"}";
configureFromFileText(getTestName(false) + ".java", initial);
WriteCommandAction.runWriteCommandAction(getProject(), () -> CodeStyleManager.getInstance(getProject())
.reformatText(getFile(), 0, getEditor().getDocument().getTextLength()));
//WriteCommandAction.runWriteCommandAction(getProject(), () -> CodeStyleManager.getInstance(getProject())
// .reformatText(getFile(), 0, getEditor().getDocument().getTextLength()));
Document doc = getEditor().getDocument();
EditorTestUtil.performTypingAction(getEditor(), ' ');
PsiDocumentManager.getInstance(getProject()).commitDocument(doc);