26

I'm using Webstorm to write my code.

my code is a mess now,

how can I arrange it nicely and do text Indent?

4

4 回答 4

44

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

于 2013-06-21T10:05:32.290 回答
9

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.

于 2016-04-04T19:51:36.790 回答
6

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.

于 2016-06-22T23:53:38.460 回答
5

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)

于 2018-12-22T20:30:18.580 回答