Semicolon bug when making snippet, bans additional snips


#1

Hi, there is a bug in snippets.cson, when making multiple js snips I follow the snip pattern, and end all statements with colons. Suddenly, it starts to complain about “unexpected symbol :”, when I used a : in all other places. From the pasted code, the error stops when removing the colon from ‘if/elif/else statement’. Since there seems no logical explanation, pattern, or way to predict when this breaks, it looks like a bug. Even worse, all other snippets I add, both before and after the if/elif/else snippet, all break with “unexpected newline”. These snippets also follow the convention, I tried with or without the colon that was causing problems, and remembered to go spaces --> tabs, basically telling me I’m not allowed any more snippets. The file as shown below actually works somehow, even the last snip, but adding more snips doesn’t work (if I add more snips, the ones before them all work still). The error is near the bottom of the file, I added it all for completeness

https://gist.github.com/lcodyc4321/e7e291d655ca8b588341


#2

Looks like you forgot a semicolon at the end of line 123 :smile:


#3

All of the examples I’ve seen of block strings in CoffeeScript show the ending triple quote being on a line of its own. Also if you look at the documentation, it says that indentation is maintained, so you don’t have to go to the left column to align things properly. For example, this:

	'fake foreign key':
		'prefix': 'fkey'
		'body': """
$1 = factory.SubFactory('testing.factories.$2')$3"""

Should probably look like this:

	'fake foreign key':
		'prefix': 'fkey'
		'body': """
                        $1 = factory.SubFactory('testing.factories.$2')$3
                        """

#4

olmo that’s the shocking thing…this example is what WORKS, in fact, with the colon there, it doesn’t work


#5

@leedohm lee, I tried and yet there is no improvement. when adding the correct colon where it should go, I get “unexpected :” just as before. the new gist is not formatting correctly, but on my machine the triple quotes and all else are aligned correctly

https://gist.github.com/lcodyc4321/40ca1e3fe655c0effc40


#6

It seems you were using a mix of spaces and tabs for indentation, which is something coffeescript is not happy with… You can find the fixed version in this gist:
https://gist.github.com/olmokramer/17274f4d9fccef0a917b