【问题标题】:How do I set up VSCode to NOT put curly braces on a new line?如何设置 VSCode 以不将花括号放在新行上?
【发布时间】:2019-08-16 02:31:34
【问题描述】:
【问题讨论】:
标签:
visual-studio-code
formatting
code-formatting
platformio
【解决方案1】:
您可以将.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}"
}