mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-103320 Android/XML code style: add "Insert line break after last attribute" option
This commit is contained in:
@@ -93,6 +93,11 @@ public class HtmlPolicy extends XmlFormattingPolicy {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insertLineBreakAfterLastAttribute(XmlAttribute attribute) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insertLineBreakAfterTagBegin(XmlTag tag) {
|
||||
return false;
|
||||
|
||||
@@ -96,6 +96,16 @@ public class SyntheticBlock extends AbstractSyntheticBlock implements Block, Rea
|
||||
return Spacing.createSafeSpacing(myXmlFormattingPolicy.getShouldKeepLineBreaks(), myXmlFormattingPolicy.getKeepBlankLines());
|
||||
}
|
||||
|
||||
if (type1 == XmlElementType.XML_ATTRIBUTE && (type2 == XmlTokenType.XML_TAG_END || type2 == XmlTokenType.XML_EMPTY_ELEMENT_END)) {
|
||||
final PsiElement psi1 = node1.getPsi();
|
||||
|
||||
if (psi1 instanceof XmlAttribute && myXmlFormattingPolicy.insertLineBreakAfterLastAttribute((XmlAttribute)psi1)) {
|
||||
return Spacing.createSpacing(0, 0, 1,
|
||||
myXmlFormattingPolicy.getShouldKeepLineBreaks(),
|
||||
myXmlFormattingPolicy.getKeepBlankLines());
|
||||
}
|
||||
}
|
||||
|
||||
if (type2 == XmlElementType.XML_EMPTY_ELEMENT_END && myXmlFormattingPolicy.addSpaceIntoEmptyTag()) {
|
||||
return Spacing.createSpacing(1, 1, 0,
|
||||
myXmlFormattingPolicy.getShouldKeepLineBreaks(),
|
||||
|
||||
@@ -90,6 +90,8 @@ public abstract class XmlFormattingPolicy {
|
||||
|
||||
public abstract boolean insertLineBreakBeforeFirstAttribute(XmlAttribute attribute);
|
||||
|
||||
public abstract boolean insertLineBreakAfterLastAttribute(XmlAttribute attribute);
|
||||
|
||||
public abstract boolean insertLineBreakAfterTagBegin(XmlTag tag);
|
||||
|
||||
public abstract boolean removeLineBreakBeforeTag(XmlTag xmlTag);
|
||||
|
||||
@@ -48,6 +48,11 @@ public class XmlPolicy extends XmlFormattingPolicy{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insertLineBreakAfterLastAttribute(XmlAttribute attribute) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insertLineBreakAfterTagBegin(XmlTag tag) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user