+7

Ignore comment-only lines when guessing indentation of buffer

Joel Thornton 12 years ago 0
Comment-only lines should be ignored when guessing the indentation of a buffer.


The problem applies to JSDoc comments; with a buffer looking like this:


/**
  * @class
  * Class description.
  * Next line
  * Next line
  * Next line
  * @constructor
  */
var SomeClass = function() {
    this.foo = 1;
    this.bar = 2;
}
/**
  * @class
  * Class description.
  * Next line
  * Next line
  * Next line
  * @constructor
  */
var SomeClass2 = function() {
    this.foo = 1;
    this.bar = 2;
}
 

... Sublime Text 2 guesses an indentation width of 2. However, the code actually has an indentation width of 4, but ST2 is taking the apparent indentation of the comment blocks into account.