use of com.intellij.psi.formatter.xml.XmlCodeStyleSettings in project intellij-plugins by JetBrains.
the class FlexOptimizeImportsTest method testAmbiguous3.
@JSTestOptions({ JSTestOption.WithJsSupportLoader, JSTestOption.WithFlexSdk })
public void testAmbiguous3() throws Throwable {
final CodeStyleSettings styleSettings = CodeStyleSettingsManager.getSettings(getProject());
XmlCodeStyleSettings xmlSettings = styleSettings.getCustomSettings(XmlCodeStyleSettings.class);
int aroundCDataBefore = xmlSettings.XML_WHITE_SPACE_AROUND_CDATA;
xmlSettings.XML_WHITE_SPACE_AROUND_CDATA = XmlCodeStyleSettings.WS_AROUND_CDATA_NEW_LINES;
JSTestUtils.addClassesToProject(myFixture, true, "com.a.ClassB", "com.b.ClassB");
runOptimizeAction(MXML_FILE_EXTENSION);
xmlSettings.XML_WHITE_SPACE_AROUND_CDATA = aroundCDataBefore;
}
use of com.intellij.psi.formatter.xml.XmlCodeStyleSettings 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;
}
use of com.intellij.psi.formatter.xml.XmlCodeStyleSettings in project intellij-plugins by JetBrains.
the class ActionScriptFormatterTest method testCdataDamaged.
public void testCdataDamaged() throws Exception {
final CodeStyleSettings styleSettings = CodeStyleSettingsManager.getSettings(getProject());
final XmlCodeStyleSettings xmlSettings = styleSettings.getCustomSettings(XmlCodeStyleSettings.class);
int before = styleSettings.getTabSize(StdFileTypes.XML);
int aroundCDataBefore = xmlSettings.XML_WHITE_SPACE_AROUND_CDATA;
try {
styleSettings.getIndentOptions(StdFileTypes.XML).TAB_SIZE = 4;
xmlSettings.XML_WHITE_SPACE_AROUND_CDATA = XmlCodeStyleSettings.WS_AROUND_CDATA_NEW_LINES;
myUseReformatText = true;
doTestFromFile("mxml");
} finally {
styleSettings.getIndentOptions(StdFileTypes.XML).TAB_SIZE = before;
xmlSettings.XML_WHITE_SPACE_AROUND_CDATA = aroundCDataBefore;
myUseReformatText = false;
}
}
use of com.intellij.psi.formatter.xml.XmlCodeStyleSettings in project intellij-community by JetBrains.
the class Xslt2RefactoringTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
final CodeStyleSettings settings = CodeStyleSettingsManager.getInstance(myFixture.getProject()).getCurrentSettings();
XmlCodeStyleSettings xmlSettings = settings.getCustomSettings(XmlCodeStyleSettings.class);
xmlSettings.XML_SPACE_INSIDE_EMPTY_TAG = true;
settings.getIndentOptions(StdFileTypes.XML).INDENT_SIZE = 2;
}
use of com.intellij.psi.formatter.xml.XmlCodeStyleSettings in project android by JetBrains.
the class AndroidXmlPredefinedCodeStyle method apply.
@Override
public void apply(CodeStyleSettings settings) {
final CommonCodeStyleSettings.IndentOptions indentOptions = settings.getIndentOptions(XmlFileType.INSTANCE);
indentOptions.CONTINUATION_INDENT_SIZE = indentOptions.INDENT_SIZE;
XmlCodeStyleSettings xmlSettings = settings.getCustomSettings(XmlCodeStyleSettings.class);
xmlSettings.XML_ALIGN_ATTRIBUTES = false;
xmlSettings.XML_SPACE_INSIDE_EMPTY_TAG = true;
xmlSettings.XML_KEEP_LINE_BREAKS = false;
final AndroidXmlCodeStyleSettings androidSettings = AndroidXmlCodeStyleSettings.getInstance(settings);
androidSettings.USE_CUSTOM_SETTINGS = true;
androidSettings.LAYOUT_SETTINGS = new AndroidXmlCodeStyleSettings.LayoutSettings();
androidSettings.MANIFEST_SETTINGS = new AndroidXmlCodeStyleSettings.ManifestSettings();
androidSettings.VALUE_RESOURCE_FILE_SETTINGS = new AndroidXmlCodeStyleSettings.ValueResourceFileSettings();
androidSettings.OTHER_SETTINGS = new AndroidXmlCodeStyleSettings.OtherSettings();
// arrangement
final List<StdArrangementMatchRule> rules = new ArrayList<StdArrangementMatchRule>();
rules.add(attrArrangementRule("xmlns:android", "^$", KEEP));
rules.add(attrArrangementRule("xmlns:.*", "^$", BY_NAME));
rules.add(attrArrangementRule(".*:id", SdkConstants.NS_RESOURCES, KEEP));
rules.add(attrArrangementRule(".*:name", SdkConstants.NS_RESOURCES, KEEP));
rules.add(attrArrangementRule("name", "^$", KEEP));
rules.add(attrArrangementRule("style", "^$", KEEP));
rules.add(attrArrangementRule(".*", "^$", BY_NAME));
rules.add(attrArrangementRule(".*:layout_width", SdkConstants.NS_RESOURCES, KEEP));
rules.add(attrArrangementRule(".*:layout_height", SdkConstants.NS_RESOURCES, KEEP));
rules.add(attrArrangementRule(".*:layout_.*", SdkConstants.NS_RESOURCES, BY_NAME));
rules.add(attrArrangementRule(".*:width", SdkConstants.NS_RESOURCES, BY_NAME));
rules.add(attrArrangementRule(".*:height", SdkConstants.NS_RESOURCES, BY_NAME));
rules.add(attrArrangementRule(".*", SdkConstants.NS_RESOURCES, BY_NAME));
rules.add(attrArrangementRule(".*", ".*", BY_NAME));
// TODO: Should sort name:"color",namespace:"" to the end (primarily for color state lists)
final CommonCodeStyleSettings xmlCommonSettings = settings.getCommonSettings(XMLLanguage.INSTANCE);
xmlCommonSettings.setArrangementSettings(StdArrangementSettings.createByMatchRules(ContainerUtil.<ArrangementGroupingRule>emptyList(), rules));
xmlCommonSettings.FORCE_REARRANGE_MODE = CommonCodeStyleSettings.REARRANGE_ALWAYS;
}
Aggregations