[英]How do I set up VSCode to NOT put curly braces on a new line?
基本上与这个问题相反:
如何设置VSCode以将花括号放在新行上?
我正在使用VSIO的PlatformIO扩展,每当我格式化文档时,我的所有花括号都放在新行上,这看起来很糟糕(来自Java)。
类似的问题在这里 ,但它询问特定的C ++扩展。
您可以将.clangformat
文件添加到项目中。 例如:
---
BasedOnStyle: Google
UseTab: Never
IndentWidth: 4
TabWidth: 4
BreakBeforeBraces: Attach
AllowShortIfStatementsOnASingleLine: false
IndentCaseLabels: false
AccessModifierOffset: -4
ColumnLimit: 88
...
您可以在这里阅读有关选项: https : //clang.llvm.org/docs/ClangFormatStyleOptions.html
或者,您可以编辑vscode设置后备样式:
{
"C_Cpp.clang_format_fallbackStyle": "{ BasedOnStyle: Google, IndentWidth: 4, TabWidth: 4}"
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.