Put class open brace on new line as you type in Visual Studio Code [C#]

Viewed 1302

In Visual Studio Code (MacOS) I've already spend hours finding how to put open brace to the new line when you type. I type this:

class Foo{

...and press Enter. I get the closing brace automatically:

class Foo{

}

But I want this (like VS 2017 did):

class Foo
{

}

I can do that with format command (Shift + Alt + F), but can I have it automatically?

I've tried different extensions (my lines from in User Settings).

  • ryannaddy.vscode-format: "format.newLine": { "brace": true }
  • Leopotam.csharpfixformat: "csharpfixformat.style.braces.onSameLine": false
  • "editor.formatOnType": true
  • Omnisharp: { "FormattingOptions": { "NewLinesForBracesIn...": true, } }

All without any success, none of these setting did this formatting on typing.

1 Answers

There should be an option in the VS Text Editor settings under

Tools -> Options -> Text Editor -> C# -> Formatting

Try to check them and see if that works.

Related