Skip to content
This repository has been archived by the owner on Oct 19, 2021. It is now read-only.

Inconsistent indentation not triggered #485

Open
royaldark opened this issue Aug 10, 2015 · 2 comments
Open

Inconsistent indentation not triggered #485

royaldark opened this issue Aug 10, 2015 · 2 comments

Comments

@royaldark
Copy link

Why does this trigger the inconsistent indentation error (expected 2, got 1):

->
 a
 b

...but this does not?

->
  a
 b

The second is actually far worse, since it compiles to valid but unexpected JS:

(function() {
  return a;
});

b;

I'm running the newest version, 1.10.1.

@swang
Copy link
Collaborator

swang commented Aug 10, 2015

Unfortunately this is due to CoffeeScript's parser. It does not return an INDENT token for b statement, rather it gives an OUTDENT token.

Since spacing of 1 space is allowed in CoffeeScript, it assumes you are indenting by one space, and that the b statement is just a outdent of 1, rather than an indentation of 1 (which would trigger inconsistent indentation rule)

I will try to take a look at this bug, as it may be easier to catch than the other INDENT issues we've had. Thanks for the report.

@swang
Copy link
Collaborator

swang commented Aug 13, 2015

Hello. Basically what is happening can probably be explained in this issue jashkenas/coffeescript#3998. I don't know if this is really fixable without getting some help from the CoffeeScript developers.

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

No branches or pull requests

2 participants