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

Navigation and intellisense for xs:include-ed types #579

Merged
merged 1 commit into from
Oct 21, 2019
Merged

Conversation

angelozerr
Copy link
Contributor

Navigation and intellisense for xs:include-ed types

See redhat-developer/vscode-xml#188

Signed-off-by: azerr azerr@redhat.com

@angelozerr angelozerr force-pushed the xsd-include branch 3 times, most recently from aa4b22a to ce6b01b Compare October 19, 2019 13:01
@angelozerr angelozerr marked this pull request as ready for review October 19, 2019 13:02
@angelozerr
Copy link
Contributor Author

This PR gives the capability to support xs:include schema location:

  • for definition
  • for completion

Test has been written for that. As highlight use the same search code thandefinition and completion, I had to disable search with xs:include for highlight to avoid return the range of xs:element coming from the xs:include XML Schema because LSP highlighting support higlight only for one file and not for external file.

To test this PR, you can use SchemaA.xsd:

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="tns" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xs:include schemaLocation="SchemaB.xsd" />
  
	<xs:complexType name="Bar">
		<xs:sequence>
			<xs:element name="FooBar" type="xs:string" />
			<xs:element ref="TypeFromB" />
			<xs:element ref="TypeFromC" />
		</xs:sequence>
	</xs:complexType>

	<xs:complexType name="Root">
		<xs:sequence>
			<xs:element name="Bar" type="Bar" minOccurs="1" maxOccurs="unbounded" />
		</xs:sequence>
	</xs:complexType>

	<xs:element name="Root" type="Root"></xs:element>
</xs:schema>

which includes XSD SchemaB.xsd which include SchemaC.xsd.

Here a demo:

XSIncludeDefAndCompletionDemo

@NikolasKomonen
Copy link
Contributor

@angelozerr works great, ready to merge!

@angelozerr angelozerr merged commit 9ed1770 into master Oct 21, 2019
@angelozerr
Copy link
Contributor Author

Thanks @NikolasKomonen for your review!

@angelozerr angelozerr deleted the xsd-include branch March 23, 2020 15:51
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.

None yet

2 participants