[BUG] LSP <new-diagnostics> misses slow async publishDiagnostics notifications (e.g. readability-function-cognitive-complexity)

Resolved 💬 1 comment Opened Apr 17, 2026 by BenFrantzDale Closed May 25, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

The <new-diagnostics> block only captures diagnostics that arrive within the tool call window. Slow clang-tidy checks (like readability-function-cognitive-complexity) fire in a later publishDiagnostics push and never appear. The verbose log confirms clangd sends the diagnostic — it's just not surfaced to the model.

This works in VSCode's clangd extension.

What Should Happen?

Claude should see the readability-function-cognitive-complexity diagnostic.

Error Messages/Logs

Steps to Reproduce

  1. Create a C++ file with a function that exceeds cognitive complexity threshold (25), e.g. a function with deeply nested loops and conditionals
  2. Add a .clang-tidy file enabling readability-function-cognitive-complexity
  3. Have a compile_commands.json so clangd can parse the file
  4. Launch Claude Code with clangd in PATH
  5. Use the LSP hover tool on the complex function
  6. Observe: <new-diagnostics> never includes the readability-function-cognitive-complexity warning, even after repeated hover calls

Verification: run clangd with --log=verbose (stderr to a file) and confirm the textDocument/publishDiagnostics JSON contains the diagnostic — clangd sent
it, Claude Code just never surfaced it.

Root cause: readability-function-cognitive-complexity is a slow clang-tidy check that fires in a deferred publishDiagnostics push, after the LSP tool's
request/response window closes. Fast checks (e.g. modernize-use-nodiscard) do appear correctly.

Claude Model

None

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.1.112

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

WSL (Windows Subsystem for Linux)

Additional Information

_No response_

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗