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

Be opinionated about the formatting of section blocks #9252

Merged
merged 1 commit into from
Sep 9, 2023

Conversation

davidwengier
Copy link
Contributor

While investigating #7038 (comment) I noticed the open brace of the section moving, and could repro that bit at least, so this is a partial fix for the bugs seen in that video.

@davidwengier davidwengier requested a review from a team as a code owner September 7, 2023 07:20
Copy link
Contributor

@allisonchou allisonchou left a comment

Choose a reason for hiding this comment

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

LGTM (based on my very limited knowledge of Razor formatting 😅)

// and third child of the 6 total children
whitespaceBeforeSectionName = null;
whitespaceAfterSectionName = null;
if (children.Count == 6 &&
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems hacky but that's probably just the Razor formatter in general 😩

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, pretty much. It's more of a comment on the syntax tree really. In a future world this would be a SectionBlockSyntax or something, so we'd know 100% what we're doing, instead of using these odd heuristics

@davidwengier davidwengier merged commit 5347457 into dotnet:main Sep 9, 2023
@davidwengier davidwengier deleted the FormatSectionBlocks branch September 9, 2023 01:04
@ghost ghost added this to the Next milestone Sep 9, 2023
@Cosifne Cosifne modified the milestones: Next, 17.8 P3 Sep 25, 2023
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.

3 participants