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

Look in parent directories of source files for compile_commands.json #913

Open milesgranger opened 1 year ago

milesgranger commented 1 year ago

Please forgive me if I've overlooked some setting or otherwise misunderstood my current experience. :)

Observed behavior

It seems ccls looks for one compile_commands.json in the root (or configurable) of the project. However, some projects will have multiple compile_commands.json files. Having recently switched from clangd, my experience there is it would look for these files in parent directories of the source file, allowing one to edit source files belonging to different sub-projects.

From clangd website:

Often, a compilation database specifies these compile commands. clangd searches for compile_commands.json in parents of the source file.

Expected behavior

For ccls to find compile_commands.json for source files which may be part of different sub projects.

System information

FavonianKong commented 9 months ago

Same issue here,the root of project contains several sub module,the json files are located in the sub-build dirs,ccls cant find them so the cache files are empty.