【Unity】VSCode自动格式化C#大括号取消换行

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

        要让 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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值