-
Notifications
You must be signed in to change notification settings - Fork 196
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 #10891 - Formatting does not respect indentation within Razor comment blocks #10893
Fix #10891 - Formatting does not respect indentation within Razor comment blocks #10893
Conversation
…or comment blocks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! <3
|
||
using var changesToKeep = new PooledArrayBuilder<TextChange>(capacity: changes.Length); | ||
|
||
for (var i = 0; i < changes.Length; i++) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: A foreach
loop is generally preferred, and it doesn't seem like i
is doing anything important here.
<div> | ||
@* | ||
<div> | ||
This comment's indentation will be preserved |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit, or possibly paranoia, but just in case perhaps it would be good for the comment contents to not be indented perfectly. If we accidentally regress this in future, but also make @*
indent its contents, this test may not fail. Even something as simple as this should do it:
This comment's indentation will be preserved | |
This comment's indentation will be preserved |
Ugly, yes, but it's a test so it's okay :)
Thanks @davidwengier. I see your community outreach on Reddit btw. That takes some guts, lol I've made the requested changes, and also added a couple more small details to the test case for completeness |
Thank you again for your contribution @tuespetre |
Altered
HtmlFormattingPassBase
to discard anyTextChange
s that start within aRazorCommentBlockSyntax
and added a test to catch any regressions in the future.Fixes #10891