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

Fix extra whitespace in text rendering of indented empty lines #2101

Merged
merged 1 commit into from
May 19, 2023

Conversation

paulcadman
Copy link
Collaborator

@paulcadman paulcadman commented May 16, 2023

The prettyprinter library takes care to avoid adding whitespace to empty lines when it is rendering indented text.

See:

https://github.com/quchen/prettyprinter/blob/7e32c010ecfaa510c0cbf6ffea04bc7db95d4fcb/prettyprinter/src/Prettyprinter/Internal.hs#L1999

However it only does this for unannotated text.

In our code we were stripping annotations from renderings within toTextStream but we must remove the annotations before calling layoutPretty to get the proper handling of whitespace with indentations. That's what this PR does.

The prettyprinter library takes care avoid adding whitespace to empty
lines when it is rendering indented text.

See:

https://github.com/quchen/prettyprinter/blob/7e32c010ecfaa510c0cbf6ffea04bc7db95d4fcb/prettyprinter/src/Prettyprinter/Internal.hs#L1999

However it only does this for unannotated text.

In our code we were stripping annotations from renderings using
`toTextStream` but we must remove the annotations before calling
`layoutPretty`. That's what this commit does.
@jonaprieto jonaprieto merged commit ad3607f into main May 19, 2023
@jonaprieto jonaprieto deleted the fix-pretty-whitespace branch May 19, 2023 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants