Reputation: 197
For whatever reason (I hate it, but it is what it is), my company's standard style is to have braces indented to the same level as the code they contain, like this:
public static string StringName
{
get
{
return "string value";
}
}
This is really easy to set up in Visual Studio (Options > Text Editor > C# (or whatever language) > Code Style > Formatting > Indentation > Indent open and close braces), but I'm unsure how to automate this style in Code. Except for languages like Python where indentation is standardized, this is true of all languages I work in.
How can I accomplish this in Visual Studio Code?
Upvotes: 3
Views: 932
Reputation: 556
If you want Whitesmiths style and you're using C# by Omnisharp:
If there is not already such a file, create it: omnisharp.json
- in the root of your project if you want the format just for the particular project or
- at <userdata>/.omnisharp
to use it globally.
Inside it put:
{
"FormattingOptions":
{
"IndentBraces": true,
}
}
Here you can find the complete list of formatting options.
Upvotes: 1