MaskRay / ccls

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

ccls fails with multiple project roots #928

Open awoodx opened 1 year ago

awoodx commented 1 year ago

Observed behavior

In my set-up, I'm using nvim and I have several projects each with their own compile_commands.json and .ccls files. Eg.

./projA/compile_commands.json
./projA/.ccls
./projA/src/srcA.cpp
./projB/compile_commands.json
./projB/.ccls
./projB/src/srcB.cpp
./projC/compile_commands.json
./projC/.ccls
./projC/src/srcC.cpp

The issue I have is that if I start nvim and open a file from one project, ccls works fine. When I open a file from one of the other projects, ccls starts erroring out. When I look at the lsp logs, I see a lot of errors like this:

ERROR][2023-02-08 08:02:34] .../vim/lsp/rpc.lua:733 "rpc" "ccls" "stderr" "08:02:34 indexer1 utils.cc:177 E failed to write to ....@c++@13.0.1@bits@specfun.h.blob No such file or directory\n"

In this case, I opened a file from projA, and ccls is trying to write to projB's .ccls-cache directory.

When I check the processes running, I see only one instance of ccls running. I would think each project instance would have it's own ccls instance. clangd which works with my set-up is using a different instance for each project.

Expected behavior

Each project should have it's own ccls instance, or for ccls to handle each project independently.

Steps to reproduce

Described above.

System information

MaskRay commented 1 year ago

ccls processes are spawned by the client, so I think you'll need to check your setup.

getong commented 1 year ago
02:09:37                     utils.cc:177 E failed to write to player_hero.cpp/.ccls-cache/@player_hero.cpp/@Library@Developer@CommandLineTools@SDKs@MacOSX13.3.sdk@usr@include@c++@v1@__type_traits@remove_cv.h Not a directory

I use lsp-bridge, the project is a win32 project, but i open it in macos, same error here.