You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 15, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 15, 2026. It is now read-only.
XML: Allow children of ElementSpec to also be ElementSpec #1590
I would like to provide auto complete for children of elements, where the name of the children is not unique.
In the example below, the elements infos are used for cars and bikes, but are completely different types of information. XSD allows this by specifying a type for an element as well as a name.
Since I can only define an array of names as the children of ElementSpec, it is not possible to have a infos element that is different for cars vs. bikes.
I would suggest expanding the children property to be of type: (string | ElementSpec)[], or allow a child to be a reference to a type, not just a name.
When completing, the code currently only looks at the name of the surrounding element. To support what you're proposing, it'd have to trace the set of parents all the way from the root element to figure out what context it is in. This is possible but adds quite a bit of complexity and new failure modes (such as parent elements being missing of malformed). As such, I'm not sure this would be an improvement.
I understand the complexity that this would add. But, I'm not sure how I would be able to support anything but the simplest schema with the current approach. Maybe I'm missing something? Do you have a suggestion how I could implement my example, besides changing the name of infos to car-infos and bike-infos or something similar?
Activity
marijnh commentedon Jul 18, 2025
When completing, the code currently only looks at the name of the surrounding element. To support what you're proposing, it'd have to trace the set of parents all the way from the root element to figure out what context it is in. This is possible but adds quite a bit of complexity and new failure modes (such as parent elements being missing of malformed). As such, I'm not sure this would be an improvement.
Mafus1 commentedon Jul 21, 2025
I understand the complexity that this would add. But, I'm not sure how I would be able to support anything but the simplest schema with the current approach. Maybe I'm missing something? Do you have a suggestion how I could implement my example, besides changing the name of
infostocar-infosandbike-infosor something similar?marijnh commentedon Apr 15, 2026
This issue has been moved to issue #1590 on the repository's new home.