I want to use the same clang-format file for all my project since I have multiple. But I don't want to have them in every workspace and i already have a clang-format file in my home directory, how can I make this work? Or is this impossible?
I have already seen this question: How can i configure clang format without .clang-format file in every workspace?
but my clang-format file is like 80 lines long and I just want to edit the stuff locally on my home without having to change it in vscode as well.
You can install clang-format and git-clang-format via npm install -g clang-format . To automatically format a file according to Electron C++ code style, run clang-format -i path/to/electron/file.cc . It should work on macOS/Linux/Windows.
clang-format is located in clang/tools/clang-format and can be used to format C/C++/Java/JavaScript/JSON/Objective-C/Protobuf/C# code.
Maybe this will help.
The clang-format -style=file
is somewhat misleading.
file
is not the path to the file you want but rather tells clang-format
to use the .clang-format
file it can find within the project folders - going all the way up.
And as VSCode is the case, the C++ extension is using by default the clang-format
in the VSCode extensions folder.
Which should make the clang-format
to go cd ..
until it finds .clang-format
in your workspace folder
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With