-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
While reading lexer.coffee I noticed the bug regarding @outdebt ("The under-outdentation at the current level") that @avakar found playing with indentation and reported in #4127. I think @avakar was right that @vendethiel misunderstood the issue, it's not about @baseIndent and isn't equivalent to #1275 (#3320, which closed #1275, preserved the existing broken logic re @outdebt). And it's not about removing the "non-matching indent-dedent rule" (which would break lots of code), it's about implementing it correctly (which could break some code?). So I'll submit a fixing PR momentarily but not sure if it should be held back to 2.0?
To illustrate:
This doesn't parse:
switch a
when b
c
when d then e
when f then g
but this works:
switch a
when b
c
when d then e
when f then g
Basically (as pointed out by @avakar in #4127) the logic for "consuming" @outdebt should just involve @outdebt and moveOut, not lastIndent (which in the above example would be the 2-space indentation under switch, which is irrelevant to @outdebt when handling the dedent starting the when f then g line). The PR I'll submit includes tests for the above broken case as well as the one supplied by @avakar in #4127