I'm attempting to take advantage of the integration with Visual Studio Code, but can't figure out how to set the C# formatting options. The config.json
right next to the OmniSharp exe on my Mac (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/jrieken.vscode-omnisharp/bin/packages/OmniSharp/config.json
) doesn't match the standard OmniSharp config.json
format, so setting the brace + newline behavior properties isn't working, e.g. methodBraceStyle
. It does work to set the tabSize
, etc., however.
Just got this to work using the latest omnisharp (dev branch) and the omnisharp.json
(pasted below) in the same folder as my project's .sln
.
It should work with all releases since v1.9-beta18, I just compiled from source because I don't use a supported system.
{
"FormattingOptions": {
"newLine": "\n",
"useTabs": false,
"tabSize": 4,
"indentationSize": 4,
"NewLinesForBracesInTypes": false,
"NewLinesForBracesInMethods": false,
"NewLinesForBracesInProperties": false,
"NewLinesForBracesInAccessors": false,
"NewLinesForBracesInAnonymousMethods": false,
"NewLinesForBracesInControlBlocks": false,
"NewLinesForBracesInAnonymousTypes": false,
"NewLinesForBracesInObjectCollectionArrayInitializers": false,
"NewLinesForBracesInLambdaExpressionBody": false,
"NewLineForElse": false,
"NewLineForCatch": false,
"NewLineForFinally": false,
"NewLineForMembersInObjectInit": false,
"NewLineForMembersInAnonymousTypes": false,
"NewLineForClausesInQuery": false,
}
}
The available properties are listed in FormattingOptions.cs
in the omnisharp-roslyn
repository.