This is the perfect solution for addressing global formatting settings.ĥ) An omnisharp.json file located in the working directory which OmniSharp has been pointed at. This works on all platforms – Windows, OS X and Linux.
Interestingly, this is the technique used by VS Code C# extension to share VS Code editor settings with OmniSharp (as described earlier).Ĥ) An omnsharp.json filer located at %USERPROFILE%/.omnisharp/omnisharp.json. Similarly as in the previous point – this means you can’t really leverage this feature as a user, as it’s C# extension that controls it. However, because it’s the C# extension that starts the process on your behalf in VS Code, then this option is not really applicable for custom use at the moment.ģ) Command line arguments – formatting settings can be passed as arguments when starting OmniSharp.
Because of that, modifying this file is not recommended.Ģ) Environment variables – you could pass environment variables into the OmniSharp process to control the formatting settings. You could use the schema I just posted above and the config.json file to provide global C# formatting settings, however bear in mind that it will be overwritten on next extension update. If the file doesn’t exist, you can simply create it.
"NewLineForMembersInAnonymousTypes": true,Īt startup, OmniSharp obtains the configuration options using the following order of precedence (each of the subsequent configuration sources, can overwrite any of the settings set by the previous source):ġ) The built-in config.json – which is located in the OmniSharp folder inside the C# extension folder itself (for example, on a Mac that’s ~/.vscode/extensions/ms-vscode.csharp-1.6.0/bin/omnisharp.). "NewLinesForBracesInLambdaExpressionBody": true, "NewLinesForBracesInObjectCollectionArrayInitializers": true "NewLinesForBracesInAnonymousTypes": true, "NewLinesForBracesInControlBlocks": true, "NewLinesForBracesInAnonymousMethods": true, "WrappingKeepStatementsOnSingleLine": true, "SpaceBeforeSemicolonsInForStatement": false, "SpaceBeforeColonInBaseTypeDeclaration": true, "SpaceAfterSemicolonsInForStatement": true, "SpaceAfterColonInBaseTypeDeclaration": true, "SpaceBetweenEmptySquareBrackets": false, "SpacesIgnoreAroundVariableDeclaration": false, "SpaceWithinExpressionParentheses": false, "SpaceAfterControlFlowStatementKeyword": true, "SpaceBetweenEmptyMethodCallParentheses": false, "SpaceWithinMethodCallParentheses": false, "SpaceBetweenEmptyMethodDeclarationParentheses": false, "SpaceWithinMethodDeclarationParenthesis": false, "SpacingAfterMethodDeclarationName": false,