How to configure clang format without .clang-format file in each workspace?

I want to configure clang-format without having to copy my .clang-format file to each new workspace.

In my .json settings I have now

"C_Cpp.clang_format_style": "{BasedOnStyle: Google, IndentWidth: 4, IndentCaseLabels: false, TabWidth: 4, UseTab: ForIndentation, ColumnLimit: 0}",
"C_Cpp.clang_format_fallbackStyle": "Google"

The descriptor for C_Cpp.clang_format_style indicates

// Coding style, currently supports: Visual Studio, LLVM, Google, Chromium, Mozilla, WebKit. Use "file" to load the style from a .clang-format file in the current or parent directory. Use "{key: value, ...}" to set specific parameters, e.g.: "{ BasedOnStyle: LLVM, IndentWidth: 8 }"

What made me think that my approach would work, but it is not. When I use the automatic format, it always uses the Google fallbackStyle attribute.

Is this simply impossible or am I doing something wrong here?

+4
source share

Source: https://habr.com/ru/post/1659604/


All Articles