I'm using PhpStorm 2016.2 and developing a web application with VueJS.
In PhpStorm I would like reformat HTML code in my JavaScript file. But when I click Code | Reformat only JavaScript is reformatted.
How to reformat both JavaScript and HTML?
2016.2 doesn't support formatting HTML injected in Typescript/ECMAScript 6. This feature (WEB-18307) is available since 2017.1, see https://www.jetbrains.com/help/webstorm/2017.1/using-language-injections.html#d240474e440
Have a look at the Code Style options:
These are my settings and my mixed HTML/JavaScript gets formatted nicely
Also, make sure you are using the necessary escape tags on quotations when needed and that closing braces/semicolons are placed properly before running reformat.
Your JavaScript object's "template" uses a ' (single quote) to open what looks like a multi-line string. There appears to be another single quote on line 49 that may be messing up the inspector.
In the situation that your HTML is in a JavaScript string, it will (correctly) not be formatted. I would recommend doing the following:
Alt+Enterwhile having caret on HTML part and chooseEdit Fragment(or similarly named entry) from appeared menu. You can then invoke Reformat in separate split. Once done -- just close it (that split).