razor
razor copied to clipboard
Indent issue in Javascript function block
Describe the bug:
When I code format(Ctrl+K, Ctrl+D) a Razor file, Javascript function block indentation is broken.
Version used: VS2022 17.3.4 VisualStudio.17.Release/17.3.4+32901.215 Razor (ASP.NET Core) 17.0.0.2232702+e1d654e792aa2fe6646a6935bcca80ff0aff4387
To reproduce:
- Create a a.cshtml file in a project
<script>
function sayhello() {
console.log("hello");
}
</script>
- Format code with Ctrl+K, Ctrl+D.
Expected behavior:
<script>
function sayhello() {
console.log("hello");
}
</script>
Actual behavior:
<script>
function sayhello() {
console.log("hello");
}
</script>
Indent size in a function block is 4.
Additional context: My indentation config is bellow. .editorconfig
[*.{css,scss,js,ts,vue,html,cshtml}]
charset = utf-8
indent_style = space
indent_size = 2
[*.cs]
charset = utf-8
indent_style = space
indent_size = 4
Tools > Options > Text editor > Javascript/Typescript > Tab Tab size: 2 Indent size: 2