Reputation: 14856
I'd like to put arguments on different lines, but I get parse errors on all the variations I try, including adding commas, allwin-style parens, and different indentations.
constructor: (
@a
@b
@c
) ->
Upvotes: 14
Views: 4608
Reputation: 5774
Try:
constructor:\
( @a
, @b
, @c
) ->
Both trailing \
and leading ,
suppress newlines in CoffeeScript.
Upvotes: 26
Reputation: 48137
It appears you are out of luck. If you look at the grammar rules for the function definition, you will see that the rule is defined as:
'PARAM_START ParamList PARAM_END FuncGlyph Block'
The rule for Block
allows for TERMINATOR
tokens (which are semi-colon or carriage return) but the ParamList
rule (the one you are interested in adding a new line in) does not allow for it.
Upvotes: 1