How can I make webstorm format my html the way eclipse does?

12,223

Solution 1

Make sure that <table> and <tr> are not listed in Settings/Code Style/HTML/Other/Do not indent children of: option - this should help when formatting HTML. But note that it won't work for JSP - actually there is no way to get formatting working for jsp files in WebStorm. See WEB-527

Solution 2

On the Main menu-->choose Code-->Reformat Code or press Ctrl+Alt+L.

In the Reformat Code dialog box, specify the reformatting scope: The current file. Selected text. All files in the current directory, including or omitting subdirectories. You can also include optimizing imports, by selecting the Optimize imports check box, which is enabled for the current directory only. Click Run.

Share:
12,223
Slartibartfast
Author by

Slartibartfast

Turning coffee into solutions since 1996

Updated on June 14, 2022

Comments

  • Slartibartfast
    Slartibartfast almost 2 years

    That is instead of

    <table>
    <tr>
    <td>content</td>
    </tr>
    <table>
    

    I would like

    <table>
       <tr>
         <td>content</td>
       </tr>
    </table>
    

    I've tried reformat, but it always gives me the top result. I've tried the call to action and went into the format settings, but it didn't change anything.

    This seems trivial, but I have a huge unformatted .jsp file and it is impossible to work with in WebStorm.

  • Shivku
    Shivku almost 3 years
    This should, ideally, have been the default setting in WebStorm. 7 years since this question, and the default setting is still the same as it was before.