s. So I Write / shelper
← All writing
Feb 26, 2019 · 2 MIN READ

setup emacs foc C++ with ccls and lsp

By Shelper · Edit post ↗

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

  1. .ccls file, this file basically does two things

usually lines in .ccls file start with % is for ccls, and lines start with - is for clang

  1. c and c++ code/mode, it is better to set only for c++ as c++ is a super set of c

  2. company completion of header files should work without input the surrounds of header file e.g, "" or <>

  3. 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 files

  4. for large projects using compile_commands.json to guide cclsindexing. you may of course set partial folder for index by setting the black list ow white list if indexing is way too slow

  5. setting key bindings in emacs, the priority is: local-settings > global-settings > define-key

cppemacs
← Orgmode for nikola postThe Universe as an Evolving Pattern: Buddhism, Quantum Randomness, and Consciousness →