use of com.intellij.psi.codeStyle.CodeStyleSettings in project intellij-community by JetBrains.
the class JavaFormatterTest method testCommentAfterDeclaration.
public void testCommentAfterDeclaration() throws Exception {
CodeStyleSettings codeStyleSettings = CodeStyleSettingsManager.getSettings(getProject());
CommonCodeStyleSettings javaSettings = codeStyleSettings.getCommonSettings(JavaLanguage.INSTANCE);
int oldMargin = codeStyleSettings.getDefaultRightMargin();
int oldWrap = javaSettings.ASSIGNMENT_WRAP;
try {
codeStyleSettings.setDefaultRightMargin(20);
javaSettings.ASSIGNMENT_WRAP = CommonCodeStyleSettings.WRAP_AS_NEEDED;
doMethodTest("int i=0; //comment comment", "int i =\n" + " 0; //comment comment");
} finally {
codeStyleSettings.setDefaultRightMargin(oldMargin);
javaSettings.ASSIGNMENT_WRAP = oldWrap;
}
}
use of com.intellij.psi.codeStyle.CodeStyleSettings in project intellij-community by JetBrains.
the class JavaFormatterTest method testFormatterOnOffTagsWithRegexp.
public void testFormatterOnOffTagsWithRegexp() throws Exception {
CodeStyleSettings settings = getSettings().getRootSettings();
settings.FORMATTER_TAGS_ENABLED = true;
settings.FORMATTER_TAGS_ACCEPT_REGEXP = true;
settings.FORMATTER_OFF_TAG = "not.*format";
settings.FORMATTER_ON_TAG = "end.*fragment";
doTest();
}
use of com.intellij.psi.codeStyle.CodeStyleSettings in project intellij-plugins by JetBrains.
the class HbFormatterIndentTest method testFormattingInsideDoNotIndentElems1.
public void testFormattingInsideDoNotIndentElems1() {
CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
settings.HTML_DO_NOT_INDENT_CHILDREN_OF = "body";
doStringBasedTest("<body>\n" + "{{#foo}}\n" + "<div></div>\n" + "{{/foo}}\n" + "</body>", "<body>\n" + "{{#foo}}\n" + " <div></div>\n" + "{{/foo}}\n" + "</body>");
}
use of com.intellij.psi.codeStyle.CodeStyleSettings 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;
}
use of com.intellij.psi.codeStyle.CodeStyleSettings in project intellij-plugins by JetBrains.
the class ActionScriptFormatterTest method testCDATAFormattingOptions1.
public void testCDATAFormattingOptions1() throws Exception {
final CodeStyleSettings settings = CodeStyleSettingsManager.getInstance(getProject()).getCurrentSettings();
final XmlCodeStyleSettings xmlSettings = settings.getCustomSettings(XmlCodeStyleSettings.class);
int currCDATAWhitespace = xmlSettings.XML_WHITE_SPACE_AROUND_CDATA;
xmlSettings.XML_WHITE_SPACE_AROUND_CDATA = XmlCodeStyleSettings.WS_AROUND_CDATA_NEW_LINES;
doTestFromFile("mxml");
xmlSettings.XML_WHITE_SPACE_AROUND_CDATA = currCDATAWhitespace;
}
Aggregations