CoffeeScriptRedux
CoffeeScriptRedux copied to clipboard
Unexpected ',' when used to start line
Code
_.delay =>
if not rpcConnected
if retryCount < 3
connect()
tryConnect()
retryCount += 1
else
authManager.connectionFailed()
, 800
Error
Error: Syntax error on line 138, column 7: unexpected ','
135 : retryCount += 1
136 : else
137 : authManager.connectionFailed()
138 : , 800
^^^ :~~~~~~~^
139 :
Same thing happens when lines start with . which is often the case when using chaining:
$.ajax('/api/foo')
.done(result) ->
alert 'done'
.fail ->
alert 'failed'
This compiles with CoffeeScript 1.3.3, but with CoffeScriptRedux:
Syntax error on line 2, column 5: unexpected '.'
1 : $.ajax('/api/foo')
2 : .done(result) ->
^ :~~~~~^
3 : alert 'done'
4 : .fail ->
5 : alert 'failed'
Yeah, sorry about that. I need to loosen up the whitespace allowances regarding argument lists and member accesses.
Is there a temporary solution to this that does not involve much refactoring? I am having the same issues myself everywhere we use _.delay. This may well be the only issue preventing us from using CoffeeScriptRedux with WebStorm 6's source map support!
@euskode: This will be fixed before 2.0, but I'm not working on it just yet. For now, just pull out the function and name it or flip _.delay.