Setting C # formatting options for OmniSharp in Visual Studio Code?

I am trying to use integration with Visual Studio Code, but cannot figure out how to set the formatting options in C #. Config.json right next to OmniSharp exe on my Mac (/ Applications / Visual Studio Code.app/Contents/Resources/app/extensions/jrieken.vscode-omnisharp/bin/packages/OmniSharp/config.json) doesn't map the standard format OmniSharp config.json , therefore setting the behavior properties of brace + newline does not work, for example methodBraceStyle. However, it works for setting tabSize, etc.

+5
source share
1 answer

Just to make it work, using the last omnisharp (dev) and omnisharp.json (inserted below) in the same folder as my .sln project. It should work with all releases from version v1.9-beta18, I just compiled from the source, because I do not 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, } } 

Available options are listed in this file: https://github.com/bstockus/omnisharp-roslyn/blob/dev/src/OmniSharp.Abstractions/Options/FormattingOptions.cs

+8
source

Source: https://habr.com/ru/post/1238911/


All Articles