如何防止 VS Code 在 C++ 格式的新行上放置“{”?

How to prevent VS Code from putting '{' on new line in C++ formatting?

如果我写一些代码

void function() {
....
}

当我使用 Shift+Alt+F 格式化整个页面时,它变成了

void function() 
{
....
}

如何防止初始左括号换行?

Assuming you're using the MS C++ extension, these are the docs you're after. In > short, you'd need to either:

change C_Cpp.clang_format_fallbackStyle to one of: LLVM, Google, Chromium, > Mozilla, WebKit - and see if one matches your preferences.

find/make a custom .clang-format file

see clang-format docs for more details: > https://clang.llvm.org/docs/ClangFormatStyleOptions.html

https://www.reddit.com/r/vscode/comments/9rqj02/prevent_vscode_from_putting_c_curly_braces_on_new/