-
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
Improve text formatting for experimental formatter #1336
Improve text formatting for experimental formatter #1336
Conversation
...test/java/org/eclipse/lemminx/services/format/experimental/XMLFormatterExperimentalTest.java
Outdated
Show resolved
Hide resolved
.../java/org/eclipse/lemminx/services/format/experimental/XMLFormatterJoinCommentLinesTest.java
Show resolved
Hide resolved
213e8cd
to
2e21a02
Compare
...test/java/org/eclipse/lemminx/services/format/experimental/XMLFormatterExperimentalTest.java
Outdated
Show resolved
Hide resolved
2e21a02
to
dac1d9f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am good with this change. Thanks Jessica! I think we discussed waiting until after the release to make this change though.
@angelozerr what do you think about this change? Jessica wanted to wait until after the release before merging it, but I think it should be good to go now. |
I'm really sorry @JessicaJHee @datho7561 to not have reviewed the PR -( When I see tests, it seems we are different from Oxygen formatter, right? It doesn't follow the behavior described in https://github.com/redhat-developer/vscode-xml/blob/main/docs/Formatting.md#xmlformatexperimental ? |
I wonder if this PR should cover the usecase: <foo>
<bar>
</bar>
</foo> to indent correctly bar <foo>
<bar>
</bar>
</foo> but perhaps teh Oxygen behavior doesn't allow that? |
Yes it is a bit different when it comes to text formatting since oxygen will always join text content/ normalize the space between text content by default. It is more similar to IntelliJ. I waned to see how you feel about the changes since it is quite different from before. There are a lot of cases to consider but I think with this PR it would be easier to discuss how we want the behavior for text formatting to be like!
I wasn't sure because in this case we normalize the space if the content is empty (contains only white space and new lines). Unfortunately I don't have access to try oxygen anymore. |
Indeed we need to specify more teh behavior of the formatting. My wish is to have the IJ and Oxygen behavior both (with a new settings). I think it is important to preserve Oxygen behavior, because it fixed #594 (I suggest that you read all comments). If we could provide a new settings which format ala IJ, it should be very nice.
IMHO I think we should take care of this usecase (setting a la IJ). |
dac1d9f
to
be6d79d
Compare
After reading the previous issue on this, I think it makes sense to set I have added a few tests that relate to the sample provided in the issue mentioned in For the case empty tags, perhaps we could add a setting (something like 'normalizeSpaceInEmptyElement') if necessary? |
I think that this is a good idea. The Oxygen formatter handles mixed content very well, so using this behaviour by default is a good idea.
What should the default behaviour be for empty tags? I think it would be nice to completely remove the content (eg. |
d531592
to
8ed23a6
Compare
Signed-off-by: Jessica He <[email protected]>
8ed23a6
to
17d54be
Compare
Impressive @JessicaJHee ! Thanks so much. Now we should update vscode-xml doc. |
Fixes #1331
Signed-off-by: Jessica He [email protected]