Unexpected 'INDENT' in CoffeeScript Example Code

后端 未结 6 1201
悲哀的现实
悲哀的现实 2020-12-15 17:21

As I was playing around for the first time with CoffeeScript, I ran in to a problem. In order to debug my problem, I tried replacing my whole file with one of the example b

6条回答
  •  -上瘾入骨i
    2020-12-15 17:28

    I am pretty sure this is a tabs-vs-spaces issue. Tell your editor not to convert spaces to tabs if it does that. Also, go through your code with the cursor and make sure it doesn't jump over blank areas.

    The issue is that while normal editors see a tab as equivalent to two or four spaces, coffeescript sees it as one space, so the indentation gets messed up.

    If this all doesn't help, make sure you have a recent coffeescript version, e.g. 1.1.0 or newer.

提交回复
热议问题