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

More formatter fixes #1850

Merged
merged 6 commits into from
Jun 16, 2023
Merged

More formatter fixes #1850

merged 6 commits into from
Jun 16, 2023

Conversation

petervdonovan
Copy link
Collaborator

@petervdonovan petervdonovan commented Jun 15, 2023

This runs another pass of optimization. This is a heuristic, but it should not affect idempotency nor other correctness criteria. This can affect performance; however, I modified the formatter to keep track of whether anything has changed so that it knows whether further optimization passes have the potential to give any improved results, so in this common case the performance is not worse. When I ran it on my machine it did not seem much slower than before (around 30 seconds).

Also, when running the formatter from VS Code, we should go ahead even if there are warning or info messages, or syntax errors in the target code. If we can understand the AST, we can pretty-print it.

This runs another pass of optimization. Yes, this is
totally a hacky heuristic, but it should not affect idempotency nor
other correctness criteria. This can affect performance, but I modified
the formatter to keep track of whether anything has changed so that it
knows whether further optimization passes have the potential to give any
improved results.
Previously any messages (even just info messages!) would stop the
formatter from being run, which is an unnecessary requirement. If we can
understand the AST, we can format it.
@petervdonovan petervdonovan marked this pull request as ready for review June 16, 2023 06:01
Copy link
Member

@lhstrh lhstrh left a comment

Choose a reason for hiding this comment

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

Spotted only one issue.

@petervdonovan petervdonovan enabled auto-merge June 16, 2023 06:58
@petervdonovan petervdonovan force-pushed the more-formatter-fixes branch from b1d830f to c8b9f1a Compare June 16, 2023 07:00
Copy link
Collaborator

@cmnrd cmnrd left a comment

Choose a reason for hiding this comment

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

Great! Thanks!

@petervdonovan petervdonovan added this pull request to the merge queue Jun 16, 2023
Merged via the queue into master with commit 1b865f3 Jun 16, 2023
@petervdonovan petervdonovan deleted the more-formatter-fixes branch June 16, 2023 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants