So ccls
is a lsp wrapper for clang
it works as a backend that indexes source code and gives emacs index information for better navigation and refactoring of c++
I have had a few issues with the tool’s setup in emacs enviroment. and found the following things that may need extra attention
.ccls
file, this file basically does two things
- tell
ccls
how to index the file usingclang
- before index the file tell
clang
how to compile and interpret the code as there is a mixture of options forccls
and arguments forclang
, need to pay extra attention
usually lines in .ccls
file start with %
is for ccls
, and lines start with -
is for clang
c and c++ code/mode, it is better to set only for c++ as c++ is a super set of c
company completion of header files should work without input the surrounds of header file e.g,
""
or<>
some times ccls complains it cannot find header file, so you may include the root path of the header files by adding
-IincludePath
to.ccls
filesfor large projects using
compile_commands.json
to guideccls
indexing. you may of course set partial folder for index by setting the black list ow white list if indexing is way too slowsetting key bindings in emacs, the priority is:
local-settings > global-settings > define-key