.razor files don't use C# formatting settings #10250
Labels
author: migration bot 🤖
The issue was created by a issue mover bot. The author may not be the actual author
feature-formatting
Milestone
This issue has been moved from a ticket on Developer Community.
[severity:It’s more difficult to complete my work]
Microsoft Visual Studio Community 2022 (64-bit) - Current
Version 17.9.6
No formatting extensions installed.
When I type a closing brace } in a C# .razor file, the opening brace { is moved to a new line.
These are my options:
Text editor > Code Cleanup > Run Code Cleanup profile on save: ☐
Text editor > C# > General > Automatic brace completion: ☐
Text editor > C# > Code Style > Formatting > General > all ☐
Text editor > C# > Code Style > Formatting > New lines > New line options for braces: all ☐
Example before:
Action: remove closing brace and add it back in the same spot.
Example after:
Edit: I realised that the C# code is inside a .razor file and not a .cs file. This matters a lot as razor files have their own settings. Formatting works fine in .cs files.
I can mitigate the issue by disabling Text editor > Razor (ASP.NET Core) > Advanced > Format On Type
This reduces the severity.
Original Comments
Feedback Bot on 4/11/2024, 01:12 AM:
(private comment, text removed)
Original Solutions
(no solutions)
The text was updated successfully, but these errors were encountered: