Fix formatting issue with code block opening braces #11969
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #11970
(which is really https://developercommunity.visualstudio.com/t/Razor-file-formatting-throws-ran-out-of/10924272)
((which is really https://dev.azure.com/devdiv/DevDiv/_workitems/edit/2508457))
Seems I missed a case in my previous fix, which is where Roslyn is configured for K&R braces, but the Razor file is not.
In order to track this down, I experimented with automatically generating tests to provide cover for the C# syntax formatting options. I referred to that coverage as "exhaustive", but quickly met with this thing called "Math" which said that would be too many tests, so I toned it down. The last two commits are the generator and the tests.
I'm not convinced they're adding any value, now that I've found the issue and created real targeted tests for the same thing, in our normal formatting test class, but I left them anyway. Copilot wrote most of the generator anyway, so its not a big deal to recreate it again, if anyone thinks it shouldn't be there. Let me know.