Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retain do-block and chained .method newlines in compiled javascript #115

Open
blendmaster opened this issue Mar 7, 2012 · 1 comment
Open

Comments

@blendmaster
Copy link

The do block and spaced dot attribute syntax make for really nice looking coco, but the compiled javascript collapses all the newlines inside a do-block or the usual jQuery chaining style method calls:

method do
  firstArgument
  secondArgument
  thirdArgument

object
  .chain stuff, ->
    method
  .chain more_stuff, with_multiple_args
  .chain even_more_stuff

currently compiles to

method(firstArgument, secondArgument, thirdArgument);
object.chain(stuff, function(){
  return method;
}).chain(more_stuff, with_multiple_args).chain(even_more_stuff);

I'd like it to compile to:

method(
  firstArgument,
  secondArgument,
  thirdArgument);

object
  .chain(stuff, function(){
    return method;
  })
  .chain(more_stuff, with_multiple_args)
  .chain(even_more_stuff);

which would make reading and debugging the resulting javascript easier, especially for methods with lots of arguments or complicated expressions as arguments.

@satyr
Copy link
Owner

satyr commented Mar 7, 2012

Patches welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants