Q: Can I configure VSCode to take a .clang-format file from my home directory?

Viewed 11700

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.

2 Answers

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

Set "clang-format.style": "file" property to fix it.

Related