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
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.
If you have the same problem, but your indentation is okay,
then you must be suffering from bug 2868.
Basically, the error is misleading. Check for indentation
errors in the require
d files.
If you are using a JetBrains IDE (IntelliJ, PHPStorm, etc) the change of setting that worked for me is:
File > Settings > Project Settings > Code Style > CoffeeScript > Tabs and Indents
Tick "Use tab character" & "Smart tabs"
Code is fine. Make sure you haven't messed up the whitespace (strange control chars showing as blanks, tabs or similar).
When in Atom you can automatically convert tabs to spaces:
Packages > Whitespace > Convert Tabs to Spaces
You can resolve this two ways 1. IF using webstorm File->Default Settings as said above 2. Other workaround, is to use a different editor like Sublime, there u can press enter on earlier line and it will auto tab it for you with spaces