use of com.intellij.lang.javascript.formatter.JSCodeStyleSettings in project intellij-plugins by JetBrains.
the class FlexEditorTest method testInsertBraceOnEnter.
public void testInsertBraceOnEnter() throws Exception {
_testInsertBraceOnEnter("", "js2");
_testInsertBraceOnEnter("2", "js2");
final JSCodeStyleSettings codeSettings = CodeStyleSettingsManager.getSettings(getProject()).getCustomSettings(ECMA4CodeStyleSettings.class);
try {
codeSettings.INDENT_PACKAGE_CHILDREN = JSCodeStyleSettings.INDENT;
_testInsertBraceOnEnter("3", "js2");
} finally {
codeSettings.INDENT_PACKAGE_CHILDREN = JSCodeStyleSettings.DO_NOT_INDENT;
}
}
use of com.intellij.lang.javascript.formatter.JSCodeStyleSettings in project intellij-plugins by JetBrains.
the class AngularTypedHandlerTest method testInsertWhitespace.
public void testInsertWhitespace() {
myFixture.configureByText(HtmlFileType.INSTANCE, "{<caret>");
JSCodeStyleSettings settings = JSCodeStyleSettings.getSettings(myFixture.getFile());
boolean oldWhitespace = settings.SPACES_WITHIN_INTERPOLATION_EXPRESSIONS;
try {
settings.SPACES_WITHIN_INTERPOLATION_EXPRESSIONS = true;
myFixture.type("{");
myFixture.checkResult("{{ <caret> }}");
} finally {
settings.SPACES_WITHIN_INTERPOLATION_EXPRESSIONS = oldWhitespace;
}
}
use of com.intellij.lang.javascript.formatter.JSCodeStyleSettings in project intellij-plugins by JetBrains.
the class FlexOptimizeImportsTest method testNoSemicolons.
@JSTestOptions({ JSTestOption.WithJsSupportLoader, JSTestOption.WithFlexSdk })
public void testNoSemicolons() throws Throwable {
JSTestUtils.addClassesToProject(myFixture, true, "foo.MyClass", "foo.MyClass2", "bar.MyClass3");
final JSCodeStyleSettings codeStyleSettings = CodeStyleSettingsManager.getInstance(myFixture.getProject()).getCurrentSettings().getCustomSettings(ECMA4CodeStyleSettings.class);
boolean b = codeStyleSettings.USE_SEMICOLON_AFTER_STATEMENT;
codeStyleSettings.USE_SEMICOLON_AFTER_STATEMENT = false;
try {
runOptimizeAction(AS_FILE_EXTENSION);
} finally {
codeStyleSettings.USE_SEMICOLON_AFTER_STATEMENT = b;
}
}
use of com.intellij.lang.javascript.formatter.JSCodeStyleSettings in project intellij-plugins by JetBrains.
the class ActionScriptFormatterTest method testSpaceNearType.
public void testSpaceNearType() throws Exception {
doFileTest("");
JSCodeStyleSettings styleSettings = CodeStyleSettingsManager.getSettings(getProject()).getCustomSettings(ECMA4CodeStyleSettings.class);
try {
styleSettings.SPACE_BEFORE_TYPE_COLON = true;
styleSettings.SPACE_AFTER_TYPE_COLON = true;
doFileTest("_2");
styleSettings.SPACE_BEFORE_TYPE_COLON = false;
styleSettings.SPACE_AFTER_TYPE_COLON = true;
doFileTest("_3");
} finally {
styleSettings.SPACE_BEFORE_TYPE_COLON = false;
styleSettings.SPACE_AFTER_TYPE_COLON = false;
}
}
use of com.intellij.lang.javascript.formatter.JSCodeStyleSettings in project intellij-plugins by JetBrains.
the class ActionScriptFormatterTest method testSpaceBeforeTypeColon.
public void testSpaceBeforeTypeColon() throws Exception {
final CodeStyleSettings settings = CodeStyleSettingsManager.getInstance(getProject()).getCurrentSettings();
final JSCodeStyleSettings jsSettings = settings.getCustomSettings(ECMA4CodeStyleSettings.class);
boolean spaceBeforeTypeColon = jsSettings.SPACE_BEFORE_TYPE_COLON;
boolean spaceAfterTypeColon = jsSettings.SPACE_AFTER_TYPE_COLON;
jsSettings.SPACE_BEFORE_TYPE_COLON = true;
jsSettings.SPACE_AFTER_TYPE_COLON = false;
doTest("package aaa {\n" + "class XXX {\n" + " private var _field:int;\n" + " function get field():int {\n" + " return _field;\n" + " }\n" + "\n" + " function set field(val:int):void {\n" + " varName = val;\n" + " }\n" + "}", "package aaa {\n" + "class XXX {\n" + " private var _field :int;\n" + " function get field() :int {\n" + " return _field;\n" + " }\n" + "\n" + " function set field(val :int) :void {\n" + " varName = val;\n" + " }\n" + "}", ".as");
jsSettings.SPACE_BEFORE_TYPE_COLON = spaceBeforeTypeColon;
jsSettings.SPACE_AFTER_TYPE_COLON = spaceAfterTypeColon;
}
Aggregations