3

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?

3
  • 1
    Did you ever find a fix for this? Commented Sep 3, 2018 at 19:07
  • I didn't. I gave up, and so did my company on getting us to use this wonky style, so it stopped being an issue. Commented Sep 4, 2018 at 20:06
  • 1
    Well, it's one thing that somebody's used to a style cause that's what s/he was repeatedly shown and it's another thing that somebody uses a style as it's the most logical and neat but unfortunately software developing is not always logical. Check this out: activeclickweb.com/whitesmiths/index.html Commented Aug 15, 2019 at 8:19

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.