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

Weird buggy format. #169

Closed
y0nd0 opened this issue Mar 13, 2021 · 1 comment
Closed

Weird buggy format. #169

y0nd0 opened this issue Mar 13, 2021 · 1 comment

Comments

@y0nd0
Copy link

y0nd0 commented Mar 13, 2021

Actually:

<?xml version='1.0' encoding='utf-8' ?>
<widget
  xmlns="http://www.w3.org/ns/widgets"
  xmlns:cdv="http://cordova.apache.org/ns/1.0"
>
    <content src="index.html" />
    <access origin="*" />
    <platform name="android">
        <edit-config
      file="app/src/main/AndroidManifest.xml"
      mode="merge"
      target="/manifest/application"
      xmlns:android="http://schemas.android.com/apk/res/android"
    >
            <application
        android:networkSecurityConfig="@xml/network_security_config"
      />
        </edit-config>
        <resource-file
      src="resources/android/xml/network_security_config.xml"
      target="app/src/main/res/xml/network_security_config.xml"
    />
        <allow-intent href="market:*" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
    </platform>
</widget>

Expected:

<?xml version='1.0' encoding='utf-8' ?>
<widget
  xmlns="http://www.w3.org/ns/widgets"
  xmlns:cdv="http://cordova.apache.org/ns/1.0"
>
  <content src="index.html" />
  <access origin="*" />
  <platform name="android">
    <edit-config
      file="app/src/main/AndroidManifest.xml"
      mode="merge"
      target="/manifest/application"
      xmlns:android="http://schemas.android.com/apk/res/android"
    >
      <application
        android:networkSecurityConfig="@xml/network_security_config"
      />
    </edit-config>
    <resource-file
      src="resources/android/xml/network_security_config.xml"
      target="app/src/main/res/xml/network_security_config.xml"
    />
    <allow-intent href="market:*" />
  </platform>
  <platform name="ios">
    <allow-intent href="itms:*" />
    <allow-intent href="itms-apps:*" />
  </platform>
</widget>

Editorconfig:

charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 80

Versions:

vscode: 1.54.2
Chrome: 87.0.4280.141
Node.js: 12.18.3
OS: Windows_NT x64 10.0.19042
prettier: 2.2.1
@prettier/plugin-xml: 0.13.1
prettier vscode ext: 5.9.2

Testes format on VSCode with official Prettier extension and CLI only (without extension).
What's going on? Weird indent spaces. For example edit-config one level deeper and application more levels deeper. I cannot see any scheme. I'm confused. What's wrong? Sometimes the format differs. Sometimes formatting doesn't work at all. No Prettier errors. It's random...
Could someone validate this? For example by installing Ionic + Cordova, add Android and format config.xml.

@kddnewton
Copy link
Member

Set xmlWhitespaceSensitivity to "ignore".

Closing as dup of #165, #160, and #154.

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