[BUG] LSP <new-diagnostics> misses slow async publishDiagnostics notifications (e.g. readability-function-cognitive-complexity)
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
- Create a C++ file with a function that exceeds cognitive complexity threshold (25), e.g. a function with deeply nested loops and conditionals
- Add a .clang-tidy file enabling readability-function-cognitive-complexity
- Have a compile_commands.json so clangd can parse the file
- Launch Claude Code with clangd in PATH
- Use the LSP hover tool on the complex function
- 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_
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗