Enabling clang-tidy checks in clangd

I read on Features that clangd embeds clang-tidy and shows clang-tidy warnings when passed the --clang-tidy argument, but don’t actually see that in my (admittedly rather custom) setup of clangd with the Monaco editor. For example bugprone-assert-side-effect: running clang-tidy -checks=-*,bugprone-assert-side-effect on

#include <assert.h>

int function(int Param)
  return Param;


1 warning generated.
.../test.c:5:3: warning: side effect in assert() condition discarded in release builds [bugprone-assert-side-effect]
/usr/include/assert.h:108:19: note: expanded from macro 'assert'
  ((void) sizeof ((expr) ? 1 : 0), __extension__ ({                     \

as expected, but the Monaco editor talking to clangd --clang-tidy --clang-tidy-checks=-*,bugprone-assert-side-effect (which otherwise does show clangd warnings) sees no problem with the code.

I’ve built clangd (and clang-tidy) as described on llvm-project/clang-tools-extra/clangd at main · llvm/llvm-project · GitHub - do I need to do anything special to build clangd integrated with clang-tidy? I also read that “not all checks work within clangd” - what would be a working example of a clang-tidy check within clangd?

If I run clangd with the --clang-tidy-checks option, it prints the following on startup:

The flag -clang-tidy-checks is obsolete and ignored.

The supported way to specify checks is mentioned on the Features page you linked to:

clangd respects your project’s .clang-tidy file which controls the checks to run.

Alternatively, you can use the ClangTidy key in clangd’s config file if you prefer.

Yes, .clang-tidy works - many thanks.