The Roslyn formatter does not indent code of multiline if-conditions.
- Dominant language
- C#
- Stars
- 20.7k
- Forks
- 4.3k
- PR merge metrics
- PR metrics pending
Description
It is a Blazor Wasm app. In the file Home.razor.cs, I created a method `MyMethod()` and pasted some code. Before hitting CTRL+K,D to format it, the code looks as follows:
```
private void MyMethod()
{
if (_bool1 ||
_bool2 ||
_bool3)
{
}
}
```
After hitting CTRL+K,D it is:
```
private void MyMethod()
{
if (_bool1 ||
_bool2 ||
_bool3)
{
}
}
```
The braces are formatted well, but I think the CTRL+K,D should indent the second an third condition and align the underscores.
I created a brand new repo. Please simply [clone it](https://github.com/PhilippJR/RazorEditor.git) and try yourself.
OS: 10.0.26200.0, VS: 18.5.1 (18.5.11716.220), Product: VS professional-2026, Project type: C# / Razor editor
Contributor guide
Research direction
Clone the linked RazorEditor repository, open Home.razor.cs, and reproduce the formatting with CTRL+K,D in the reported Blazor Wasm setup. Compare the formatted multiline if condition with the expected indentation and alignment; done means the second and third conditions are indented consistently while the existing brace formatting remains correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 62/100