emacs-lsp / emacs-ccls

Emacs client for ccls, a C/C++ language server
200 stars 29 forks source link

Find compile_commands.json in build folder #75

Closed Maverobot closed 4 years ago

Maverobot commented 4 years ago

Thanks for the awesome work!

As a ycmd user for a long time, I find your solution much more powerful. However, it seems ccls requires the compile_commands.json to be at project root. Is it possible to tell ccls to search it also in build folder?

Maverobot commented 4 years ago

I found the solution, which seems to work.

 (setq ccls-initialization-options
            (list :compilationDatabaseDirectory "build"))
MaskRay commented 4 years ago

Two alternatives:

  1. ln -s build/compile_commands.txt .
  2. touch .ccls-root + (setq ccls-initialization-options '(:compilationDatabaseDirectory "build")) https://github.com/MaskRay/ccls/wiki/Customization#compilationdatabasedirectory

Inventing a new way in elisp is probably unnecessary.

Thaodan commented 8 months ago

Does ccls read dir-locals? Then it would be best to set the variable there.