XML: Allow children of ElementSpec to also be ElementSpec #1590
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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
infosare 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
infoselement 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.Is that something you are willing to implement?
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
infostocar-infosandbike-infosor something similar?