yoya / js2-mode

Automatically exported from code.google.com/p/js2-mode
0 stars 0 forks source link

Indenting 'leading comma' style #64

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Here's some code written in a "leading comma" style, laid out as I'd like.

(function () {
   namespace.thing = function () {
     this.init();
   };
   var thing = namespace.thing
   , Lang = YAHOO.lang
   , Dom = YAHOO.util.Dom
   ;

   thing.prototype = 
   { init: function () {
       ...
     }
   , doSomething: function () {
       ...
     }
   };
})();

However, js2-20080424.el indents it as:

var namespace = { };

(function () {
   namespace.thing = function () {
     this.init();
   };

   var thing = namespace.thing
   , Lang = YAHOO.lang
   , Dom = YAHOO.util.Dom
   ;

   thing.prototype = 
     { init: function () {
         // ...
       }
       , doSomething: function () {
         // ...
       }
     };
 })();

Which is surprisingly close to, yet annoyingly far from the right thing for my 
money.

I've attached a patch that fixes things to my taste, but I'm not sure if it 
breaks things to others' 
tastes. It shouldn't be too hard to make it customizable though.

Original issue reported on code.google.com by pdcaw...@gmail.com on 28 Apr 2008 at 3:46

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by steve.ye...@gmail.com on 23 Jul 2009 at 11:42