Skip to content
This repository has been archived by the owner on Jan 28, 2022. It is now read-only.

ccls project

wangqi edited this page May 9, 2021 · 9 revisions

Here we will use ccls GitHub project to verify the IDE environment.

Get the gccIDE container

Follow the instructions in Quick Guide section to set up the gccIDE container. Don't forget to create the proj-vol volume.

Generate the compile_commands.json file

% cd ~/proj
% git clone https://github.com/MaskRay/ccls.git
% cd ccls
% cmake -H. -BDebug -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=YES
% ln -s Debug/compile_commands.json .

Use the following .ccls file

Copy and paste the following content into .ccls file.

clang
%cpp -std=c++17
%h -x c++-header
-I
/home/ide/proj/ccls/src 
-isystem
/home/ide/proj/ccls/third_party 
-isystem
/usr/lib/llvm10/include 
-isystem
/home/ide/proj/ccls/third_party/rapidjson/include
-isystem
/usr/include/llvm10/

Using the gccIDE

% pwd
/home/ide/proj/ccls
% vi 
  • Use ctrl-ww to choose the main.cc file. Enter to open it.
  • You need to wait some time to wait for the ccls to parse the source file in the background.
  • Check /tmp/ccls.log to see the ccls log.
  • Now, you can test the code completion and find definition/declaration.