-
Notifications
You must be signed in to change notification settings - Fork 82
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
Align XML attributes when formatting #272
Comments
In this case:
Since the attributes are in separate lines, it should be aligned after formatting:
|
This is EditorConfig Rule |
@JessicaJHee I think we can close this issue since the provided new formatter, right? |
@angelozerr The documentation's example indicates the spaces/indentation of the inner element(s) are formatted, but does not state it also affects tags' attributes. If this format rule does affect attributes, then the documentation could be clarified. Edit: also, there's no way to specify that the rule should only apply to attributes i.e. inner elements' spaces should be formatted, but not the attributes. |
The
to:
To address the use case in this comment, we can update this settings with a new option: The new setting would format to:
What do you think about this solution @BinToss? |
That looks perfect! On the subject of editorconfig files and rules, it seems there's been community interest in this extension supporting them, but that's a different issue with a different solution. A quick search in Lemminx's Issues returned no results. |
@BinToss for your information, @JessicaJHee has implemented the format settings of this issue (thanks so much @JessicaJHee !). It would be nice if tomorrow you could install prrelease https://github.com/redhat-developer/vscode-xml#contributing and give us feedback. Thanks! |
@BinToss the prerelease is avaiable, please play with it and give us feedback. Thanks! |
Roger that. I should have time to try it out this weekend. |
Excellent work! The only thing people may complain about is when the formatter can't handle a file with "mixed" formatting—that is, they desire both |
Thanks @BinToss for your feedback. Thanks so much again @JessicaJHee for your great work! |
It would be nice if there was an option to align the beginning of attribute names if the attributes exist in different lines when formatting.
Currently by default, when formatting this XML:
The resulting XML is:
Ideally, after formatting, the initial XML should stay as is.
The text was updated successfully, but these errors were encountered: