CLANGD(1)
π NAME π
clangd β the manual page for clangd 18, bestie. It's your editor's new BFF π
β¨ DESCRIPTION β¨
π OVERVIEW
clangd is a language server that hands out IDE-like features to editors. It's giving main character energy for your whole codebase π¦
π«Ά Real talk: you're supposed to use it through an editor plugin, not by running it directly yourself. Like, no cap.
Want more tea? Go read these:
Also, clangd will happily accept flags on the commandline, and it also reads them from the CLANGD_FLAGS environment variable. Two places, same vibe β¨
π» USAGE
clangd [options]
π OPTIONS
π§ Generic Options
--helpβ shows you the available options (--help-hiddenfor even more, iykyk)--help-listβ shows you a list of available options (--help-list-hiddenfor more)--versionβ shows you the version of this program. iconic.
π clangd compilation flags options
--compile-commands-dir=<string>β point at a path to look forcompile_commands.json. If that path is invalid, clangd will go looking in the current directory and the parent paths of each source file instead. it's flexible like that π--query-driver=<string>β a comma separated list of globs that white-list gcc-compatible drivers that are safe to execute. Drivers matching any of these globs get used to extract system includes. e.g./usr/bin/**/clang-*,/path/to/repo/**/g++-*
β οΈ Note the "safe to execute" part bestie, this one actually runs stuff. respect the white-list.
πΈ clangd feature options
--all-scopes-completionβ if set to true, code completion will include index symbols that are not defined in the scopes (e.g. namespaces) visible from the code completion point. Such completions can insert scope qualifiers.--background-indexβ index project code in the background and persist the index on disk. obsessed.--background-index-priority=<value>β thread priority for building the background index. The effect of this flag is OS-specific.=backgroundβ Minimum priority, runs on idle CPUs. May leave'performance'cores unused.=lowβ Reduced priority compared to interactive work.=normalβ Same priority as other clangd work.
--clang-tidyβ enable clang-tidy diagnostics π₯--completion-style=<value>β granularity of code completion suggestions=detailedβ One completion item for each semantically distinct completion, with full type information=bundledβ Similar completion items (e.g. function overloads) are combined. Type information shown where possible
--fallback-style=<string>β the clang-format style to apply by default when no.clang-formatfile is found--function-arg-placeholdersβ when disabled, completions contain only parentheses for function calls. When enabled, 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 space before the completion label, depending on whether an include line will be inserted or not. cute little indicator β¨--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. (yes, that's a requirement, not a suggestion π)--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
--check[=<string>]β parse one file in isolation instead of acting as a language server. Super useful to investigate/reproduce crashes or configuration problems. With--check=<filename>, it attempts to parse a 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 fromclangd/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
-j <uint>β number of async workers used by clangd. The background index also uses this many workers. teamwork makes the dream work π«Ά--malloc-trimβ release memory periodically viamalloc_trim(3).--pch-storage=<value>β storing PCHs in memory increases memory usages, but may improve performance=diskβ store PCHs on disk=memoryβ store PCHs in memory
π¦ clangd protocol and logging options
--log=<value>β verbosity of log messages written to stderr=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.=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). Comma separated list of'<client_path>=<server_path>'pairs, the first entry matching a given path is used. e.g./home/project/incl=/opt/include,/home/project=/workarea/project--prettyβ pretty-print JSON output π β¨
And that's the whole page bestie, you ate it up π
This one's from clangd 18, dated June 2025, and it lives in the CLANGD(1) section of the manual. Go forth and language-server, you absolute legend ππ
π¦ where this page comes from
- debian trixie: clangd-18 1:18.1.8-18+b1 Β· APACHE-2-LLVM-EXCEPTIONS
- ubuntu questing: clangd-18 1:18.1.8-18ubuntu2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms