MaskRay / ccls

C/C++/ObjC language server supporting cross references, hierarchies, completion and semantic highlighting
Apache License 2.0
3.73k stars 254 forks source link

clang-format possible ? #910

Open luqasz opened 1 year ago

luqasz commented 1 year ago

Hi.

Does ccls support clang-format ? It does state that formatting is supported but which tool is used ?

sasanquaa commented 1 year ago

It uses the clang-format executable of LLVM (/usr/lib/llvm-14/bin/clang-format for me on Ubuntu). You will need to install the LLVM toolchain for that. The build document should already give you the instructions needed to build from the source. If you intend to use a different LLVM version, you need to specify these flags CMAKE_PREFIX_PATH, LLVM_INCLUDE_DIR, LLVM_BUILD_INCLUDE_DIR as said in the document, then reconfigure and rebuild. Hope my two cents help.

luqasz commented 1 year ago

Will it be enough to just have clang-format in $PATH ? I use mac os which has its own LLVM toolchain.

sasanquaa commented 1 year ago

I believe you can install ccls with Homebrew on MacOS using: brew install ccls.

luqasz commented 1 year ago

Yes it's available in homebrew.