Search in sources :

Example 21 with CodeStyleSettings

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

the class FormatterTestCase method defaultSettings.

protected void defaultSettings() {
    CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
    settings.ALIGN_MULTILINE_PARAMETERS = true;
    settings.ALIGN_MULTILINE_PARAMETERS_IN_CALLS = false;
    settings.ALIGN_MULTILINE_FOR = true;
    settings.ALIGN_MULTILINE_BINARY_OPERATION = false;
    settings.ALIGN_MULTILINE_TERNARY_OPERATION = false;
    settings.ALIGN_MULTILINE_THROWS_LIST = false;
    settings.ALIGN_MULTILINE_EXTENDS_LIST = false;
    settings.ALIGN_MULTILINE_PARENTHESIZED_EXPRESSION = false;
    settings.DO_NOT_INDENT_TOP_LEVEL_CLASS_MEMBERS = false;
    getSettings().SPACE_BEFORE_ANOTATION_PARAMETER_LIST = false;
    getSettings().SPACE_AROUND_ASSIGNMENT_OPERATORS = true;
    getSettings().SPACE_WITHIN_ANNOTATION_PARENTHESES = false;
    getSettings().SPACE_AROUND_ASSIGNMENT_OPERATORS = true;
}
Also used : CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings) CodeStyleSettings(com.intellij.psi.codeStyle.CodeStyleSettings)

Example 22 with CodeStyleSettings

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

the class PlatformTestCase method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    File tempDir = new File(FileUtilRt.getTempDirectory());
    myFilesToDelete.add(tempDir);
    if (ourTestCase != null) {
        String message = "Previous test " + ourTestCase + " hasn't called tearDown(). Probably overridden without super call.";
        ourTestCase = null;
        fail(message);
    }
    IdeaLogger.ourErrorsOccurred = null;
    LOG.debug(getClass().getName() + ".setUp()");
    initApplication();
    myEditorListenerTracker = new EditorListenerTracker();
    myThreadTracker = new ThreadTracker();
    setUpProject();
    storeSettings();
    ourTestCase = this;
    if (myProject != null) {
        ProjectManagerEx.getInstanceEx().openTestProject(myProject);
        CodeStyleSettingsManager.getInstance(myProject).setTemporarySettings(new CodeStyleSettings());
        InjectedLanguageManagerImpl.pushInjectors(getProject());
    }
    DocumentCommitThread.getInstance().clearQueue();
    UIUtil.dispatchAllInvocationEvents();
}
Also used : CodeStyleSettings(com.intellij.psi.codeStyle.CodeStyleSettings) VirtualFile(com.intellij.openapi.vfs.VirtualFile) PsiFile(com.intellij.psi.PsiFile) File(java.io.File)

Example 23 with CodeStyleSettings

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

the class OverrideImplement15Test method testLongFinalParameterList.

public void testLongFinalParameterList() {
    CodeStyleSettings codeStyleSettings = CodeStyleSettingsManager.getSettings(getProject()).clone();
    try {
        CommonCodeStyleSettings javaSettings = codeStyleSettings.getCommonSettings(JavaLanguage.INSTANCE);
        javaSettings.RIGHT_MARGIN = 80;
        javaSettings.KEEP_LINE_BREAKS = true;
        codeStyleSettings.GENERATE_FINAL_PARAMETERS = true;
        javaSettings.METHOD_PARAMETERS_WRAP = CommonCodeStyleSettings.WRAP_ON_EVERY_ITEM;
        CodeStyleSettingsManager.getInstance(getProject()).setTemporarySettings(codeStyleSettings);
        doTest(false);
    } finally {
        CodeStyleSettingsManager.getInstance(getProject()).dropTemporarySettings();
    }
}
Also used : CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings) CodeStyleSettings(com.intellij.psi.codeStyle.CodeStyleSettings) CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings)

Example 24 with CodeStyleSettings

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

the class JavaReformatOnTypingTest method useSpacesAroundAssignmentOperator.

private static void useSpacesAroundAssignmentOperator(boolean value, Project project, Language language) {
    CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(project);
    CommonCodeStyleSettings common = settings.getCommonSettings(language);
    common.SPACE_AROUND_ASSIGNMENT_OPERATORS = value;
}
Also used : CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings) CodeStyleSettings(com.intellij.psi.codeStyle.CodeStyleSettings) CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings)

Example 25 with CodeStyleSettings

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

the class JoinLinesTest method testSubsequentJoiningAndUnexpectedTextRemoval.

public void testSubsequentJoiningAndUnexpectedTextRemoval() throws Exception {
    // Inspired by IDEA-65342
    CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
    settings.setDefaultRightMargin(50);
    settings.getCommonSettings(JavaLanguage.INSTANCE).CALL_PARAMETERS_WRAP = CommonCodeStyleSettings.WRAP_AS_NEEDED;
    doTest(2);
}
Also used : CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings) CodeStyleSettings(com.intellij.psi.codeStyle.CodeStyleSettings)

Aggregations

CodeStyleSettings (com.intellij.psi.codeStyle.CodeStyleSettings)194 CommonCodeStyleSettings (com.intellij.psi.codeStyle.CommonCodeStyleSettings)85 Project (com.intellij.openapi.project.Project)13 XmlCodeStyleSettings (com.intellij.psi.formatter.xml.XmlCodeStyleSettings)12 Document (com.intellij.openapi.editor.Document)10 ECMA4CodeStyleSettings (com.intellij.lang.javascript.formatter.ECMA4CodeStyleSettings)9 JSCodeStyleSettings (com.intellij.lang.javascript.formatter.JSCodeStyleSettings)9 JavaCodeStyleSettings (com.intellij.psi.codeStyle.JavaCodeStyleSettings)9 NotNull (org.jetbrains.annotations.NotNull)9 VirtualFile (com.intellij.openapi.vfs.VirtualFile)8 PsiFile (com.intellij.psi.PsiFile)5 Nullable (org.jetbrains.annotations.Nullable)5 FormattingModel (com.intellij.formatting.FormattingModel)4 PsiElement (com.intellij.psi.PsiElement)4 CodeStyleSettingsManager (com.intellij.psi.codeStyle.CodeStyleSettingsManager)4 File (java.io.File)4 IOException (java.io.IOException)4 CodeStyleAbstractConfigurable (com.intellij.application.options.CodeStyleAbstractConfigurable)3 TabbedLanguageCodeStylePanel (com.intellij.application.options.TabbedLanguageCodeStylePanel)3 FormattingModelBuilder (com.intellij.formatting.FormattingModelBuilder)3