Some questions regarding LSP integration

Alexander Neundorf neundorf at kde.org
Wed Feb 9 22:26:28 GMT 2022


Hi,

you may have noticed I'm catching up a bit...

Do I understand correctly that kate starts clangd, and then when editing some 
source file foo.cpp, it asks clangd for information about foo.cpp.

clangd then tries to "compile" foo.cpp by executing a compile command, which 
it tries to get from compile_commands.json.
For a file /home/alex/src/Project/foo.cpp, clangd searches for 
compile_commands.json in /home/alex/src/Project/, /home/alex/src/, /home/
alex/, /home/, / and /home/alex/src/Project/build/. Did I understand this 
correctly ? (so this will often fail)

IIRC, in the project plugin, we know if a file is part of a project, and the 
project knows where the build and the source directories are.
So kate could point clangd to the top level build directory of the source 
file. According to the clangd documentation it's currently not possible to 
tell clangd where the compile_commands.json file is. Correct ?

Then, in the compile_commands.json file, the calls to the actual compile are 
listed, e.g. using g++. What does clangd do with them ? Simply skip the 
compile executable and "hope" that clang understands the rest of the command 
line ?

Thanks
Alex





More information about the KWrite-Devel mailing list