-
Notifications
You must be signed in to change notification settings - Fork 93
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
Preserve invalid content while formatting #1041
Comments
Fixes eclipse-lemminx#1041 Signed-off-by: azerr <[email protected]>
Fixes eclipse-lemminx#1041 Signed-off-by: azerr <[email protected]>
fully agree with this issue, this is a "killer" for me at the moment, as I have to disable xml formatting altogether for the (many) documents where I use macros that insert credentials in xml fields. |
Fixes eclipse-lemminx#1041 Signed-off-by: azerr <[email protected]>
Fixes eclipse-lemminx#1041 Signed-off-by: azerr <[email protected]>
Fixes eclipse-lemminx#1041 Signed-off-by: azerr <[email protected]>
Fixes eclipse-lemminx#1041 Signed-off-by: azerr <[email protected]>
Fixes eclipse-lemminx#1041 Signed-off-by: azerr <[email protected]>
This issue should be fixed by the experimental formatter https://github.com/redhat-developer/vscode-xml/blob/master/docs/Formatting.md#xmlformatexperimental |
When formatting is done with invalid content theinvalid content is lost.
For instance given this XML content:
<a=
After formatting we lose the invalid content
=
<a
There are several issues with this problem:
and a PR which tries to fix the problem with invalid content inside tag element #766
Today the formatting process load the XML content to format in a DOM Document and the DOM document is visited and we generate the XML content according DOM node type. At the end of the process we return ONE TextEdit which contains the generates XML string.
I think it's not the right way. Indeed after studying the formatting support in the WTP XML Editor (which preserve invalid content), the right way is to create several TextEdits (instead of one textedit) when a format must be done (ex : we create a TextEdit to format a start tag element to indent it, create N TextEdit to format N start tag element to indent them).
See https://github.com/kingargyle/wtp-sourceediting/blob/master/plugins/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/formatter/DefaultXMLPartitionFormatter.java from WTP which uses this strategy.
It's a lot of work, but IMHO I think we should do that to have a clean XML formatter.
The text was updated successfully, but these errors were encountered: