Blazor C# is Formatting Constructs like JavaScript #11266
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 bothers me. A fix would be nice]
When coding in C# in Blazor, when entering a construct like "if", the left brace ({) should move below the if, like it does in all other C# projects. It seems to format like JavaScript, which is not desirable. Perhaps it could be a setting.
Original Comments
Feedback Bot on 25/11/2024, 00:34 PM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
Runtong Liu (Centific Technologies Inc) [MSFT] on 25/11/2024, 06:07 PM:
Thank you for taking the time to log this issue!
I tried repro this issue:
For C# code in .razor of blazor app, left brace can’t make a new line after “if” when save the code, but after I press ctrl+k,ctrl+d, the left brace go to the new line.
For the code in .cs file, the left brace can go to the new line after you save the code or press ctrl+k,ctrl+d.
Is your issue same as mine? if not, can you please provide us a repro video using https://www.screentogif.com/or a similar tool?
We look forward to hearing from you!
Tony Lugg on 26/11/2024, 01:06 AM:
It is not about saving the code of formatting the entire document. When working in a .cs file, typing an “if” statement like:
As soon as I hit Enter, I will end up with:
But when working in a .razor file in Blazor, this does not happen, the brace is left on the same line as the if.
In Tools->Options under Text Editor->Razor->Advanced I have set the setting Code/functions block open brace on next line several times hoping this will do it, but it never keeps the change after restarting, and doesn’t seem to do what I’m looking for anyway.
Runtong Liu (Centific Technologies Inc) [MSFT] on 26/11/2024, 01:57 PM:
Thanks for your sharing the detail steps, I can reproduce this issue through your shared steps and this issue has been escalated for further investigation, if there is any process, I will inform you immediately.
The text was updated successfully, but these errors were encountered: