Skip to content

Indent issue in Javascript function block #6870

Open
@tsu1980

Description

@tsu1980

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:

  1. Create a a.cshtml file in a project
<script>
  function sayhello() {
    console.log("hello");
  }
</script>
  1. 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions