diff --git a/xml/impl/src/com/intellij/codeInsight/completion/XmlTagInsertHandler.java b/xml/impl/src/com/intellij/codeInsight/completion/XmlTagInsertHandler.java index effac153e74e..9938e39ef720 100644 --- a/xml/impl/src/com/intellij/codeInsight/completion/XmlTagInsertHandler.java +++ b/xml/impl/src/com/intellij/codeInsight/completion/XmlTagInsertHandler.java @@ -226,7 +226,8 @@ public class XmlTagInsertHandler implements InsertHandler { for (XmlAttributeDescriptor attributeDecl : attributes) { String attributeName = attributeDecl.getName(tag); - if (attributeDecl.isRequired() && (tag == null || tag.getAttributeValue(attributeName) == null)) { + boolean shouldBeInserted = extension.shouldBeInserted(attributeDecl); + if (shouldBeInserted && (tag == null || tag.getAttributeValue(attributeName) == null)) { if (!notRequiredAttributes.contains(attributeName)) { if (!extension.isIndirectSyntax(attributeDecl)) { template.addTextSegment(" " + attributeName + "=\""); @@ -239,7 +240,7 @@ public class XmlTagInsertHandler implements InsertHandler { } } } - else if (attributeDecl.isRequired() && attributeDecl.isFixed() && attributeDecl.getDefaultValue() != null && !htmlCode) { + else if (shouldBeInserted && attributeDecl.isFixed() && attributeDecl.getDefaultValue() != null && !htmlCode) { template.addTextSegment(" " + attributeName + "=\"" + attributeDecl.getDefaultValue() + "\""); } } diff --git a/xml/xml-psi-impl/src/com/intellij/xml/XmlExtension.java b/xml/xml-psi-impl/src/com/intellij/xml/XmlExtension.java index 5a70693e97a9..703f020ffba5 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/XmlExtension.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/XmlExtension.java @@ -164,6 +164,10 @@ public abstract class XmlExtension { return false; } + public boolean shouldBeInserted(final XmlAttributeDescriptor descriptor) { + return descriptor.isRequired(); + } + public boolean isCustomTagAllowed(final XmlTag tag) { return false; }