Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make IntelliJ IDEA keep HTML nested tabbing?

When i format document, instead of keeping original tabbing structure:

<div class="topbar">
    <div class="topbar-wrapper">
        <div class="js-topbar-dialog-corral">
            <div class="topbar-dialog siteSwitcher-dialog dno">
            </div>
        </div>
    </div>
</div>

IDEA breaks it:

enter image description here

How to turn off that behaviour?

like image 744
message Avatar asked Apr 25 '14 09:04

message


People also ask

How do I indent HTML in IntelliJ?

If you need to adjust indentation settings, in the Settings/Preferences dialog ( Ctrl+Alt+S ), go to Editor | Code Style. On the appropriate language page, on the Tabs and Indents tab, specify the appropriate indents options and click OK.

Can we do HTML in IntelliJ IDEA?

HTML IntelliJ IDEA brings powerful support for HTML that includes syntax and error highlighting, formatting according to the code style, structure validation, code completion, on-the-fly preview during a debugging session (Live Edit) or in the dedicated preview tab in the code editor, and much more.

What are smart tabs IntelliJ?

IDEA has a “smart tabs” option that you can turn on: If this check box is selected, IntelliJ IDEA inserts tabs for indentation and reformatting, but fine alignment to a necessary column is done only via spaces. This is done in order to preserve visual representation of the source code, when the Tab Size is changed.


1 Answers

Take a look at your settings under Code Style, Html, then under the Other tab:

enter image description here

You should check the Do not indent children of: entry. You may want to play with these things until you get the style that you want. If it still isn't working, then maybe your document isn't xhtml compliant -- that is, it may be unbalanced, which although legal html, makes it difficult for Idea to format.

like image 155
Software Engineer Avatar answered Oct 11 '22 13:10

Software Engineer