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

Processing instructions disrupt formatting #762

Closed
adamalston opened this issue Feb 10, 2024 · 3 comments
Closed

Processing instructions disrupt formatting #762

adamalston opened this issue Feb 10, 2024 · 3 comments

Comments

@adamalston
Copy link

Hi, I've encountered an issue with the plugin where processing instructions within XML files disrupt formatting.

Input (test.xml)

<list><value id="all"><label>All</label></value><value id="one-one"><?group one?><label>One</label></value><value id="one-two"><?group one?><label>Two</label></value><value id="two-one"><?group two?><label>One</label></value><value id="two-two"><?group two?><label>Two</label></value></list>

Command:

npx prettier --plugin=@prettier/plugin-xml --tab-width 4 --xml-whitespace-sensitivity "ignore" --print-width 180 test.xml

Output:

<list>
    <value id="all">
        <label>All</label>
    </value>
    <value id="one-one">
        <?group one?><label>One</label></value><value id="one-two"><?group one?><label>Two</label></value><value id="two-one"><?group two?><label>One</label></value><value id="two-two"><?group two?>
        <label>Two</label>
    </value>
</list>

Expected output:

<list>
    <value id="all">
        <label>All</label>
    </value>
    <value id="one-one">
        <?group one?>
        <label>One</label>
    </value>
    <value id="one-two">
        <?group one?>
        <label>Two</label>
    </value>
    <value id="two-one">
        <?group two?>
        <label>One</label>
    </value>
    <value id="two-two">
        <?group two?>
        <label>Two</label>
    </value>
</list>

Any suggestions or fixes would be appreciated. Thanks

@kddnewton
Copy link
Member

This is an issue with our parser. I've opened a PR for the fix, and will need to update the dependency when it's ready. SAP/xml-tools#452. If they don't it soon, I'll figure out another way to make it work.

@adamalston
Copy link
Author

Hi @kddnewton, do you have any updates or insights regarding SAP/xml-tools#452?

@kddnewton
Copy link
Member

No, I don't really have any sway on them unfortunately. If they don't merge there's not much I can do. I might have to fork if they don't do anything about it.

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

No branches or pull requests

2 participants