C#C
C#3y ago
5 replies
kirillbobyrev

❔ Formatting C# code in VSCode doesn't look right

Hi everyone! I haven't written any C# code for quite a while and would like to get back to it. I set up .NET SDK and VSCode + C# extension pack and am trying to get it to work. Everything runs smoothly but I'm very confused about the formatting. Whenever I try to format code in VSCode, it only does "basic" things and doesn't touch very long lines or function arguments passed on different lines that don't really look right. Anything I could do to do more "strict" formatting?

E.g. this code doesn't get modified by the formatter at all:

void Foo(double x, double y)
{
}

Foo(1,
          2);

var y = 42; var z = 1;


I also made sure I have Csharp > Format: Enable set to true in my VSCode settings and I do get messages from the Language Server (e.g. I can navigate the code, use Go To to jump to functions in Standard Library and in my code etc).
Was this page helpful?