Skip to content

Implement closing-block procedure without relying on missed_span module #3691

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

Merged
merged 8 commits into from
Jul 17, 2019

Conversation

topecongiro
Copy link
Contributor

In this PR I have updated close_block so that it does not rely on missed_spans when dealing with the comment between the last statement and the closing brace. This fixes some issues related to the block formatting: see the commits that update tests for detail.

The background and the motivation of this PR: missed_spans is a necessary evil for recovering unformattable code and formatting missing comments. However, it should be the last resort since it's extremely complicated and buggish, especially on handling comments. Also, it's nigh-impossible to implement blank_lines_lower_bound and blank_lines_upper_bound correctly if we rely on missed_spans for handling comments between items, statements and blocks.

The current implementation is not really well-thought, adding a better abstraction will be future work. I am planning to do it on fixing blank_lines_lower_bound.

Copy link
Contributor

@scampi scampi left a comment

Choose a reason for hiding this comment

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

LGTM!

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.

2 participants