redhat-developer / redhat-developer/vscode-xml

Completion Broken When Encountering xs:any

Open
#927 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

completion
Dominant language
TypeScript
Stars
328
Forks
101
Avg merge
1d 17h
Merged PRs (30d)
7

Description

Reminiscent of #177, it appears that on versions 0.26.1 (stable) and 0.26.2023080404 (pre-release), schema-based completion is broken when an xs:any element is encountered. Instead of showing explicitly-defined elements, it only shows the root tag as an option.

Summary

For a visual demonstration and a reproduction case, skip this header and continue to the detail/summary blocks.

When an xs:any schema element is present, the following is true:

The following features are working:
  • Validation
  • Documentation On Hover
  • Attribute Suggestion
The following feature is NOT working:
  • Tag Suggestion

Demo & Minimal Reproduction XSD

<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="root">
        <xs:annotation><xs:documentation>Some documentation for the ROOT ELEMENT</xs:documentation></xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:any minOccurs="0" processContents="skip" />
                <xs:element name="Name" minOccurs="0" maxOccurs="1" type="xs:string">
                    <xs:annotation><xs:documentation>Some documentation for the NAME ELEMENT</xs:documentation></xs:annotation>
                </xs:element>
                <xs:element name="Id" minOccurs="0" maxOccurs="1">
                    <xs:annotation><xs:documentation>Some documentation for the ID ELEMENT</xs:documentation></xs:annotation>
                    <xs:complexType>
                        <xs:simpleContent>
                            <xs:extension base="xs:integer">
                                <xs:attribute name="type" type="xs:string" />
                            </xs:extension>
                        </xs:simpleContent>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>

Scope of Issue (w/ Images) Using Above XSD

Documentation works on root eement

IntelliSense only shows root element for completion

image

Created element uses type for root element

image

Explicitly-defined elements still have their types applied

image
image

Validation is working

image
image


🔴🎩


Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the minimal reproduction XSD in this issue and trace schema-based tag completion when the xs:any element is encountered. Reproduce the case in VS Code, then verify that explicitly defined Name and Id elements are suggested while validation and the other working features remain unaffected.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.