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

Handling some edge cases with #if directives #662

Merged
merged 8 commits into from
May 21, 2022
Merged

Handling some edge cases with #if directives #662

merged 8 commits into from
May 21, 2022

Conversation

belav
Copy link
Owner

@belav belav commented May 9, 2022

closes #659

@belav belav force-pushed the if_edge_cases branch from 517a9c2 to d3f5ce7 Compare May 9, 2022 20:01
@belav belav marked this pull request as ready for review May 9, 2022 20:20
@belav
Copy link
Owner Author

belav commented May 9, 2022

I hate most of this code but couldn't come up with a better way to do things. There are also a couple edge cases that I didn't handle but I doubt anyone in the real world will run into them. I think most usages of conditional compilation are pretty basic.

This maybe could have moved the printing of the leading trivia into MembersWithForcedLines but that would require changes to a lot of areas to make sure they didn't also print the leading trivia. And the logic inside of Token probably still would be pretty gross.

I do have a PR where I am playing around with an idea for getting rid of the global ThreadStatics by passing a FormattingContext through all the print methods.

@belav belav merged commit 2973bf2 into master May 21, 2022
@belav belav deleted the if_edge_cases branch May 21, 2022 15:48
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.

Format only the selected code
1 participant