Search in sources :

Example 51 with CodeStyleSettings

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

the class OverrideImplementsAnnotationsHandlerImpl method getAnnotations.

@Override
public String[] getAnnotations(Project project) {
    final NullableNotNullManager manager = NullableNotNullManager.getInstance(project);
    final Collection<String> anns = new ArrayList<>(manager.getNotNulls());
    anns.addAll(manager.getNullables());
    anns.add(AnnotationUtil.NLS);
    final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(project);
    anns.addAll(settings.getRepeatAnnotations());
    return ArrayUtil.toStringArray(anns);
}
Also used : CodeStyleSettings(com.intellij.psi.codeStyle.CodeStyleSettings) NullableNotNullManager(com.intellij.codeInsight.NullableNotNullManager) ArrayList(java.util.ArrayList)

Example 52 with CodeStyleSettings

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

the class BindToGenericClassTest method tearDown.

@Override
protected void tearDown() throws Exception {
    final CodeStyleSettings currentSettings = CodeStyleSettingsManager.getInstance(myProject).getCurrentSettings();
    currentSettings.USE_FQ_CLASS_NAMES = myOldFQNamesSetting;
    super.tearDown();
}
Also used : CodeStyleSettings(com.intellij.psi.codeStyle.CodeStyleSettings)

Example 53 with CodeStyleSettings

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

the class BindToGenericClassTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    setupGenericSampleClasses();
    final CodeStyleSettings currentSettings = CodeStyleSettingsManager.getInstance(myProject).getCurrentSettings();
    myOldFQNamesSetting = currentSettings.USE_FQ_CLASS_NAMES;
    currentSettings.USE_FQ_CLASS_NAMES = true;
}
Also used : CodeStyleSettings(com.intellij.psi.codeStyle.CodeStyleSettings)

Example 54 with CodeStyleSettings

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

the class JavaFormatterPerformanceTest method testPerformance2.

public void testPerformance2() throws Exception {
    final CodeStyleSettings settings = getSettings();
    settings.setDefaultRightMargin(120);
    PlatformTestUtil.startPerformanceTest(getTestName(false), 4000, () -> {
        try {
            doTest();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }).cpuBound().useLegacyScaling().assertTiming();
}
Also used : CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings) CodeStyleSettings(com.intellij.psi.codeStyle.CodeStyleSettings)

Example 55 with CodeStyleSettings

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

the class JavaFormatterPerformanceTest method testPerformance.

public void testPerformance() throws Exception {
    final String name = getTestName(true) + ".java";
    final String text = loadFile(name);
    final PsiFile file = LightPlatformTestCase.createFile(name, text);
    transformAllChildren(SourceTreeToPsiMap.psiElementToTree(file));
    final CodeStyleSettings settings = new CodeStyleSettings();
    PlatformTestUtil.startPerformanceTest("java formatting", 1000, () -> {
        final FormattingModel model = LanguageFormatting.INSTANCE.forContext(file).createModel(file, settings);
        ((FormatterImpl) FormatterEx.getInstanceEx()).formatWithoutModifications(model.getDocumentModel(), model.getRootBlock(), settings, settings.getIndentOptions(StdFileTypes.JAVA), file.getTextRange());
    }).cpuBound().useLegacyScaling().assertTiming();
}
Also used : FormattingModel(com.intellij.formatting.FormattingModel) CommonCodeStyleSettings(com.intellij.psi.codeStyle.CommonCodeStyleSettings) CodeStyleSettings(com.intellij.psi.codeStyle.CodeStyleSettings) PsiFile(com.intellij.psi.PsiFile)

Aggregations

CodeStyleSettings (com.intellij.psi.codeStyle.CodeStyleSettings)190 CommonCodeStyleSettings (com.intellij.psi.codeStyle.CommonCodeStyleSettings)84 Project (com.intellij.openapi.project.Project)12 XmlCodeStyleSettings (com.intellij.psi.formatter.xml.XmlCodeStyleSettings)12 ECMA4CodeStyleSettings (com.intellij.lang.javascript.formatter.ECMA4CodeStyleSettings)9 JSCodeStyleSettings (com.intellij.lang.javascript.formatter.JSCodeStyleSettings)9 Document (com.intellij.openapi.editor.Document)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 FormattingModelBuilder (com.intellij.formatting.FormattingModelBuilder)3 ASTNode (com.intellij.lang.ASTNode)3 Language (com.intellij.lang.Language)3 JSTestOptions (com.intellij.lang.javascript.JSTestOptions)3