I'm using neovim's builtin lsp client for ccls. It requires a JSON compilation database for parsing the codebase (or something, I dunno).

I used to use Bear for generating the compilation database, but I've moved to CMake and want to automate the task of generating compilation database.

I invoke CMake from a different directory called build/, so my root folder wouldn't get cluttered. But that also means that CMake generates the compilation database in that build/ directory. Neovim LSP client only looks for compile_commands.json in the root folder.

How do I point the LSP client to the compilation database in a different directory?

  • By the by, I'm making do by using a soft link (ln -s ./build/compile_commands.json .). It's a laughable hack, but I have no idea of the inner workings of lsp and neovim still don't have good enough docs on their builtin client. (Hopefully, that'll change in the next stable release.) – klaus Nov 25 '20 at 21:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.