mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-151043 code completion sometimes does not suggest enumeration values when used with extension or union
union with enum types supported
This commit is contained in:
@@ -798,10 +798,14 @@ public class XmlCompletionTest extends LightCodeInsightFixtureTestCase {
|
||||
assertSameElements(variants, "int", "integer", "invisibleType");
|
||||
}
|
||||
|
||||
public void testEnumeratedTypeUnion() {
|
||||
List<String> variants = myFixture.getCompletionVariants("enumerations.xml", "enumerations.xsd");
|
||||
assertSameElements(variants, "A", "B");
|
||||
}
|
||||
|
||||
private HtmlCodeStyleSettings getHtmlSettings() {
|
||||
return CodeStyle.getSettings(myFixture.getProject())
|
||||
.getCustomSettings(HtmlCodeStyleSettings.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<enumerations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="enumerations.xsd">
|
||||
<openEnumeration><caret></openEnumeration>
|
||||
</enumerations>
|
||||
@@ -0,0 +1,113 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<xsd:element name="enumerations" type="enumerationsType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
Example enumerations:
|
||||
<ol>
|
||||
<li>
|
||||
<strong>enumeration</strong>:
|
||||
a simple (disallows annotations), closed (is not extensible) enumeration
|
||||
</li>
|
||||
<li>
|
||||
<strong>enumerationWithAttributes</strong>:
|
||||
a complex (allows annotations), closed (is not extensible) enumeration
|
||||
</li>
|
||||
<li>
|
||||
<strong>openEnumeration</strong>:
|
||||
a simple (disallows annotations), open (is extensible) enumeration
|
||||
</li>
|
||||
<li>
|
||||
<strong>openEnumerationWithAttributes</strong>:
|
||||
a complex (allows annotations), open (is extensible) enumeration
|
||||
</li>
|
||||
</ol>
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
<xsd:complexType name="enumerationsType">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="enumeration" type="enumerationType"
|
||||
maxOccurs="unbounded" minOccurs="0"/>
|
||||
<xsd:element name="enumerationWithAttributes" type="enumerationWithAttributesType"
|
||||
maxOccurs="unbounded" minOccurs="0"/>
|
||||
<xsd:element name="openEnumeration" type="openEnumerationType"
|
||||
maxOccurs="unbounded" minOccurs="0"/>
|
||||
<xsd:element name="openEnumerationWithAttributes" type="openEnumerationWithAttributesType"
|
||||
maxOccurs="unbounded" minOccurs="0"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:simpleType name="enumerationType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
a simple (disallows annotations), closed (is not extensible) enumeration
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="A"/>
|
||||
<xsd:enumeration value="B"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
<xsd:complexType name="enumerationWithAttributesType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
a complex (allows annotations), closed (is not extensible) enumeration
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleContent>
|
||||
<xsd:extension base="enumerationType">
|
||||
<xsd:attributeGroup ref="enumerationAttributeGroup"/>
|
||||
</xsd:extension>
|
||||
</xsd:simpleContent>
|
||||
</xsd:complexType>
|
||||
<xsd:attributeGroup name="enumerationAttributeGroup">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
a reusable group of attributes for extending simple enumerations to make complex enumerations
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:attribute name="id" type="xsd:ID"/>
|
||||
<xsd:attribute name="idref" type="xsd:IDREF"/>
|
||||
</xsd:attributeGroup>
|
||||
<xsd:simpleType name="openEnumerationType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
a simple (disallows annotations), open (is extensible) enumeration
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:union memberTypes="xsd:int enumerationType"/>
|
||||
</xsd:simpleType>
|
||||
<xsd:simpleType name="openEnumerationWithSimpleTypeChildUnionType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
a simple (disallows annotations), open (is extensible) enumeration
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:union memberTypes="xsd:int">
|
||||
<xsd:simpleType>
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
a simple (disallows annotations), closed (is not extensible) enumeration
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:restriction base="xsd:string">
|
||||
<xsd:enumeration value="A"/>
|
||||
<xsd:enumeration value="B"/>
|
||||
</xsd:restriction>
|
||||
</xsd:simpleType>
|
||||
</xsd:union>
|
||||
</xsd:simpleType>
|
||||
<xsd:complexType name="openEnumerationWithAttributesType">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>
|
||||
a complex (allows annotations), open (is extensible) enumeration
|
||||
</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
<xsd:simpleContent>
|
||||
<xsd:extension base="openEnumerationType">
|
||||
<xsd:attributeGroup ref="enumerationAttributeGroup"/>
|
||||
</xsd:extension>
|
||||
</xsd:simpleContent>
|
||||
</xsd:complexType>
|
||||
</xsd:schema>
|
||||
@@ -917,6 +917,15 @@ public class XmlUtil {
|
||||
else if (localName.equals("union")) {
|
||||
exhaustiveEnum = false;
|
||||
processEnumerationValues(tag, tagProcessor);
|
||||
XmlAttribute attribute = tag.getAttribute("memberTypes");
|
||||
if (attribute != null && attribute.getValueElement() != null) {
|
||||
for (PsiReference reference : attribute.getValueElement().getReferences()) {
|
||||
PsiElement resolve = reference.resolve();
|
||||
if (resolve instanceof XmlTag) {
|
||||
processEnumerationValues((XmlTag)resolve, tagProcessor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (localName.equals("extension")) {
|
||||
XmlTag base = XmlSchemaTagsProcessor.resolveTagReference(tag.getAttribute("base"));
|
||||
|
||||
Reference in New Issue
Block a user