Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support comma-first style for variable declaration #388

Closed
vincentbernat opened this issue Dec 13, 2014 · 6 comments
Closed

Support comma-first style for variable declaration #388

vincentbernat opened this issue Dec 13, 2014 · 6 comments

Comments

@vincentbernat
Copy link

Hey!

The comma-first style for variable declaration looks like that:

var a= 47
  , b = 48
  , c = 49
  ;

This is a somewhat popular choice because it is easier to spot a missing comma and adding a variable at the end doesn't produce a two-line patches.

Currently, web-mode does that:

var a = 47
, b = 48
, c = 49
;

Funny enough, if I replace one value by a function call, I get this:

var a = require('titi')
    , b = 48
, c = 49
;

Would it be possible to support this comma-first style?

@vincentbernat
Copy link
Author

Humm, I just noticed that the more classic style is not supported correctly either:

var a = 47,
    b = 48,
    c = 49;

Instead:

var a = 47,
b = 48,
c = 49;

@fxbois
Copy link
Owner

fxbois commented Dec 13, 2014

@vincentbernat je vais regarder cela

@fxbois
Copy link
Owner

fxbois commented Dec 13, 2014

@vincentbernat please test the last commit

@vincentbernat
Copy link
Author

That was fast!

var a= 47
  , b = 48
  , c = 49
;

Usually, the semi-colon is aligned with the comma, but I can live with that. However, it seems that when there is a function call, things go awry:

var a = require('titi')
              , b = 48
              , c = 49
;

@fxbois
Copy link
Owner

fxbois commented Dec 14, 2014

@vincentbernat I've committed a new patch

@vincentbernat
Copy link
Author

❦ 14 décembre 2014 12:02 -0800, fxbois notifications@github.com :

@vincentbernat I've committed a new patch

This one works fine, thanks!

I don't know half of you half as well as I should like; and I like less
than half of you half as well as you deserve.
-- J. R. R. Tolkien

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants