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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix how elements inside macros are associated with their XSD definition #111

Merged
merged 5 commits into from Feb 13, 2021

Conversation

davelopez
Copy link
Collaborator

Fixes #107

The auto-completion, documentation on hover, and basically all the features based on XSD definitions were broken when the elements were inside a macros section. This was caused by how the associated XSD elements were determined based on the 'tree hierarchy' of the XML element. When an XSD element can not be associated, the default root (tool) element was used, which was confusing. In the case of elements inside macros, the XSD hierarchy can not be used (as they do not match) so a new 'name-based' solution was used instead.

Now the elements under a macros section (or in an external macros.xml file) can benefit from the auto-completion and other XSD based features 馃帀

Thank you @sunyi000 for reporting this!

Tests the name of the XSD element node associated with the XML element inside a `macros` section matches the expected node.
In case of an element defined inside a `macros` tag the XSD node associated will be determined by name intead of by the tree path
This will retun None for XML elements that can not be associated with a corresponding XSD definition instead of returning always the root `tool` element.

Some tests had to be fixed to check this new behaviour.
@davelopez davelopez added bug Something isn't working language server Related to the language server labels Feb 13, 2021
@davelopez davelopez added this to the v0.4.0 milestone Feb 13, 2021
@bgruening
Copy link
Member

Oh shit this is pretty cool!

@bgruening bgruening merged commit aa0a5b7 into master Feb 13, 2021
@bgruening bgruening deleted the fix_#107 branch February 13, 2021 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working language server Related to the language server
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Auto-completion in macros falls back to tool
2 participants