My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 64: Indenting 'leading comma' style
2 people starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  ----


Sign in to add a comment
 
Reported by pdcaw...@gmail.com, Apr 28, 2008
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.


js2.diff
2.3 KB   View   Download
Jul 23, 2009
Project Member #1 steve.ye...@gmail.com
(No comment was entered for this change.)
Labels: -Type-Defect -Priority-Medium Type-Enhancement Priority-Low
Sign in to add a comment

Powered by Google Project Hosting