How to make text Indent in Webstorm

30,271

Solution 1

You should select Code | Reformat code in main menu. Also you could control how your code will be reformatted in Settings | Code Style.

Additional info can be found in WebStorm help

Solution 2

For Mac:

Command + Alt + L for "Reformat Code".

Ctrl + Alt + I for "Auto-indent line(s)".

You can also select a block of text with the cursor and use tab or shift+tab to move the block to the right and to the left, respectively.

You can edit how your code looks further by going to Preferences | Editor | Code Style.

Solution 3

If you are on Windows then:

1.Select the area of code you want to intent (use Ctrl+A to select all lines ).

2.Now press Ctrl+Alt+I to auto-intent.

Solution 4

Although you can use auto-indentation but take a look at its settings,

In Webstrom or any JetBrain's IDE:

Preferences(setting) > Editor > Code Style

choose your playground and then changes this value to your desire:

enter image description here

(Most JavaScript developers use above settings)

Share:
30,271

Related videos on Youtube

Lir An
Author by

Lir An

Updated on December 23, 2020

Comments

  • Lir An
    Lir An over 3 years

    I'm using Webstorm to write my code.

    my code is a mess now,

    how can I arrange it nicely and do text Indent?

  • timhc22
    timhc22 over 8 years
    Strange, my code was indenting by 2 spaces only (despite being set to 4), but after reformatting using this, it started working correctly
  • Vishak Partha
    Vishak Partha over 3 years
    As people have suggested in other answers, the shortcut to Reformat Code is Ctrl + Shift + L. I'd suggest tying this with a editorconfig file. Works well for most projects!