I’m on Ubuntu. When I write C++ code in Visual Studio Code it automatically lints like
if (condition == true) { DoStuff(); }Instead I want to do like:
if (condition == true) { DoStuff(); }How do I do that?
I’ve already installed the C/C++ extension from the marketplace.
base on @Chris Drew’s answer
Go Preferences -> SettingsSearch for C_Cpp.clang_format_fallbackStyleClick Edit, Copy to SettingsChange from “Visual Studio” to "{ BasedOnStyle: Google, IndentWidth: 4 }"e.g.
"C_Cpp.clang_format_fallbackStyle": "{ BasedOnStyle: Google, IndentWidth: 4, ColumnLimit: 0}"btw ColumnLimit: 0 is helpful too, because google limit will break your code to next line when you do not need it.If you want more:
check https://clang.llvm.org/docs/ClangFormatStyleOptions.htmlcustomize your functionality to “C_Cpp.clang_format_fallbackStyle” for your loved favor.More detail:
English: https://medium.com/@zamhuang/vscode-how-to-customize-c-s-coding-style-in-vscode-ad16d87e93bf
Taiwan: https://medium.com/@zamhuang/vscode-如何在-vscode-上自定義-c-的-coding-style-c8eb199c57ce