Skip to content

Code completion - insert required subelements #521

Open
@FreHu

Description

@FreHu

If my schema contains required attributes on an element, executing autocompletion for that element will also autocomplete the required attributes. Example:

<xs:complexType name="enumerationType">
  <xs:sequence>
      <xs:element type="enumType" name="enum" maxOccurs="unbounded" minOccurs="1" />
  </xs:sequence>
  <xs:attribute type="xs:string" name="name" use="required" />
  <xs:attribute type="enumerationDataType" name="data_type" use="required" />
</xs:complexType>

Executing code completion for this element will type
image

<enumeration name="" data_type="text"></enumeration>

(it also inferred an attribute value for the data type because enumerationDataType is an xs:enumeration)

However, the element contains a mandatory subelement at least once, which means the generated xml is instantly invalid.

My suggestion is that the autocompletion for an element should generate all required subelements

<enumeration name="" data_type="text">
<enum></enum>
</enumeration>

ideally this rule would be applied recursively, so if enum had a mandatory attribute value, it would generate

<enumeration name="" data_type="text">
<enum value=""></enum>
</enumeration>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions