Clang-format

Hello Theia Community,

After a quick search on this forum, I could not see how to produce a clang-format config file that gets loaded by clangd. Maybe I am confused where to place it, or if it will even get used.
It is time for our team to have a consistence style and to use the Document Format option (does this use clangd?)
Our setup is using the docker example on github for cpp, merged with the python configuration. I could upload some logs/or package.json if necessary.

PS: This projects is still awesome

@lperraud thank you for the discussion, I don’t think it is necessarily related to theia itself, but you can take a look at the clang-format documentation which describes the different options and where to place the file.

It is the same link that is referenced in the docs of the clangd extension (GitHub - clangd/vscode-clangd: Visual Studio Code extension for clangd).

Thank you for your answer which forced me to insist.
so for other readers, make sure clang-format is installed as it is not in the default tools.

then at the root of your project, you can do:
clang-format -style=google -dump-config > .clang-format
With the View menu and Command Palette, restart your clangd
It should work