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

Out of Tree builds: project root discovery #903

Open Thaodan opened 1 year ago

Thaodan commented 1 year ago

Observed behavior

When a project uses out of tree builds like in a ./build/. directory inside the project folder compile_commands.json are not in the project folder but in that folder. How should such use cases be handled?

Expected behavior

ccls would describe what is the project root, the build folder or the actual project root or handle projects with out of tree build folders.

Steps to reproduce

Generate a project that uses an out of tree build. Like for cmake with Cmake:

  1. cmake -S $PWD -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=YES
  2. How to tell ccsl about the out of tree build?
FederAndInk commented 1 year ago

something like this https://github.com/MaskRay/ccls/wiki/Visual-Studio-Code#cclsmisccompilationdatabasedirectory ?

FederAndInk commented 1 year ago

see https://github.com/MaskRay/ccls/wiki/Project-Setup#compile_commandsjson you should be able to use compilationDatabaseDirectory

Thaodan commented 1 year ago

something like this https://github.com/MaskRay/ccls/wiki/Visual-Studio-Code#cclsmisccompilation databasedirectory ?

Yes exactly. Can this be more generalized or has this to be supported by each editor plugin?