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

[XML] Add scope based folding #3783

Merged
merged 3 commits into from
Jul 25, 2023

Conversation

deathaxe
Copy link
Collaborator

@deathaxe deathaxe commented Jun 3, 2023

This PR tweaks some scope names and adds rules for scope based folding.

This commit changes scopes of parentheses to `punctuation.section.group`.
@michaelblyons
Copy link
Collaborator

Nice. I'm on a phone, so I don't have my ST up, but I'm hoping the CDATA change simplifies some color scheme stuff I am doing as well as the fold improvements.

@deathaxe
Copy link
Collaborator Author

deathaxe commented Jun 3, 2023

This PR just adds another sub-scope to some of the punctuation in order to use them as unique fold markers. I don't think those changes are a game changer for highlighting. Hence I wonder, what kind of simplifactions you are looking for.

@michaelblyons
Copy link
Collaborator

I have this monster to tweak the open/close tags on CDATA

{
    "name": "CDATA Punctuation",
    "scope": "(meta.tag.cdata | meta.tag.sgml.cdata) & (entity.name.tag.cdata | punctuation.definition.tag.begin | punctuation.definition.tag.end | keyword.declaration.cdata)",
    "foreground": "var(white4)",
    "font_style": "",
},

I'm not sure I remember how it was all put together. It may include some old convention and/or a difference in HTML syntaxes as well.

@deathaxe
Copy link
Collaborator Author

deathaxe commented Jun 5, 2023

HTML and XML have been aligned to use meta.tag.sgml.cdata keyword.declaration (as all DTD related tags) but other 3rd-party packages such as PackageDev still use older scopes.

michaelblyons
michaelblyons previously approved these changes Jul 24, 2023
jfcherng
jfcherng previously approved these changes Jul 25, 2023
This commit fixes an issue, which confused syntax based folding, if fully
qualified tag names are involved.

```xml
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="Data">
        <xs:complexType>
            <xs:sequence>
                <!--Allowing arbitrary element names-->
                <xs:any maxOccurs="unbounded" processContents="lax"/>
            </xs:sequence>
            <!--Element names must be unique-->
            <xs:assert test="every $child in * satisfies not($child/preceding::*[name() = name($child)])"></xs:assert>
        </xs:complexType>
    </xs:element>
</xs:schema>
```
@deathaxe deathaxe dismissed stale reviews from jfcherng and michaelblyons via 68d7399 July 25, 2023 12:07
@deathaxe deathaxe merged commit b2d1324 into sublimehq:master Jul 25, 2023
2 checks passed
@deathaxe deathaxe deleted the pr/xml/add-scope-based-folding branch July 25, 2023 13:11
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.

3 participants