0
点赞
收藏
分享

微信扫一扫

VSCode 自动格式化 C# 大括号使之在同一行而非换行(原标题:Auto Formatting Curly Braces on the Same Line in C# in VSCode)

胡桑_b06e 2022-02-06 阅读 142

看中文贴没有,就随手搬,如有侵权,联系删除。

        要让 VSCode 进行压缩格式化,只需在 Unity 项目的根目录(Assets 文件夹旁边)创建一个名为 omnisharp.json 的文件,其内容如下,然后重新启动 VSCode。

        (To get VSCode to do the compact formatting, simply create a file named omnisharp.json in the root of your Unity project (beside your Assets folder) with the following content and then restart VSCode.)

{
    "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
    }
}

原文网址:https://nosuchstudio.medium.com/formatting-curly-braces-on-the-same-line-in-c-in-vscode-c4937e1c215f#:~:text=To%20have%20VSCode%20format%20your,show%20a%20single%20curly%20brace.

举报

相关推荐

0 条评论