Auto Indent (Ctrl+Alt+L) Breaks Links!

Being a web developer, I often nest languages in a single file. Very common is php + html + mysql in the same file. I've noticed that doing this often interferes aesthetically with PhpStorm's code highlighting and auto-indent feature. This usually isn't a big deal because everything seemed functionally the same at a glance, and the highlighting is just a luxury really. However, today I discovered that the auto-indent can actually break links! This is a huge concern for me because I use the auto-indent feature all the time (Ctrl+Alt+L). 

 

Example:

If you place the following code in an html file:

<p id="forget">Don't forget <a href="<?php echo $pages['RPT-OM'].".html" ?>" title="Example">to buy our stuff!</a>
</p>


Auto-indent (Ctrl+Alt+L) reformat's that as:

<p id="forget">Don't forget <a href="<?php echo $pages['RPT-OM']." .html" ?>" title="Example">to buy our stuff!</a>
</p>

 

These are NOT functionally equivalent! The formatted code has inserted a space in the middle of the URL, causing the link to break! 

Is there a fix for this? Is the bug universal or maybe attributed to my settings? 

Please sign in to leave a comment.