Support language-specific compiler macros in clangd configuration - #387
Conversation
Use separate C and C++ compile macro headers when available. Skip macro headers for the CLANG toolchain.
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
|
Coverage Impact ⬆️ Merging this pull request will increase total coverage on Modified Files with Diff Coverage (1)
🤖 Increase coverage with AI coding...🚦 See full report on Qlty Cloud » 🛟 Help
|
There was a problem hiding this comment.
Pull request overview
This PR updates the extension’s clangd configuration generation to support language-specific compiler macro headers (compile_macros_c.h / compile_macros_cxx.h) and to persist compilation database settings directly in generated project .clangd files rather than relying on setContext.
Changes:
- Detect C vs C++ macro header outputs and generate language-specific
.clangdfragments guarded byIf: PathMatch. - Keep
CompileFlags.CompilationDatabaseset in generated.clangdfragments (and avoid applying macro headers forCLANGcompiler contexts). - Update unit tests to parse the generated YAML and validate fragment structure/content.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/solutions/clangd-manager.ts | Generates project .clangd fragments with language-specific -include headers and sets CompilationDatabase directly. |
| src/solutions/clangd-manager.test.ts | Updates tests to assert YAML fragment structure and validate C/C++ macro fragment generation behavior. |

Fixes
Aligns
Changes
compile_macros_c.handcompile_macros_cxx.hfiles and add language-specific.clangdsections for available headers. Legacycompile_macros.houtput is no longer supported..clangdfile without relying onsetContext.This supports build output that provides separate C and C++ compiler macro headers, ensuring clangd applies the appropriate macros for each language.
Path matching remains file extension-based according to
Filename Extensions.Screenshots
N/A — no UI changes.
Checklist