看中文贴没有,就随手搬,如有侵权,联系删除。
要让 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
}
}