This issue has been moved from a ticket on Developer Community.
Following is the code before formatting,

and following is the code after formatting.

When I click Format Document in a .cshtml file that uses HTML Tag Helpers, the formatter breaks/messes up the code structure instead of formatting it correctly.
I already tried enabling “Use legacy Razor Editor for ASP.NET Core” (and also disabling it), but the issue remains the same.
My current Visual Studio settings are attached for reference.
This issue has been moved from a ticket on Developer Community.
Following is the code before formatting,

and following is the code after formatting.

When I click Format Document in a .cshtml file that uses HTML Tag Helpers, the formatter breaks/messes up the code structure instead of formatting it correctly.
I already tried enabling “Use legacy Razor Editor for ASP.NET Core” (and also disabling it), but the issue remains the same.
My current Visual Studio settings are attached for reference.