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

Comma formatting results in invalid syntax #46

Closed
chapmandu opened this issue Oct 20, 2019 · 1 comment
Closed

Comma formatting results in invalid syntax #46

chapmandu opened this issue Oct 20, 2019 · 1 comment

Comments

@chapmandu
Copy link

This may be an edge case and tricky to solve, but changing leading to trailing commas with a commented line of code results in a syntax exception. Note missing comma after local.from,

input:

send(
  to = local.to
  ,from = local.from
  // ,user=local.user
  // ,thing=local.thing
  ,body = local.body
);

result:

send(
  to = local.to,
  from = local.from
  // ,user=local.user, // ,thing=local.thing
  body = local.body
);

expected:

send(
  to = local.to,
  from = local.from,
  // ,user=local.user, // ,thing=local.thing
  body = local.body
);
@jcberquist
Copy link
Owner

Thanks for the report, this is getting tricky :) Even prettier will start inlining multiple comments at a certain point, but it doesn't eat any code. I have a potential fix in place that I will push, and it passes the tests, but I am not confident that there isn't another scenario out there that will break things still.

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