DotJoshJohnson / vscode-xml

XML Tools for Visual Studio Code
MIT License
320 stars 87 forks source link

Comment indentation increases farther on every save of the same file, even with no other changes #365

Open deFractal opened 2 years ago

deFractal commented 2 years ago

Description

What seems to be the problem?

Even with every extension disabled except XML Tools, every time I save a file with this content (or the same except with the comment more indented), the indentation before the comment increases by 4 spaces:

<?xml version="1.0" encoding="utf-8"?>
<element>
    text
    <!-- comment -->
</element>

Possibly relevant user settings:


"[xml]": {
  "editor.defaultFormatter": "DotJoshJohnson.xml",
  "editor.formatOnSave": true
}

Notably, as well as persisting with other extensions disabled, this persists while there are no workspace settings set and while all editor.* user settings are commented out in my user settings.json.

The problem ceases when I set editor.formatOnSave to false, or when I set editor.defaultFormatter for XML to any installed extension's ID other than DotJoshJohnson.xml.

Formatter Implementation

Which XML Formatter implementation are you using (the value of your xmlTools.xmlFormatterImplementation setting). v2

XML Tools Version

What version of XML Tools are you using? v2.5.1

VS Code Version

What version of VS Code are you using?

Version: 1.59.1

Operating System

What OS (and version) are you using?

macOS Catalina Version: 10.15.7