VSCode format curly brackets on the same line c#

后端 未结 1 1704
逝去的感伤
逝去的感伤 2021-02-02 08:42

When using the Format Document command I\'d like to change how the code formats. I\'m completely new to VSCode and I\'m still having trouble navigating the settings, so easy to

相关标签:
1条回答
  • 2021-02-02 09:13

    I have found this simple solution for VScode !

    Just create a file called omnisharp.json at the root of your project and paste the following JSON :

    {
        "FormattingOptions": {
            "NewLinesForBracesInLambdaExpressionBody": false,
            "NewLinesForBracesInAnonymousMethods": false,
            "NewLinesForBracesInAnonymousTypes": false,
            "NewLinesForBracesInControlBlocks": false,
            "NewLinesForBracesInTypes": false,
            "NewLinesForBracesInMethods": false,
            "NewLinesForBracesInProperties": false,
            "NewLinesForBracesInObjectCollectionArrayInitializers": false,
            "NewLinesForBracesInAccessors": false,
            "NewLineForElse": false,
            "NewLineForCatch": false,
            "NewLineForFinally": false
        }
    }
    

    I found the solution here: https://medium.com/@wearetherock/visual-studio-code-c-put-the-opening-brace-on-the-same-line-as-the-statement-a98c552a544b

    0 讨论(0)
提交回复
热议问题