简体   繁体   中英

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 = .

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.

Editor > Code Style > Javascript > 'Other' tab

Formatting options:

  • Align object properties: On colon
  • Align 'var' statements and assignments: Align multiline 'var' statements

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM