0

I want an IDE or text editor that automatically (when clicking in the indent button) reindents every line of code (from the begining to the end).

For example, Sublime 3 doesn't do this. It just reindents everything based on your position of the cursor when you press Ctrl+Shift+V or (another example) this code:

echo "<li id='officeHeader'>
<a href='#' class='dropdown-toggle'>
    <i class='menu-icon fa fa-desktop'></i>
    <span class='menu-text'>
        Text
    </span>

    <b class='arrow fa fa-angle-down'></b>
</a>

<b class='arrow'></b>

<ul class='submenu'>
    <li id='navCompany'>
        <a href='#'>
            <i class='menu-icon fa fa-caret-right'></i>
            Text
        </a>

        <b class='arrow'></b>
    </li>

    <li id='navUser'>
        <a href='#'>
            <i class='menu-icon fa fa-caret-right'></i>
            Uses
        </a>

        <b class='arrow'></b>
    </li>

    <li id='navPublication'>
        <a href='#'>
            <i class='menu-icon fa fa-caret-right'></i>
            Public          </a>

        <b class='arrow'></b>
    </li>
</ul>
</li>";
2

3 Answers 3

1

I use Visual Studio Code to indent my messy code before I make any commit. I have tried this feature in Aptana Studio, Brackets, PHPStorm and Atom. VS Code does it best (in my opinion).

The code you've shared may need to be indented as HTML separately.

0

Plugin exists for CudaText editor. Cross-platform, free.

  • menu item Plugins/ Addon Manager/ Install
  • choose plugin HTML Tidy, install it
  • open your HTML file with wrong indent
  • call menu Plugins/ HTML Tidy/ Menu, choose "Reformat only"
0

Almost all IDEs I know do indent everything. Even a text editor like Notepad++ has a builtin plugin to indent the whole file. I believe Sublime also supports the same. However if you want another IDE then:

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.