mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-90595 Android Designer: remove collapse for style attributes
#IDEA-90595 fixed
This commit is contained in:
@@ -335,7 +335,7 @@ checkbox.caret.blinking.ms=Caret blinking (ms):
|
||||
checkbox.mark.modified.tabs.with.asterisk=Mark modified tabs with asterisk
|
||||
group.code.folding=Code Folding
|
||||
checkbox.collapse.xml.tags=XML tags
|
||||
checkbox.collapse.xml.attributes=XML 'style' attribute
|
||||
checkbox.collapse.html.style.attribute=HTML 'style' attribute
|
||||
checkbox.collapse.anonymous.classes=<html>Anonymous classes</html>
|
||||
checkbox.collapse.closures=<html>"Closures" (anonymous classes implementing one method)</html>
|
||||
checkbox.collapse.generic.constructor.parameters=<html>Generic constructor and method parameters</html>
|
||||
|
||||
+1
-1
@@ -27,6 +27,6 @@ public class XmlCodeFoldingOptionsProvider extends BeanConfigurable<XmlFoldingSe
|
||||
public XmlCodeFoldingOptionsProvider() {
|
||||
super(XmlFoldingSettings.getInstance());
|
||||
checkBox("COLLAPSE_XML_TAGS", ApplicationBundle.message("checkbox.collapse.xml.tags"));
|
||||
checkBox("COLLAPSE_XML_ATTRIBUTES", ApplicationBundle.message("checkbox.collapse.xml.attributes"));
|
||||
checkBox("COLLAPSE_HTML_STYLE_ATTRIBUTE", ApplicationBundle.message("checkbox.collapse.html.style.attribute"));
|
||||
}
|
||||
}
|
||||
@@ -46,16 +46,16 @@ public class XmlFoldingSettings implements PersistentStateComponent<XmlFoldingSe
|
||||
COLLAPSE_XML_TAGS = value;
|
||||
}
|
||||
|
||||
public boolean isCollapseXmlAttributes() {
|
||||
return COLLAPSE_XML_ATTRIBUTES;
|
||||
public boolean isCollapseHtmlStyleAttribute() {
|
||||
return COLLAPSE_HTML_STYLE_ATTRIBUTE;
|
||||
}
|
||||
|
||||
public void setCollapseStyleAttribute(boolean value) {
|
||||
this.COLLAPSE_XML_ATTRIBUTES = value;
|
||||
public void setCollapseHtmlStyleAttribute(boolean value) {
|
||||
this.COLLAPSE_HTML_STYLE_ATTRIBUTE = value;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"WeakerAccess"}) public boolean COLLAPSE_XML_TAGS = false;
|
||||
@SuppressWarnings({"WeakerAccess"}) public boolean COLLAPSE_XML_ATTRIBUTES = true;
|
||||
@SuppressWarnings({"WeakerAccess"}) public boolean COLLAPSE_HTML_STYLE_ATTRIBUTE = true;
|
||||
|
||||
@NotNull
|
||||
public File[] getExportFiles() {
|
||||
|
||||
@@ -28,9 +28,9 @@ import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiWhiteSpace;
|
||||
import com.intellij.psi.impl.source.html.HtmlFileImpl;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
import com.intellij.psi.xml.*;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.xml.util.XmlTagUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -45,8 +45,8 @@ import java.util.List;
|
||||
public class XmlFoldingBuilder implements FoldingBuilder, DumbAware {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.lang.xml.XmlFoldingBuilder");
|
||||
private static final TokenSet XML_ATTRIBUTE_SET = TokenSet.create(XmlElementType.XML_ATTRIBUTE);
|
||||
private static final String[] XML_FOLDING_ATTRIBUTE_NAMES = new String[] {"style"};
|
||||
private static final int MIN_TEXT_RANGE_LENGTH = 3;
|
||||
private static final String STYLE_ATTRIBUTE = "style";
|
||||
|
||||
@NotNull
|
||||
public FoldingDescriptor[] buildFoldRegions(@NotNull ASTNode node, @NotNull Document document) {
|
||||
@@ -233,10 +233,11 @@ public class XmlFoldingBuilder implements FoldingBuilder, DumbAware {
|
||||
final PsiElement psi = node.getPsi();
|
||||
final XmlFoldingSettings foldingSettings = XmlFoldingSettings.getInstance();
|
||||
return (psi instanceof XmlTag && foldingSettings.isCollapseXmlTags())
|
||||
|| (psi instanceof XmlAttribute && foldingSettings.isCollapseXmlAttributes());
|
||||
|| (psi instanceof XmlAttribute && foldingSettings.isCollapseHtmlStyleAttribute());
|
||||
}
|
||||
|
||||
private static boolean isAttributeShouldBeFolded(XmlAttribute child) {
|
||||
return ArrayUtil.contains(((XmlAttribute)child).getName(), XML_FOLDING_ATTRIBUTE_NAMES);
|
||||
return child.getContainingFile() instanceof HtmlFileImpl &&
|
||||
STYLE_ATTRIBUTE.equalsIgnoreCase(((XmlAttribute)child).getName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ public class XmlFoldingTest extends LightPlatformCodeInsightFixtureTestCase {
|
||||
public void testTagFolding() throws Throwable { doTest(); }
|
||||
|
||||
public void testStyleAttributeFolding() throws Throwable { doTest(); }
|
||||
public void testStyleAttributeFolding2() throws Throwable { doTest(".xml"); }
|
||||
|
||||
|
||||
|
||||
@@ -39,7 +40,11 @@ public class XmlFoldingTest extends LightPlatformCodeInsightFixtureTestCase {
|
||||
}
|
||||
|
||||
private void doTest() throws Throwable {
|
||||
myFixture.testFolding(getTestDataPath() + getTestName(true) + ".html");
|
||||
doTest(".html");
|
||||
}
|
||||
|
||||
private void doTest(String extension) throws Throwable {
|
||||
myFixture.testFolding(getTestDataPath() + getTestName(true) + extension);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<body class="c1" id="#seriou" style="border: 1px solid black"<fold text='...'>>
|
||||
<strong style="color: rgb(51,51,51);"/>
|
||||
</body</fold>>
|
||||
Reference in New Issue
Block a user