1

I don't understand how can I format correctly HTML code when is surrounded between PHP tags when I click "Auto-Indent Lines".

What do I expect:

enter image description here

What PhpStorm does when I click "Auto-Indent Lines".:

enter image description here

3
  • Can you not just hit the tab button instead of clicking the auto-indent? Commented Apr 28, 2016 at 9:55
  • The problem is that I have .php files with hundreds/thousand lines of code that I want to re-format Commented Apr 28, 2016 at 10:01
  • 1
    PhpStorm is formatting the php, not the html that the php will generate. So there is not much you can do about that unless you use html templates in separate files that PhpStorm will recognize as html. Commented Apr 28, 2016 at 10:02

2 Answers 2

1

Please see comments in WI-17786. In general, it's not currently possible to format HTML mixed with PHP

Sign up to request clarification or add additional context in comments.

1 Comment

I had already seen this page, but I thought concern another bug (after all my english sucks, so ...). Thank you very much
0

enter image description here

You can change that behaviour in the PHPStorm Preferences. Open your Preferences... When the Window opens; type Code Style to search for that Keyword. Then under the Menu select HTML.... Here You can decide how your HTML would be formatted or you may select any Language like PHP...

However; you may have to restart PHPStorm for the Effect to take place.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.