Search in sources :

Example 96 with CommonCodeStyleSettings

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

the class DartFormatterTest method testExpressions.

public void testExpressions() throws Exception {
    final CommonCodeStyleSettings settings = getSettings(DartLanguage.INSTANCE);
    settings.RIGHT_MARGIN = 40;
    // TODO Decide whether this should be the default -- risky!
    settings.KEEP_LINE_BREAKS = false;
    doTest();
}
Also used : CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings)

Example 97 with CommonCodeStyleSettings

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

the class DartFormatterTest method testWrappingMeth.

public void testWrappingMeth() throws Exception {
    final CommonCodeStyleSettings settings = getSettings(DartLanguage.INSTANCE);
    settings.METHOD_ANNOTATION_WRAP = CommonCodeStyleSettings.WRAP_AS_NEEDED;
    settings.METHOD_PARAMETERS_LPAREN_ON_NEXT_LINE = true;
    settings.METHOD_PARAMETERS_RPAREN_ON_NEXT_LINE = true;
    settings.CALL_PARAMETERS_WRAP = CommonCodeStyleSettings.WRAP_AS_NEEDED;
    settings.CALL_PARAMETERS_LPAREN_ON_NEXT_LINE = true;
    settings.CALL_PARAMETERS_RPAREN_ON_NEXT_LINE = true;
    settings.ELSE_ON_NEW_LINE = true;
    settings.SPECIAL_ELSE_IF_TREATMENT = true;
    settings.FOR_STATEMENT_WRAP = CommonCodeStyleSettings.WRAP_AS_NEEDED;
    settings.FOR_STATEMENT_LPAREN_ON_NEXT_LINE = true;
    settings.FOR_STATEMENT_RPAREN_ON_NEXT_LINE = true;
    settings.WHILE_ON_NEW_LINE = true;
    settings.CATCH_ON_NEW_LINE = true;
    settings.BINARY_OPERATION_WRAP = CommonCodeStyleSettings.WRAP_AS_NEEDED;
    settings.BINARY_OPERATION_SIGN_ON_NEXT_LINE = true;
    settings.PARENTHESES_EXPRESSION_LPAREN_WRAP = true;
    settings.PARENTHESES_EXPRESSION_RPAREN_WRAP = true;
    settings.ASSIGNMENT_WRAP = CommonCodeStyleSettings.WRAP_AS_NEEDED;
    settings.PLACE_ASSIGNMENT_SIGN_ON_NEXT_LINE = true;
    settings.TERNARY_OPERATION_WRAP = CommonCodeStyleSettings.WRAP_AS_NEEDED;
    settings.TERNARY_OPERATION_SIGNS_ON_NEXT_LINE = true;
    settings.BLOCK_COMMENT_AT_FIRST_COLUMN = true;
    settings.KEEP_LINE_BREAKS = true;
    doTest();
}
Also used : CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings)

Example 98 with CommonCodeStyleSettings

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

the class ActionScriptFormatterTest method testBlankLinesAfterPackage.

public void testBlankLinesAfterPackage() throws Exception {
    final CommonCodeStyleSettings settings = getEcma4Settings();
    int blankLines = settings.BLANK_LINES_AFTER_PACKAGE;
    settings.BLANK_LINES_AFTER_PACKAGE = 2;
    doTest("package {\n" + "import com.jetbrains.flex.Demo;\n" + "import com.jetbrains.flex.Sample;\n" + "class Foo {\n" + "}\n" + "}", "package {\n" + "\n" + "\n" + "import com.jetbrains.flex.Demo;\n" + "import com.jetbrains.flex.Sample;\n" + "\n" + "class Foo {\n" + "}\n" + "}", ".as");
    settings.BLANK_LINES_AFTER_PACKAGE = blankLines;
}
Also used : CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings)

Example 99 with CommonCodeStyleSettings

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

the class ActionScriptFormatterTest method testActionScriptClass.

public void testActionScriptClass() throws Exception {
    CommonCodeStyleSettings settings = getEcma4Settings();
    settings.METHOD_BRACE_STYLE = CommonCodeStyleSettings.NEXT_LINE;
    settings.CLASS_BRACE_STYLE = CommonCodeStyleSettings.NEXT_LINE;
    settings.BRACE_STYLE = CommonCodeStyleSettings.NEXT_LINE;
    doTest("package foo { class A { function foo() {} } }", "package foo\n" + "{\n" + "class A\n" + "{\n" + "    function foo()\n" + "    {\n" + "    }\n" + "}\n" + "}", "js2");
}
Also used : CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings)

Example 100 with CommonCodeStyleSettings

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

the class ActionScriptFormatterTest method testAlignOperations.

public void testAlignOperations() throws Exception {
    final CommonCodeStyleSettings styleSettings = getEcma4Settings();
    styleSettings.ALIGN_MULTILINE_EXTENDS_LIST = true;
    doTest("class _X extends X, \n Y implements Z,\n T {}", "class _X extends X,\n" + "                 Y implements Z,\n" + "                              T {\n" + "}", JavaScriptSupportLoader.ECMA_SCRIPT_L4_FILE_EXTENSION2);
}
Also used : 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