Sublime Forum

How to force LSP to use Allman style for c/c++?


Is it possible to change the settings to use Allman style for c/c++? I followed the guidelines from, but I could not find any related settings regarding this.

For example, the following style

void func()



LSP, as a general framework, doesn’t do any exact job, it just obeys server responses. You would have to check the document of your used language server (e.g., maybe clangd, which actually uses clang-format for formatting).

After googling clangd Allman, you can quickly find this So it’s likely can be done by creating a .clang-format file with that line included in your project root. Or maybe you want to use the whole file with some minor modifications since it claims it’s for Allman-style formatting. .clang-format generator:



Using this emacs lisp setting one ends up with BSD/Allman style braces but introduces tabs with 8 spaces.



Thanks. Creating a .clang-format file is the right way to go.