mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
When detecting tab usage set continuation indent size to doubled tab size (IDEA-141219)
This commit is contained in:
+25
@@ -71,4 +71,29 @@ public class DetectIndentAndTypeTest extends LightPlatformCodeInsightFixtureTest
|
||||
"\t}\n" +
|
||||
"}\n");
|
||||
}
|
||||
|
||||
public void testWhenTabsDetected_SetContinuationIndentSizeToDoubleTabSize() {
|
||||
CommonCodeStyleSettings common = mySettings.getCommonSettings(JavaLanguage.INSTANCE);
|
||||
CommonCodeStyleSettings.IndentOptions indentOptions = common.getIndentOptions();
|
||||
|
||||
assert indentOptions != null;
|
||||
|
||||
indentOptions.INDENT_SIZE = 1;
|
||||
indentOptions.TAB_SIZE = 2;
|
||||
indentOptions.CONTINUATION_INDENT_SIZE = 8;
|
||||
|
||||
myFixture.configureByText(JavaFileType.INSTANCE,
|
||||
"public class T {\n" +
|
||||
"\tvoid run() {\n" +
|
||||
"\t\tint a = 2 <caret>+ 2;\n" +
|
||||
"\t}\n" +
|
||||
"}\n");
|
||||
myFixture.type('\n');
|
||||
myFixture.checkResult("public class T {\n" +
|
||||
"\tvoid run() {\n" +
|
||||
"\t\tint a = 2 \n" +
|
||||
"\t\t\t\t<caret>+ 2;\n" +
|
||||
"\t}\n" +
|
||||
"}\n");
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -82,6 +82,7 @@ public class IndentOptionsDetectorImpl implements IndentOptionsDetector {
|
||||
if (linesWithTabs > linesWithWhiteSpaceIndent) {
|
||||
setUseTabs(indentOptions, true);
|
||||
indentOptions.INDENT_SIZE = indentOptions.TAB_SIZE;
|
||||
indentOptions.CONTINUATION_INDENT_SIZE = indentOptions.TAB_SIZE * 2;
|
||||
}
|
||||
else if (linesWithWhiteSpaceIndent > linesWithTabs) {
|
||||
setUseTabs(indentOptions, false);
|
||||
|
||||
Reference in New Issue
Block a user