Search in sources :

Example 51 with CommonCodeStyleSettings

use of com.intellij.psi.codeStyle.CommonCodeStyleSettings in project intellij-community by JetBrains.

the class JavaFormatterTest method testMethodCallInAssignment.

public void testMethodCallInAssignment() throws Exception {
    final CommonCodeStyleSettings settings = getSettings();
    settings.getRootSettings().getIndentOptions(StdFileTypes.JAVA).CONTINUATION_INDENT_SIZE = 8;
    doTest();
}
Also used : CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings)

Example 52 with CommonCodeStyleSettings

use of com.intellij.psi.codeStyle.CommonCodeStyleSettings in project intellij-community by JetBrains.

the class JavaFormatterTest method testClass2.

public void testClass2() throws Exception {
    final CommonCodeStyleSettings settings = getSettings();
    settings.KEEP_FIRST_COLUMN_COMMENT = false;
    doTextTest("class A {\n" + "// comment before\n" + "protected Object a;//  comment after\n" + "}", "class A {\n" + "    // comment before\n" + "    protected Object a;//  comment after\n" + "}");
}
Also used : CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings)

Example 53 with CommonCodeStyleSettings

use of com.intellij.psi.codeStyle.CommonCodeStyleSettings in project intellij-community by JetBrains.

the class JavaFormatterTest method testCommentBeforeField.

public void testCommentBeforeField() throws Exception {
    final CommonCodeStyleSettings settings = getSettings();
    settings.KEEP_LINE_BREAKS = false;
    settings.KEEP_FIRST_COLUMN_COMMENT = false;
    settings.KEEP_CONTROL_STATEMENT_IN_ONE_LINE = false;
    settings.KEEP_SIMPLE_BLOCKS_IN_ONE_LINE = false;
    settings.KEEP_SIMPLE_METHODS_IN_ONE_LINE = false;
    doTextTest("class Foo{\n" + "    //Foo a\n" + "    Foo a; \n" + "}", "class Foo {\n" + "    //Foo a\n" + "    Foo a;\n" + "}");
}
Also used : CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings)

Example 54 with CommonCodeStyleSettings

use of com.intellij.psi.codeStyle.CommonCodeStyleSettings in project intellij-community by JetBrains.

the class JavaFormatterTest method testSynchronizedBlock.

public void testSynchronizedBlock() throws Exception {
    final CommonCodeStyleSettings settings = getSettings();
    settings.SPACE_BEFORE_SYNCHRONIZED_PARENTHESES = false;
    settings.SPACE_WITHIN_SYNCHRONIZED_PARENTHESES = false;
    settings.SPACE_BEFORE_SYNCHRONIZED_LBRACE = false;
    doTest();
}
Also used : CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings)

Example 55 with CommonCodeStyleSettings

use of com.intellij.psi.codeStyle.CommonCodeStyleSettings in project intellij-community by JetBrains.

the class JavaFormatterTest method testCommentAfterDeclaration.

public void testCommentAfterDeclaration() throws Exception {
    CodeStyleSettings codeStyleSettings = CodeStyleSettingsManager.getSettings(getProject());
    CommonCodeStyleSettings javaSettings = codeStyleSettings.getCommonSettings(JavaLanguage.INSTANCE);
    int oldMargin = codeStyleSettings.getDefaultRightMargin();
    int oldWrap = javaSettings.ASSIGNMENT_WRAP;
    try {
        codeStyleSettings.setDefaultRightMargin(20);
        javaSettings.ASSIGNMENT_WRAP = CommonCodeStyleSettings.WRAP_AS_NEEDED;
        doMethodTest("int i=0; //comment comment", "int i =\n" + "        0; //comment comment");
    } finally {
        codeStyleSettings.setDefaultRightMargin(oldMargin);
        javaSettings.ASSIGNMENT_WRAP = oldWrap;
    }
}
Also used : CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings) CodeStyleSettings(com.intellij.psi.codeStyle.CodeStyleSettings) CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings)

Aggregations

CommonCodeStyleSettings (com.intellij.psi.codeStyle.CommonCodeStyleSettings)202 CodeStyleSettings (com.intellij.psi.codeStyle.CodeStyleSettings)19 TextRange (com.intellij.openapi.util.TextRange)5 PsiElement (com.intellij.psi.PsiElement)5 ASTNode (com.intellij.lang.ASTNode)4 Editor (com.intellij.openapi.editor.Editor)4 JavaCodeStyleSettings (com.intellij.psi.codeStyle.JavaCodeStyleSettings)4 EditorSettingsExternalizable (com.intellij.openapi.editor.ex.EditorSettingsExternalizable)3 PsiFile (com.intellij.psi.PsiFile)3 File (java.io.File)3 Matcher (java.util.regex.Matcher)3 NonNls (org.jetbrains.annotations.NonNls)3 NotNull (org.jetbrains.annotations.NotNull)3 Document (com.intellij.openapi.editor.Document)2 Project (com.intellij.openapi.project.Project)2 CodeStyleManager (com.intellij.psi.codeStyle.CodeStyleManager)2 ArrangementGroupingRule (com.intellij.psi.codeStyle.arrangement.group.ArrangementGroupingRule)2 IElementType (com.intellij.psi.tree.IElementType)2 Nullable (org.jetbrains.annotations.Nullable)2 GroovyCodeStyleSettings (org.jetbrains.plugins.groovy.codeStyle.GroovyCodeStyleSettings)2