Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Eclipse format comma-separated statements (var a = 1, b=2;) on different lines?

I am using Eclipse JSDT and the default formatting settings change something like

var a = 1,
    b = 2;

to be on one ugly line.

The style before formatting is recommended by JSLint, so I am wondering can Eclipse be set to format it this way? The existing formatter settings does not offer controls over the comma statement it seems.

like image 546
billc.cn Avatar asked Apr 05 '12 14:04

billc.cn


1 Answers

Following JavaScript Beautifier plug-in is available for Eclipse.

https://github.com/atlanto/eclipse-javascript-formatter

It can be used to span single statement - multiple variable declarations into multiple lines.

More information about using the above plug-in is given in the README.md file.

like image 113
Sasidhar Vanga Avatar answered Sep 20 '22 02:09

Sasidhar Vanga