-
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
Format XML split attributes with closing tag on new line #435
Comments
@fbricon what do you think about this format settings? @datho7561 do you think it can be easy to implement it? |
Its not trivial to implement, since you need to take into account |
Also, we would need to decide how formatting with just one attribute is handled |
@datho7561 it looks like the current setting for <tag attr1="" /> So, current behavior seems to be only split when more than 1 attribute. Not sure if there should be another setting for a single attribute decision but it does counteract the main reason I was looking into having the ending of the tag be on a new line. (The easy movement/duplication of attribute lines with vscode shortcuts) If following the understanding of making it easier to manage attributes with the shortcuts (including all line operations), I believe there should be a way to have a single attribute being split to a separate line as well. |
Format suggestion: Indent the closing part the same level the attributes are indented:
This follows the Zope's toolkit ZCML style guide: https://zopetoolkit.readthedocs.io/en/latest/codingstyle/zcml-style.html#opening-tags |
I'm interested in taking this issue. |
Before working on this issue, perhaps we should rewrite the XML formatter (see PR eclipse-lemminx/lemminx#1044) @datho7561 what do you think about that? |
I think the formatter rewrite will take a while. In the mean time, it would be neat to support this feature. It shouldn't require many changes to the existing formatter to implement this feature. |
When working in vscode, I like to use the Alt+Up and Alt+Down keybinding for moving stuff around, and allowing for the ending of the tag to be on a new line if the attributes are aligned would be very helpful.
current:
proposed:
proposed setting:
xml.format.splitAttributesCloseNewLine = true
- only use ifxml.format.splitAttributes = true
.The text was updated successfully, but these errors were encountered: