Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intellij Formatting variable declarations

Does intellij have an option to align javascript variable declarations like so

var x     = "x",
    yyyy  = "y";  

Note that the = are aligned neatly. I can't find an option to do that....worse, if I do it by hand, and then format the file, I lose the alignment on the =.

like image 520
hvgotcodes Avatar asked Nov 09 '11 16:11

hvgotcodes


2 Answers

IDEA11 can definitely align javascript properties - see the Other tab on the Javascript code style.

In the Java code style options there is Wrapping and Braces - Field groups - Align in columns.

However, for js variables you might have to resort to a plugin.

Try DefinitionEqualizer.

like image 161
opticyclic Avatar answered Oct 13 '22 20:10

opticyclic


Editor > Code Style > Javascript > 'Other' tab

Formatting options:

  • Align object properties: On colon
  • Align 'var' statements and assignments: Align multiline 'var' statements
like image 31
dbarton_uk Avatar answered Oct 13 '22 19:10

dbarton_uk