Load a clang-tidy (out-of-tree) plugin in clangd


I have a simple custom clang-tidy check which I compile out of tree,
as in the clang-tidy documentation (Getting Involved — Extra Clang Tools 17.0.0git documentation).

It works correctly if I use clang-tidy in a command line with the “-load” option, like

clang-tidy  --checks="-*,my-check"  -load. path_to_plugin.dylib  code.cpp

Now I would like clangd to use this new check as well (e.g. in vscode).

  • How do I make clangd add the -load option to clang-tidy ?
    I can not find the option in the clangd option list (Configuration)

Unfortunately, this isn’t currently supported, and isn’t trivial to add support for. You can have a look at the discussion thread in ⚙ D92155 Load plugins when creating a CompilerInvocation. if you’re interested in what the challenges are.