From c686c7ffdd9354365680ea6b96d5cea8a3fa76fd Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Thu, 25 Dec 2014 16:29:46 +0300 Subject: [PATCH 01/37] diff: speedup shoene separator painting approximate number of painted lines is EDITOR_WIDTH / 2 for each separator --- .../highlighting/FragmentBoundRenderer.java | 39 ++++++++++++------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/highlighting/FragmentBoundRenderer.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/highlighting/FragmentBoundRenderer.java index b179b7d4dd0a..f2ac5b7545cc 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/highlighting/FragmentBoundRenderer.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/highlighting/FragmentBoundRenderer.java @@ -155,25 +155,36 @@ public class FragmentBoundRenderer implements LineMarkerRenderer, LineSeparatorR final boolean mirrorX, final int mirrorSize) { final Iterator> iterator = points.iterator(); assert iterator.hasNext(); - final Convertor c = new Convertor() { - @Override - public Integer convert(Integer o) { - final int val = x1 + o - subtractX; - if (mirrorX) { - return mirrorSize - val; - } - return val; - } - }; + + int[] xPoints = new int[points.size()]; + int[] yPoints1 = new int[points.size()]; + int[] yPoints2 = new int[points.size()]; + int n = 0; + Couple previous = iterator.next(); while (iterator.hasNext()) { final Couple next = iterator.next(); - UIUtil.drawLine(g, c.convert(previous.getFirst()), y + offset + previous.getSecond() - myLineHeight/2, c.convert(next.getFirst()), - y + offset + next.getSecond() - myLineHeight/2); - UIUtil.drawLine(g, c.convert(previous.getFirst()), y - offset + previous.getSecond() - myLineHeight/2, c.convert(next.getFirst()), - y - offset + next.getSecond() - myLineHeight/2); + + xPoints[n] = convert(previous.getFirst(), x1, subtractX, mirrorX, mirrorSize); + yPoints1[n] = y + offset + previous.getSecond() - myLineHeight / 2; + yPoints2[n] = y - offset + previous.getSecond() - myLineHeight / 2; + n++; previous = next; } + xPoints[n] = convert(previous.getFirst(), x1, subtractX, mirrorX, mirrorSize); + yPoints1[n] = y + offset + previous.getSecond() - myLineHeight / 2; + yPoints2[n] = y - offset + previous.getSecond() - myLineHeight / 2; + + g.drawPolyline(xPoints, yPoints1, points.size()); + g.drawPolyline(xPoints, yPoints2, points.size()); + } + + private static int convert(int value, int x1, int subtractX, boolean mirrorX, int mirrorSize) { + final int val = x1 + value - subtractX; + if (mirrorX) { + return mirrorSize - val; + } + return val; } private static class ShoeneLine { From e334fc5790e9f53e8ca51780bb960f62c89f08be Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Wed, 24 Dec 2014 18:03:40 +0100 Subject: [PATCH 02/37] SSR: one search target is enough for predefined template "implementors of interface (within hierarchy)" --- .../intellij/structuralsearch/JavaPredefinedConfigurations.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/structuralsearch-java/src/com/intellij/structuralsearch/JavaPredefinedConfigurations.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/JavaPredefinedConfigurations.java index a82c941c0fa2..887cf4bdee82 100644 --- a/java/structuralsearch-java/src/com/intellij/structuralsearch/JavaPredefinedConfigurations.java +++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/JavaPredefinedConfigurations.java @@ -90,7 +90,7 @@ class JavaPredefinedConfigurations { ), createSearchTemplateInfo( SSRBundle.message("predefined.configuration.implementors.of.interface.within.hierarchy"), - "class 'Class implements 'Interface:* {}", + "class 'Class implements '_Interface:* {}", CLASS_TYPE ), createSearchTemplateInfo( From 58cff5600bbe4d1168edcb11372ec8b4ff1743d1 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Thu, 25 Dec 2014 11:43:43 +0100 Subject: [PATCH 03/37] SSR: existing template for diamond operators --- .../intellij/structuralsearch/JavaPredefinedConfigurations.java | 1 + platform/structuralsearch/source/messages/SSRBundle.properties | 1 + 2 files changed, 2 insertions(+) diff --git a/java/structuralsearch-java/src/com/intellij/structuralsearch/JavaPredefinedConfigurations.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/JavaPredefinedConfigurations.java index 887cf4bdee82..d331ab45d37c 100644 --- a/java/structuralsearch-java/src/com/intellij/structuralsearch/JavaPredefinedConfigurations.java +++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/JavaPredefinedConfigurations.java @@ -165,6 +165,7 @@ class JavaPredefinedConfigurations { createSearchTemplateInfo(SSRBundle.message("predefined.configuration.generic.casts"),"( '_Type <'_GenericArgument+> ) '_Expr", GENERICS_TYPE), createSearchTemplateInfo(SSRBundle.message("predefined.configuration.type.var.substitutions.in.intanceof.with.generic.types"),"'_Expr instanceof '_Type <'Substitutions+> ", GENERICS_TYPE), createSearchTemplateInfo(SSRBundle.message("predefined.configuration.variables.of.generic.types"),"'_Type <'_GenericArgument+> 'Var = 'Init?;", GENERICS_TYPE), + createSearchTemplateInfo(SSRBundle.message("predefined.configuration.diamond.operators"), "new 'ClassName<>('_Argument*)", GENERICS_TYPE), // Add comments and metadata createSearchTemplateInfo(SSRBundle.message("predefined.configuration.comments"),"/* 'CommentContent */", METADATA_TYPE), diff --git a/platform/structuralsearch/source/messages/SSRBundle.properties b/platform/structuralsearch/source/messages/SSRBundle.properties index 03e22b45699a..615ff43341ac 100644 --- a/platform/structuralsearch/source/messages/SSRBundle.properties +++ b/platform/structuralsearch/source/messages/SSRBundle.properties @@ -101,6 +101,7 @@ predefined.configuration.class.implements.two.interfaces=class implementing two predefined.configuration.bean.info.classes=Bean info classes predefined.configuration.all.expressions.of.some.type=all expressions of some type predefined.configuration.variables.of.generic.types=variables of generic types +predefined.configuration.diamond.operators=diamond operators predefined.configuration.comments=comments predefined.configuration.fields_variables.with.given.name.pattern.updated=fields/variables with given name pattern updated predefined.configuration.trys=try's From 0bda09467529e2d74dda7b378d34e3ad1f650405 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Thu, 25 Dec 2014 14:41:32 +0100 Subject: [PATCH 04/37] SSR: add existing template for method references --- .../intellij/structuralsearch/JavaPredefinedConfigurations.java | 1 + platform/structuralsearch/source/messages/SSRBundle.properties | 1 + 2 files changed, 2 insertions(+) diff --git a/java/structuralsearch-java/src/com/intellij/structuralsearch/JavaPredefinedConfigurations.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/JavaPredefinedConfigurations.java index d331ab45d37c..a1d505a40259 100644 --- a/java/structuralsearch-java/src/com/intellij/structuralsearch/JavaPredefinedConfigurations.java +++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/JavaPredefinedConfigurations.java @@ -33,6 +33,7 @@ class JavaPredefinedConfigurations { createSearchTemplateInfo(SSRBundle.message("predefined.configuration.string.literals"),"\"'_String\"",EXPRESSION_TYPE), createSearchTemplateInfo(SSRBundle.message("predefined.configuration.all.expressions.of.some.type"),"'_Expression:[exprtype( SomeType )]",EXPRESSION_TYPE), createSearchTemplateInfo(SSRBundle.message("predefined.configuration.sample.method.invokation.with.constant.argument"),"Integer.parseInt('_a:[script( \"com.intellij.psi.util.PsiUtil.isConstantExpression(__context__)\" )])",EXPRESSION_TYPE), + createSearchTemplateInfo(SSRBundle.message("predefined.configuration.method.references"), "'_Qualifier::'methodName", EXPRESSION_TYPE), // Operators createSearchTemplateInfo(SSRBundle.message("predefined.configuration.block.dcls"),"{\n '_Type+ 'Var+ = '_Init*;\n '_BlockStatements*;\n}",OPERATOR_TYPE), diff --git a/platform/structuralsearch/source/messages/SSRBundle.properties b/platform/structuralsearch/source/messages/SSRBundle.properties index 615ff43341ac..9cf09ff14739 100644 --- a/platform/structuralsearch/source/messages/SSRBundle.properties +++ b/platform/structuralsearch/source/messages/SSRBundle.properties @@ -146,6 +146,7 @@ predefined.configuration.packagelocal.fields.of.the.class=package local fields o predefined.configuration.classes=classes predefined.configuration.new.expressions=new expressions predefined.configuration.lambdas=lambdas +predefined.configuration.method.references=method references # edit variable constraint dialog options invalid.regular.expression=Invalid regular expression From 3235071718053cf7fea18d555ae3d78b37b6e170 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Thu, 25 Dec 2014 14:58:45 +0100 Subject: [PATCH 05/37] IG: remove magic number --- .../com/siyeh/ig/javadoc/HtmlTagCanBeJavadocTagInspection.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/javadoc/HtmlTagCanBeJavadocTagInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/javadoc/HtmlTagCanBeJavadocTagInspection.java index bfa26c048ea8..b561e32d51a9 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/javadoc/HtmlTagCanBeJavadocTagInspection.java +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/javadoc/HtmlTagCanBeJavadocTagInspection.java @@ -109,7 +109,7 @@ public class HtmlTagCanBeJavadocTagInspection extends BaseInspection { } private static void appendElementText(String text, int startOffset, int endOffset, StringBuilder out) { - if (out.length() == 6 && endOffset - startOffset > 0 && !Character.isWhitespace(text.charAt(startOffset))) { + if (out.length() == "{@code".length() && endOffset - startOffset > 0 && !Character.isWhitespace(text.charAt(startOffset))) { out.append(' '); } out.append(text, startOffset, endOffset); From 5981186bf5750f8e61e11bc03b7ace7dbb316d05 Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Thu, 25 Dec 2014 16:57:59 +0300 Subject: [PATCH 06/37] Dialog title fixed --- .../ide/fileTemplates/impl/FileTemplateConfigurable.java | 2 +- .../platform-resources-en/src/messages/IdeBundle.properties | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FileTemplateConfigurable.java b/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FileTemplateConfigurable.java index e4362587abbb..22699f8ebae2 100644 --- a/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FileTemplateConfigurable.java +++ b/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FileTemplateConfigurable.java @@ -149,7 +149,7 @@ public class FileTemplateConfigurable implements Configurable, Configurable.NoSc @Override public String getDisplayName() { - return IdeBundle.message("title.file.templates"); + return IdeBundle.message("title.edit.file.template"); } @Override diff --git a/platform/platform-resources-en/src/messages/IdeBundle.properties b/platform/platform-resources-en/src/messages/IdeBundle.properties index 2cc34d3f5082..8f4fa6e21aaf 100644 --- a/platform/platform-resources-en/src/messages/IdeBundle.properties +++ b/platform/platform-resources-en/src/messages/IdeBundle.properties @@ -131,6 +131,7 @@ title.select.template=Select Template label.name=Name: label.extension=Extension: title.file.templates=File and Code Templates +title.edit.file.template=Edit File Template checkbox.reformat.according.to.style=Reformat according to style label.description=Description item.file.templates=File templates From f8282c19302b789e765dffcf0990113914d4dcb6 Mon Sep 17 00:00:00 2001 From: Alexander Zolotov Date: Thu, 25 Dec 2014 16:53:11 +0300 Subject: [PATCH 07/37] HTML: allow to instantiate html base inspections --- .../htmlInspections/HtmlUnknownAttributeInspection.java | 4 ---- .../HtmlUnknownBooleanAttributeInspection.java | 5 ----- .../htmlInspections/HtmlUnknownAttributeInspectionBase.java | 6 +++++- .../HtmlUnknownBooleanAttributeInspectionBase.java | 6 +++++- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/xml/impl/src/com/intellij/codeInspection/htmlInspections/HtmlUnknownAttributeInspection.java b/xml/impl/src/com/intellij/codeInspection/htmlInspections/HtmlUnknownAttributeInspection.java index 320467e48052..7357000d2e8a 100644 --- a/xml/impl/src/com/intellij/codeInspection/htmlInspections/HtmlUnknownAttributeInspection.java +++ b/xml/impl/src/com/intellij/codeInspection/htmlInspections/HtmlUnknownAttributeInspection.java @@ -21,10 +21,6 @@ import org.jetbrains.annotations.Nullable; import javax.swing.*; public class HtmlUnknownAttributeInspection extends HtmlUnknownAttributeInspectionBase { - public HtmlUnknownAttributeInspection() { - super(""); - } - @Nullable @Override public JComponent createOptionsPanel() { diff --git a/xml/impl/src/com/intellij/codeInspection/htmlInspections/HtmlUnknownBooleanAttributeInspection.java b/xml/impl/src/com/intellij/codeInspection/htmlInspections/HtmlUnknownBooleanAttributeInspection.java index 478669ea418f..4c7827d76021 100644 --- a/xml/impl/src/com/intellij/codeInspection/htmlInspections/HtmlUnknownBooleanAttributeInspection.java +++ b/xml/impl/src/com/intellij/codeInspection/htmlInspections/HtmlUnknownBooleanAttributeInspection.java @@ -21,11 +21,6 @@ import org.jetbrains.annotations.Nullable; import javax.swing.*; public class HtmlUnknownBooleanAttributeInspection extends HtmlUnknownBooleanAttributeInspectionBase { - - public HtmlUnknownBooleanAttributeInspection() { - super(""); - } - @Nullable @Override public JComponent createOptionsPanel() { diff --git a/xml/xml-analysis-impl/src/com/intellij/codeInspection/htmlInspections/HtmlUnknownAttributeInspectionBase.java b/xml/xml-analysis-impl/src/com/intellij/codeInspection/htmlInspections/HtmlUnknownAttributeInspectionBase.java index 0acd0691a447..c0aca36fdb8e 100644 --- a/xml/xml-analysis-impl/src/com/intellij/codeInspection/htmlInspections/HtmlUnknownAttributeInspectionBase.java +++ b/xml/xml-analysis-impl/src/com/intellij/codeInspection/htmlInspections/HtmlUnknownAttributeInspectionBase.java @@ -37,10 +37,14 @@ public class HtmlUnknownAttributeInspectionBase extends HtmlUnknownElementInspec private static final Key ATTRIBUTE_KEY = Key.create(ATTRIBUTE_SHORT_NAME); private static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.htmlInspections.HtmlUnknownAttributeInspection"); + public HtmlUnknownAttributeInspectionBase() { + this(""); + } + public HtmlUnknownAttributeInspectionBase(String defaultValues) { super(defaultValues); } - + @Override @Nls @NotNull diff --git a/xml/xml-analysis-impl/src/com/intellij/codeInspection/htmlInspections/HtmlUnknownBooleanAttributeInspectionBase.java b/xml/xml-analysis-impl/src/com/intellij/codeInspection/htmlInspections/HtmlUnknownBooleanAttributeInspectionBase.java index e859b8548aaa..ffd9065f1db0 100644 --- a/xml/xml-analysis-impl/src/com/intellij/codeInspection/htmlInspections/HtmlUnknownBooleanAttributeInspectionBase.java +++ b/xml/xml-analysis-impl/src/com/intellij/codeInspection/htmlInspections/HtmlUnknownBooleanAttributeInspectionBase.java @@ -33,10 +33,14 @@ import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; -public abstract class HtmlUnknownBooleanAttributeInspectionBase extends HtmlUnknownElementInspection { +public class HtmlUnknownBooleanAttributeInspectionBase extends HtmlUnknownElementInspection { private static final Key BOOLEAN_ATTRIBUTE_KEY = Key.create(BOOLEAN_ATTRIBUTE_SHORT_NAME); private static final Logger LOG = Logger.getInstance(HtmlUnknownBooleanAttributeInspectionBase.class); + public HtmlUnknownBooleanAttributeInspectionBase() { + this(""); + } + public HtmlUnknownBooleanAttributeInspectionBase(String defaultValues) { super(defaultValues); } From 2f97a2bbb4a8ffb34c75e79dc21e6c7dba5e2962 Mon Sep 17 00:00:00 2001 From: Dmitry Batkovich Date: Thu, 25 Dec 2014 17:17:26 +0300 Subject: [PATCH 08/37] Severity icon doesn't hold color, only key --- .../codeHighlighting/HighlightDisplayLevel.java | 12 ++++++------ .../daemon/impl/SeverityRegistrar.java | 11 +---------- .../codeInspection/ex/SeverityEditorDialog.java | 16 ++++++++++++++-- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/platform/analysis-api/src/com/intellij/codeHighlighting/HighlightDisplayLevel.java b/platform/analysis-api/src/com/intellij/codeHighlighting/HighlightDisplayLevel.java index e7198b5ac44b..bb197ca6b683 100644 --- a/platform/analysis-api/src/com/intellij/codeHighlighting/HighlightDisplayLevel.java +++ b/platform/analysis-api/src/com/intellij/codeHighlighting/HighlightDisplayLevel.java @@ -120,11 +120,11 @@ public class HighlightDisplayLevel { @NotNull public static Icon createIconByMask(final Color renderColor) { - return new TheColorIcon(getEmptyIconDim(), renderColor); + return new MyColorIcon(getEmptyIconDim(), renderColor); } - public static class TheColorIcon extends ColorIcon implements ColoredIcon { - public TheColorIcon(int size, @NotNull Color color) { + private static class MyColorIcon extends ColorIcon implements ColoredIcon { + public MyColorIcon(int size, @NotNull Color color) { super(size, color); } @@ -132,12 +132,12 @@ public class HighlightDisplayLevel { public Color getColor() { return getIconColor(); } - } - + } + public interface ColoredIcon { Color getColor(); } - + public static class SingleColorIcon implements Icon, ColoredIcon { private final TextAttributesKey myKey; diff --git a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/SeverityRegistrar.java b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/SeverityRegistrar.java index de4c9612f46e..a6a9770223a6 100644 --- a/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/SeverityRegistrar.java +++ b/platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/SeverityRegistrar.java @@ -94,16 +94,7 @@ public class SeverityRegistrar implements JDOMExternalizable, Comparator order = new ArrayList(); for (int i = listModel.getSize() - 1; i >= 0; i--) { - final SeverityBasedTextAttributes info = - (SeverityBasedTextAttributes)listModel.getElementAt(i); + SeverityBasedTextAttributes info = (SeverityBasedTextAttributes)listModel.getElementAt(i); order.add(info.getSeverity()); if (!mySeverityRegistrar.isDefaultSeverity(info.getSeverity())) { infoTypes.remove(info); final Color stripeColor = info.getAttributes().getErrorStripeColor(); + final boolean exists = mySeverityRegistrar.getSeverity(info.getSeverity().getName()) != null; + if (exists) { + info.getType().getAttributesKey().getDefaultAttributes().setErrorStripeColor(stripeColor); + } else { + HighlightInfoType.HighlightInfoTypeImpl type = info.getType(); + TextAttributesKey key = type.getAttributesKey(); + final TextAttributes defaultAttributes = key.getDefaultAttributes().clone(); + defaultAttributes.setErrorStripeColor(stripeColor); + key = TextAttributesKey.createTextAttributesKey(key.getExternalName(), defaultAttributes); + type = new HighlightInfoType.HighlightInfoTypeImpl(type.getSeverity(null), key); + info = new SeverityBasedTextAttributes(info.getAttributes(), type); + } + mySeverityRegistrar.registerSeverity(info, stripeColor != null ? stripeColor : LightColors.YELLOW); } } From c85c07f4e4e986412f64767c2d0c009e4625c18b Mon Sep 17 00:00:00 2001 From: Alexander Zolotov Date: Thu, 25 Dec 2014 17:37:30 +0300 Subject: [PATCH 09/37] Emmet: enable booleanAttribute inspection while testing --- .../template/emmet/nodes/GenerationNode.java | 12 ++++++++---- .../src/com/intellij/xml/util/HtmlUtil.java | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/GenerationNode.java b/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/GenerationNode.java index 4e03afc67148..4201ee0b6c13 100644 --- a/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/GenerationNode.java +++ b/xml/impl/src/com/intellij/codeInsight/template/emmet/nodes/GenerationNode.java @@ -411,6 +411,7 @@ public class GenerationNode extends UserDataHolderBase { } private void setAttributeValues(@NotNull XmlTag tag, @NotNull final Map attributes, CustomTemplateCallback callback) { + // default and implied attributes final String defaultAttributeValue = attributes.get(XmlEmmetParser.DEFAULT_ATTRIBUTE_NAME); if (defaultAttributeValue != null) { attributes.remove(XmlEmmetParser.DEFAULT_ATTRIBUTE_NAME); @@ -446,6 +447,7 @@ public class GenerationNode extends UserDataHolderBase { } } + // boolean attributes for (XmlAttribute xmlAttribute : tag.getAttributes()) { final String attributeName = xmlAttribute.getName(); final XmlAttributeValue xmlAttributeValueElement = xmlAttribute.getValueElement(); @@ -458,7 +460,7 @@ public class GenerationNode extends UserDataHolderBase { myContainsSurroundedTextMarker = true; } - if (isBooleanAttribute(attributeValue, xmlAttribute, ZenCodingUtil.isHtml(callback))) { + if (isBooleanAttribute(attributeValue, xmlAttribute, callback)) { if (HtmlUtil.isShortNotationOfBooleanAttributePreferred()) { if (xmlAttributeValueElement != null) { final PsiElement prevSibling = xmlAttributeValueElement.getPrevSibling(); @@ -493,13 +495,15 @@ public class GenerationNode extends UserDataHolderBase { } } - private static boolean isBooleanAttribute(@Nullable String attributeValue, @NotNull XmlAttribute xmlAttribute, boolean isHtml) { + private static boolean isBooleanAttribute(@Nullable String attributeValue, + @NotNull XmlAttribute xmlAttribute, + @NotNull CustomTemplateCallback callback) { if (XmlEmmetParser.BOOLEAN_ATTRIBUTE_VALUE.equals(attributeValue)) { return true; } - if (isHtml) { + if (ZenCodingUtil.isHtml(callback)) { final XmlAttributeDescriptor descriptor = xmlAttribute.getDescriptor(); - return descriptor != null && HtmlUtil.isBooleanAttribute(descriptor, xmlAttribute); + return descriptor != null && HtmlUtil.isBooleanAttribute(descriptor, callback.getContext()); } return false; } diff --git a/xml/xml-psi-impl/src/com/intellij/xml/util/HtmlUtil.java b/xml/xml-psi-impl/src/com/intellij/xml/util/HtmlUtil.java index 6970f1da3e1c..e7c9168d3e36 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/util/HtmlUtil.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/util/HtmlUtil.java @@ -252,7 +252,7 @@ public class HtmlUtil { }); } - public static boolean isBooleanAttribute(@NotNull XmlAttributeDescriptor descriptor, @Nullable XmlElement context) { + public static boolean isBooleanAttribute(@NotNull XmlAttributeDescriptor descriptor, @Nullable PsiElement context) { if (descriptor instanceof HtmlAttributeDescriptorImpl && descriptor.isEnumerated()) { final String[] values = descriptor.getEnumeratedValues(); if (values == null) { @@ -269,7 +269,7 @@ public class HtmlUtil { return context != null && isCustomBooleanAttribute(descriptor.getName(), context); } - public static boolean isCustomBooleanAttribute(@NotNull String attributeName, @NotNull XmlElement context) { + public static boolean isCustomBooleanAttribute(@NotNull String attributeName, @NotNull PsiElement context) { final String entitiesString = getEntitiesString(context, XmlEntitiesInspection.BOOLEAN_ATTRIBUTE_SHORT_NAME); if (entitiesString != null) { StringTokenizer tokenizer = new StringTokenizer(entitiesString, ","); From b2ab75d22df5738842b2e675e3ec8d586d18c271 Mon Sep 17 00:00:00 2001 From: Alexander Zolotov Date: Thu, 25 Dec 2014 19:09:42 +0300 Subject: [PATCH 10/37] Update Emmet snippets --- xml/impl/resources/liveTemplates/zen_html.xml | 21 +++++++++++++++++++ xml/impl/resources/liveTemplates/zen_xsl.xml | 20 ------------------ 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/xml/impl/resources/liveTemplates/zen_html.xml b/xml/impl/resources/liveTemplates/zen_html.xml index 50c8714e5bc0..76a1d65d4779 100644 --- a/xml/impl/resources/liveTemplates/zen_html.xml +++ b/xml/impl/resources/liveTemplates/zen_html.xml @@ -517,6 +517,15 @@