I'm using Phpstorm and I have some XML file that is a single line only but contains a lot of (nested) elements. Just a common XML file:
<?xml version="1.0" encoding="UTF-8"?>
<response><status><version>4.2</version><code>0</code><message>Success</message></status><songs><song>...
(gist of the full XML).
Having that file opened, I want to re-format it with indenting.
I have tried using Reformat Code... (Ctrl + Alt + L) but it didn't change anything. I also reviewed the XML Code-Style Settings, but I don't see anything standing in the way.
Isn't it possible for Phpstorm to re-format an XML file to indent nested XML elements?
Something into the direction like:
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<version>4.2</version>
<code>0</code>
<message>Success</message>
</status>
<songs>
<song>
...
In the editor, select a code fragment you want to reformat. Before reformatting, you can take a look at the code style settings that are applied to the selected code: press Alt+Enter and click Adjust code style settings. From the main menu, select Code | Reformat Code or press Ctrl+Alt+L .
Works for me (tried on full XML, not snippet) -- it took about 5-7 seconds to do .. but did it properly (PhpStorm v6 EAP build 124.373).
Most likely it's your settings (Code Style | XML | Other): maybe you have "Keep line breaks" option checked or similar option?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With