Mixing tabs and spaces in coffesscript


I am brand new to coffeescript and atom package development. I am building off of the ‘generate package’ package and going through some tutorials. I ran into a problem that I believe I understand now but I wanted to post for other noobs.

When I installed Atom I set my setting ‘Tab Type’ to ‘hard’ because it is my personal preference.

However, when I started working on my own package (using ‘generate package’) and I changed anything in the tutorial code I would get this error:

unexpected indentation if file: …

When I changed the tab type setting to ‘auto’ the error goes away (this took me quite a while to diagnose).

After doing some searching it appears that it is a very bad idea to mix tabs and spaces in the same coffeescript file http://stackoverflow.com/questions/7962549/correct-indentation-for-coffee-script
The auto-generated code uses spaces and then I added tabs- not good!

I am looking for confirmation from some experts that mixing tabs and spaces is a problem and that the way to correct the problem is to not mix them (you may have to turn hard tabs off).


I’ve seen it cause problems in CoffeeScript, yes. In general, it leads to heartache.

I’m not sure about the specific cause of the problem you ran into, but yes, this is a good general practice as far as I’m concerned.