CoffeeScriptRedux icon indicating copy to clipboard operation
CoffeeScriptRedux copied to clipboard

Unexpected ',' when used to start line

Open vjpr opened this issue 13 years ago • 4 comments

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 : 

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/85531-unexpected-when-used-to-start-line?utm_campaign=plugin&utm_content=tracker%2F33145&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F33145&utm_medium=issues&utm_source=github).

vjpr avatar Sep 28 '12 02:09 vjpr

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'

jtackaberry avatar Oct 17 '12 21:10 jtackaberry

Yeah, sorry about that. I need to loosen up the whitespace allowances regarding argument lists and member accesses.

michaelficarra avatar Oct 17 '12 21:10 michaelficarra

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 avatar Feb 27 '13 20:02 euskode

@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.

michaelficarra avatar Feb 27 '13 20:02 michaelficarra