mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 15:27:45 +07:00
(IDEA-147380) Change indent size and continuation indent size only if tab usage detected and use tabs was switched off
This commit is contained in:
+24
@@ -17,11 +17,14 @@ package com.intellij.psi.codeStyle.autodetect;
|
||||
|
||||
import com.intellij.ide.highlighter.JavaFileType;
|
||||
import com.intellij.lang.java.JavaLanguage;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
|
||||
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
|
||||
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
|
||||
|
||||
import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat;
|
||||
|
||||
public class DetectIndentAndTypeTest extends LightPlatformCodeInsightFixtureTestCase {
|
||||
|
||||
private CodeStyleSettings mySettings;
|
||||
@@ -146,4 +149,25 @@ public class DetectIndentAndTypeTest extends LightPlatformCodeInsightFixtureTest
|
||||
"\t}\n" +
|
||||
"}\n");
|
||||
}
|
||||
|
||||
public void testDoNotIndentOptions_WhenTabsDetected_AndUseTabsWasSetByDefault() {
|
||||
CommonCodeStyleSettings common = mySettings.getCommonSettings(JavaLanguage.INSTANCE);
|
||||
CommonCodeStyleSettings.IndentOptions indentOptions = common.getIndentOptions();
|
||||
|
||||
assert indentOptions != null;
|
||||
|
||||
indentOptions.USE_TAB_CHARACTER = true;
|
||||
|
||||
indentOptions.TAB_SIZE = 8;
|
||||
indentOptions.INDENT_SIZE = 4;
|
||||
indentOptions.CONTINUATION_INDENT_SIZE = 8;
|
||||
|
||||
myFixture.configureByText(JavaFileType.INSTANCE, myText);
|
||||
PsiFile file = myFixture.getFile();
|
||||
CommonCodeStyleSettings.IndentOptions options = mySettings.getIndentOptionsByFile(file);
|
||||
|
||||
assertThat(options.INDENT_SIZE).isEqualTo(4);
|
||||
assertThat(indentOptions.CONTINUATION_INDENT_SIZE).isEqualTo(8);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user