mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-79714 No code example for certain code style space changes
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,7 +18,6 @@ package com.intellij.ide;
|
||||
import com.intellij.application.options.IndentOptionsEditor;
|
||||
import com.intellij.application.options.JavaIndentOptionsEditor;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.lang.StdLanguages;
|
||||
import com.intellij.lang.java.JavaLanguage;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -41,7 +40,7 @@ public class JavaLanguageCodeStyleSettingsProvider extends LanguageCodeStyleSett
|
||||
@NotNull
|
||||
@Override
|
||||
public Language getLanguage() {
|
||||
return StdLanguages.JAVA;
|
||||
return JavaLanguage.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -185,6 +184,7 @@ public class JavaLanguageCodeStyleSettingsProvider extends LanguageCodeStyleSett
|
||||
|
||||
private static final String SPACING_SAMPLE =
|
||||
"@Annotation(param1 = \"value1\", param2 = \"value2\")\n" +
|
||||
"@SuppressWarnings({\"ALL\"})\n" +
|
||||
"public class Foo<T, U> {\n" +
|
||||
" int[] X = new int[]{1, 3, 5, 6, 7, 87, 1213, 2};\n" +
|
||||
"\n" +
|
||||
@@ -193,7 +193,7 @@ public class JavaLanguageCodeStyleSettingsProvider extends LanguageCodeStyleSett
|
||||
" y += (y ^ 0x123) << 2;\n" +
|
||||
" }\n" +
|
||||
" do {\n" +
|
||||
" try (MyResource r1 = getResource(); MyResource r2 = null) {\n" +
|
||||
" try(MyResource r1 = getResource(); MyResource r2 = null) {\n" +
|
||||
" if (0 < x && x < 10) {\n" +
|
||||
" while (x != y) {\n" +
|
||||
" x = f(x * 3 + 5);\n" +
|
||||
@@ -217,7 +217,8 @@ public class JavaLanguageCodeStyleSettingsProvider extends LanguageCodeStyleSett
|
||||
" while (true);\n" +
|
||||
" }\n" +
|
||||
" void bar(){{return;}}\n" +
|
||||
"}";
|
||||
"}\n" +
|
||||
"class Bar {}";
|
||||
|
||||
private static final String WRAPPING_CODE_SAMPLE =
|
||||
"/*\n" +
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -644,8 +644,7 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
|
||||
mySettings.BRACE_STYLE, null, mySettings.KEEP_SIMPLE_BLOCKS_IN_ONE_LINE, true);
|
||||
}
|
||||
else if (myType2 == JavaElementType.RESOURCE_LIST) {
|
||||
myResult = getSpaceBeforeLBrace(mySettings.SPACE_BEFORE_TRY_PARENTHESES,
|
||||
mySettings.BRACE_STYLE, null, mySettings.KEEP_SIMPLE_BLOCKS_IN_ONE_LINE, true);
|
||||
createSpaceInCode(mySettings.SPACE_BEFORE_TRY_PARENTHESES);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -880,7 +879,8 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
|
||||
return createNonLFSpace(space, null, false);
|
||||
}
|
||||
else if (braceStyle == CommonCodeStyleSettings.NEXT_LINE && !mySettings.KEEP_SIMPLE_METHODS_IN_ONE_LINE) {
|
||||
return Spacing.createSpacing(0, 0, keepOneLine ? 0 : 1, false, mySettings.KEEP_BLANK_LINES_IN_CODE);
|
||||
space = (keepOneLine && spaceBeforeLbrace) ? 1 : 0;
|
||||
return Spacing.createSpacing(space, 0, keepOneLine ? 0 : 1, false, mySettings.KEEP_BLANK_LINES_IN_CODE);
|
||||
}
|
||||
else if (keepOneLine) {
|
||||
TextRange dependencyRangeToUse = dependantRange == null || useParentBlockAsDependencyAllTheTime
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package com.intellij.psi.formatter.java;
|
||||
|
||||
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
|
||||
|
||||
/**
|
||||
* Is intended to hold specific java formatting tests for 'spacing' settings.
|
||||
*
|
||||
@@ -301,6 +303,7 @@ public class JavaFormatterSpaceTest extends AbstractJavaFormatterTest {
|
||||
|
||||
public void testSpacesBeforeResourceList() throws Exception {
|
||||
getSettings().KEEP_SIMPLE_BLOCKS_IN_ONE_LINE = true;
|
||||
getSettings().BRACE_STYLE = CommonCodeStyleSettings.NEXT_LINE;
|
||||
|
||||
getSettings().SPACE_BEFORE_TRY_PARENTHESES = true;
|
||||
getSettings().SPACE_BEFORE_TRY_LBRACE = true;
|
||||
|
||||
Reference in New Issue
Block a user