Repository navigation
Document how to use C/C++ header files with clangd - #170
Open
Puliuvarthi.Mahesh (MaheshPulivarthi18) wants to merge 1 commit into
Conversation
Add a README section on how clangd finds compile commands for headers, how to generate compile_commands.json, and how to query headers and definitions that resolve into them. Addresses microsoft#110. Generated by NightShift
Lakshya A Agrawal (LakshyAAAgrawal)
approved these changes
Oct 26, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #110
Issue #110 asks how to work with header files when using the clangd-based C/C++ language server. The README did not cover this.
This adds a short "C/C++ and header files" section to the README. It is documentation only, with no code changes.
The section explains:
{"code_language": "cpp"}starts clangd, which is launched with no extra arguments and the project root as its working directory and workspace root.compile_commands.jsonorcompile_flags.txtin the file's directory and its parents.compile_commands.jsonwith CMake, as the existing clangd test does, with a link to the clangd setup guide for other options.relativePath. A short example shows both a definition that lands in a header and a request made directly on a header.Reviewers may want to check that the clangd behaviour described matches what they expect, and that the example line and column values are fine as illustrative placeholders.
Testing
Documentation-only change (
README.md).Existing suites:
PATH="$PWD/.venv/bin:$PATH" timeout 800 .venv/bin/pytest tests/multilspy/test_multilspy_python.py -q --tb=short: passed