Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't generate end element on apply completion if it exists #652

Merged
merged 1 commit into from
Apr 23, 2020

Conversation

angelozerr
Copy link
Contributor

Don't generate end element on apply completion if it exists

Fixes #651

Signed-off-by: azerr [email protected]

@angelozerr angelozerr requested a review from fbricon April 23, 2020 13:10
@angelozerr
Copy link
Contributor Author

angelozerr commented Apr 23, 2020

To test this PR you need to test XML completion based on XML Schema/DTD and without it and open completion before an orphan end element.

Create a XML Schema choice.xsd like this:

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema
        xmlns:xs="http://www.w3.org/2001/XMLSchema"
        elementFormDefault="qualified"
        attributeFormDefault="unqualified">
    <xs:element name="person">
        <xs:complexType>
            <xs:choice
                    minOccurs="1"
                    maxOccurs="2">
                <xs:element name="employee"/>
                <xs:element name="member"/>
            </xs:choice>
        </xs:complexType>
    </xs:element>
</xs:schema>

create a XML file like this:

<?xml version="1.0" encoding="UTF-8" ?>
<person xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="choice.xsd">
	<employee></employee>
	|</member>
</person>

open completion before member and apply it, it should generate only <member> without close it.

After write a XML file (without XSD) like this:

<?xml version="1.0" encoding="UTF-8" ?>
<person>
	<employee></employee>
	|</employee>
</person>

Here a demo:

EatCompletionDemo

@angelozerr angelozerr marked this pull request as draft April 23, 2020 13:25
@angelozerr angelozerr marked this pull request as ready for review April 23, 2020 14:31
@fbricon fbricon merged commit d0a94fd into eclipse:master Apr 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't generate end element on apply completion if it exists
2 participants