-
Notifications
You must be signed in to change notification settings - Fork 458
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
how to indent multi-line XML #319
Comments
I assume that you used the eclipse formatter. Your example above is irritating in that respect. Just had a look myself. You are right, Eclipse WTP only offers configuration of argument indentation in case the maximum line width is exceeded, or to place all arguments on separated lines. |
@fvgh this is actually the The most weird thing for this is that when running code format manually in the IDE, the format is changed to match that of the last example, although running spotlessApply after the change doesn't change it back. This to me seems a bit inconsistent as it should stick either one of the formats; spotless seems to not care about the extra indents. EDIT: I just checked, this is default for Intellij XML formatter, this is not restricted to AndroidStudio |
I guess you are right in that I need to write a custom xml formatter for this additional change. But maybe this can be handled by adding support for IntelliJ's formatters as well. |
@fvgh This can be handled by adding a custom formatter for Intellij. Is this something that will be pulled to the core if worked on? I can see that formatting is done generically in |
This would definitely be pulled to core if you follow this. |
@Avinash-Bhat
You configured
Both formatter steps do not care about indents. The thing is that you configure a chain of formatters. If you add the Eclipse formatter, it would alter indents, but unfortunately not in the way you want it. Does this answer settles your questions? |
@Avinash-Bhat I consider this issue solved. Let me know if there are still open issues from your side. |
summary of problem
Consider the following unformatted xml snippet below:
when running with a configuration of:
the xml gets formatted to:
how ever I want it to indent the multi-line xml to add an additional indent (i.e., here
package
should start as the 9th character instead of being the 5th)i.e., like this:
Is is possible to get something like this with the current state of spotless? if not, should & could this be done using custom formatter?
PS the above xml can also be formatted to start indenting at the position of the first argument.
i.e.:
The text was updated successfully, but these errors were encountered: