In a razor page file (.cshtml), when I use for example ;
or {
, in @<text>
block or anything except for razor syntax, then the file is auto-formatted, the same as if I use Ctrl+K+D
.
The issue is that EACH time my file is formatted, EVERY content inside a @<text>
block will be indented.
Example:
.OnDone(@<text>
foo();
</text>)
after writing the second ;
it became (and all other @<text>
block in my file)
.OnDone(@<text>
foo();
foo2();
</text>)
I already deactivated the option Use adaptative formatting
.
I tried in Options > Text Editor > JavaScript/TypeScript > Formatting and unchecked everthing in Automatic Formatting but without success.
Important to mention that this behavior is only in VS2022 and not in VS2019.
Fixed with update 17.3 of VS2022.
See release notes at section "Razor (ASP.NET Core) Editor".