Skip to content

XSD: IntelliSense and element substitutions #186

@mdschweda

Description

@mdschweda

Version: 0.9.0

IntelliSense doesn't suggest elements of a substitution group.

Considering the following example:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://example/" targetNamespace="http://example/">
    <xs:complexType name="AutomobileType">
        <xs:attribute name="topSpeed" type="xs:float" />
    </xs:complexType>
    <xs:complexType name="TruckType">
        <xs:complexContent>
            <xs:extension base="AutomobileType">
                <xs:attribute name="payloadCapacity" type="xs:float" />
            </xs:extension>
        </xs:complexContent>
    </xs:complexType>

    <xs:element name="automobile" type="AutomobileType"/>
    <xs:element name="truck" type="TruckType" substitutionGroup="automobile"/>

    <xs:element name="fleet">
        <xs:complexType>
            <xs:sequence>
                <xs:choice maxOccurs="unbounded">
                    <xs:element ref="automobile" minOccurs="0" maxOccurs="unbounded" />
                </xs:choice>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>
<fleet xmlns="http://example/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://example/ fleet-schema.xsd">

</fleet>

IntelliSense inside <fleet/> should offer automobile as well as truck because the former can be substituted for the latter as per the substitutionGroup. The linter recognizes that truck is a valid child element and will report no error, but the element doesn't appear in the IntelliSense list.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions