CLANGD(1)
π CLANGD β ok bestie, sit down, we're learning the manual page for clangd 21
πΈ NAME πΈ
clangd β the manual page for clangd 21, aka your new favorite language server, no cap π
β¨ DESCRIPTION β¨
OVERVIEW: clangd is a language server that provides IDE-like features to editors.
Okay so here's the tea, bestie π« β you do not just run this thing directly like some kind of feral gremlin. It's supposed to be used via an editor plugin, not invoked by hand. Periodt.
Want more info? Go read these, they're iconic:
And here's a lil detail that matters: clangd takes flags on the commandline, AND from the CLANGD_FLAGS environment variable. Both. Simultaneously. Main character energy fr fr β¨
USAGE:
clangd [options]
OPTIONS: β yes we're doing all of them, nobody's skipping anything in this house π
π Generic Options
Your basic-starter-pack flags, the ones every LLVM tool lowkey has:
--helpβ Shows you the available options. Want the secret extra ones? That's--help-hidden, bestie π--help-listβ Shows you the list of available options. Again,--help-list-hiddenfor the hidden stash π--versionβ Displays the version of this program. Simple. Clean. Iconic. β
π§ clangd compilation flags options
This is the "where do I find stuff and who am I allowed to run" section:
--compile-commands-dir=<string>β Tell clangd a path to go look forcompile_commands.json. And if that path is invalid? π clangd just goes "whatever" and looks in the current directory and the parent paths of each source file instead. Resilient queen.--query-driver=<string>β A comma separated list of globs that white-lists gcc-compatible drivers that are safe to execute. Anything matching those globs gets used to extract system includes. Example, feel free to copy this exactly:/usr/bin/**/clang-*,/path/to/repo/**/g++-*
π¦ clangd feature options
The fun ones. The glow-up ones. The ones that make your editor feel like a whole vibe:
--all-scopes-completionβ If set totrue, code completion will include index symbols that are not defined in the scopes (like namespaces) visible from the code completion point. Yeah, such completions can insert scope qualifiers. It's giving overachiever and we love that π--background-indexβ Index project code in the background and persist that index on disk. Set it and forget it, bestie β¨--background-index-priority=<value>β Thread priority for building the background index. Heads up: the effect of this flag is OS-specific, so your mileage may vary π=backgroundβ Minimum priority, runs on idle CPUs. May leave'performance'cores unused. It's the chill one, it's napping π΄=lowβ Reduced priority compared to interactive work.=normalβ Same priority as other clangd work. The default-ish balanced queen π
--clang-tidyβ Enable clang-tidy diagnostics. Yes it'll yell at you. That's the point π--completion-style=<value>β Granularity of code completion suggestions:=detailedβ One completion item for each semantically distinct completion, with full type information. Maximalist. Thorough. Slay.=bundledβ Similar completion items (e.g. function overloads) are combined. Type information shown where possible. Minimalist queen π
--experimental-modules-supportβ Experimental support for standard c++ modules. It says experimental in the name, bestie, proceed with the appropriate amount of caution π--fallback-style=<string>β The clang-format style to apply by default when no.clang-formatfile is found.--function-arg-placeholders=<string>β When disabled (0), completions contain only parentheses for function calls. When enabled (1), completions also contain placeholders for method parameters.--header-insertion=<value>β Add#includedirectives when accepting code completions:=iwyuβ Include what you use. Insert the owning header for top-level symbols, unless the header is already directly included or the symbol is forward-declared.=neverβ Never insert#includedirectives as part of code completion.
--header-insertion-decoratorsβ Prepend a circular dot or a space before the completion label, depending on whether an include line will be inserted or not. Cute lil visual cue π--import-insertionsβ If header insertion is enabled, add#importdirectives when accepting code completions or fixing includes in Objective-C code.--limit-references=<int>β Limit the number of references returned by clangd.0means no limit (default=1000).--limit-results=<int>β Limit the number of results returned by clangd.0means no limit (default=100).--project-root=<string>β Path to the project root. Requiresremote-index-addressto be set, so don't be out here setting it solo, it needs its bestie π«Ά--remote-index-address=<string>β Address of the remote index server.--rename-file-limit=<int>β Limit the number of files to be affected by symbol renaming.0means no limit (default=50).
π clangd miscellaneous options
The grab-bag section, the random drawer in your desk that somehow has everything:
--check[=<string>]β Parse one file in isolation instead of acting as a language server. Genuinely useful to investigate/reproduce crashes or configuration problems. With--check=<filename>, it attempts to parse that particular file.--enable-configβ Read user and project configuration from YAML files.- Project config comes from a
.clangdfile in the project directory. - User config comes from
clangd/config.yamlin the following directories:- Windows:
%USERPROFILE%\AppData\Local - Mac OS:
~/Library/Preferences/ - Others:
$XDG_CONFIG_HOME, usually~/.config
- Windows:
- Configuration is documented at
https://clangd.llvm.org/config.html
- Project config comes from a
-j <uint>β Number of async workers used by clangd. The background index also uses this many workers, so pick a number your poor CPU can handle π--malloc-trimβ Release memory periodically viamalloc_trim(3).--pch-storage=<value>β Storing PCHs in memory increases memory usage, but may improve performance. Pick your struggle:=diskβ store PCHs on disk=memoryβ store PCHs in memory
π clangd protocol and logging options
For when you need to know what's actually going on in there:
--log=<value>β Verbosity of log messages written tostderr:=errorβ Error messages only=infoβ High level execution tracing=verboseβ Low level details
--offset-encoding=<value>β Force theoffsetEncodingused for character positions. This bypasses negotiation via client capabilities, so it's a "I said what I said" move π=utf-8β Offsets are in UTF-8 bytes=utf-16β Offsets are in UTF-16 code units=utf-32β Offsets are in unicode codepoints
--path-mappings=<string>β Translates between client paths (as seen by a remote editor) and server paths (where clangd sees files on disk). It's a comma separated list of'<client_path>=<server_path>'pairs, and the first entry matching a given path is used. Example, copy it exactly:/home/project/incl=/opt/include,/home/project=/workarea/project--prettyβ Pretty-print JSON output. It's just nicer to look at, okay? β¨
Okay that's literally the whole thing, bestie. Go forth, configure your editor plugin, and let clangd handle the rest π«Ά
πΈ That was clangd 21, from September 2026, manual page CLANGD(1) β ily, go slay your compilation errors πβ¨π
π¦ where this page comes from
- ubuntu stonking: clangd-21 1:21.1.8-10ubuntu2 Β· APACHE-2-LLVM-EXCEPTIONS
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms