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

Formatter: Support comments #1172

Merged
merged 27 commits into from
Oct 6, 2022
Merged

Formatter: Support comments #1172

merged 27 commits into from
Oct 6, 2022

Conversation

jubnzv
Copy link
Contributor

@jubnzv jubnzv commented Sep 21, 2022

Closes #1086

Set the location of the `Let` node as the start of the `let` keyword in
the source code.  This is necessary for the formatter implementation.
This is not finished work.

We need to support:
+ top-level comments
+ comments between components

And test it properly.

Closes Zilliqa#1086
@jubnzv jubnzv marked this pull request as ready for review October 2, 2022 11:31
@jubnzv jubnzv mentioned this pull request Oct 2, 2022
14 tasks
Copy link
Contributor

@jjcnn jjcnn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

It would be fun to stress-test the formatter with some really weirdly placed comments, but it's not a high priority.

@jubnzv
Copy link
Contributor Author

jubnzv commented Oct 5, 2022

@jjcnn Thanks!

I tried the formatter on marketplace-contracts and the formatted code seems good. I also ran it on the dump of all deployed contracts (see #1120) and, at least, it doesn't crush and generates readable code.

Of course, there may be cases that we have not taken into account, but we could fix them in the next release.

@jubnzv jubnzv merged commit 79c5282 into Zilliqa:master Oct 6, 2022
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

Successfully merging this pull request may close these issues.

Keep comments and whitespace in AST
2 participants