CLANGD(1)

πŸ“¦
version 22.1.8 Β· 3 versions
, in ubuntu stonking

πŸ’… CLANGD β€” the clangd manual page, User Commands edition ✨

okay bestie, sit down, hydrate, and let me tell you about clangd 🫢 this is the User Commands manual page for clangd and it is genuinely iconic.


✨ NAME ✨

clangd β€” a language server that gives editors IDE-like features πŸ’–


🌸 DESCRIPTION 🌸

OVERVIEW: clangd is a language server that provides IDE-like features to editors. no cap, that's the whole vibe. πŸ”₯

It should be used via an editor plugin rather than invoked directly. fr fr, don't just rawdog it in your terminal like it's a normal CLI β€” it wants to live inside your editor, plugged in, thriving, main character energy πŸ‘‘

For more information, see:

https://clangd.llvm.org/
https://microsoft.github.io/language-server-protocol/

clangd accepts flags on the commandline, and in the CLANGD_FLAGS environment variable. yes queen, two whole ways to feed her πŸŽ€

USAGE:

clangd [options]

OPTIONS:


🧰 Generic Options

  • --help β€” Display available options (--help-hidden for more) πŸ™ˆ there's always more hiding under the hood
  • --help-list β€” Display list of available options (--help-list-hidden for more) πŸ“‹
  • --version β€” Display the version of this program ⭐

πŸ› οΈ clangd compilation flags options

  • --compile-commands-dir=<string> β€” Specify a path to look for compile_commands.json. If path is invalid, clangd will look in the current directory and parent paths of each source file 🧭 she'll go hunting, don't worry
  • --query-driver=<string> β€” Comma separated list of globs for white-listing gcc-compatible drivers that are safe to execute. Drivers matching any of these globs will be used to extract system includes. e.g. /usr/bin/**/clang-*,/path/to/repo/**/g++-* πŸ” only the white-listed ones get to run, safety first bestie

πŸ¦‹ 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 index on disk. πŸ’Ύ she's working while you're not looking, icon
  • --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. πŸ’€ napping on the nice cores
    • =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 πŸ“š every single one, fully dressed
    • =bundled β€” Similar completion items (e.g. function overloads) are combined. Type information shown where possible 🎁 bundled together, cute
  • --experimental-modules-support β€” Experimental support for standard c++ modules πŸ§ͺ experimental, bestie, you've been warned
  • --fallback-style=<string> β€” clang-format style to apply by default when no .clang-format file is found πŸŽ€ the backup outfit
  • --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 #include directives 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 #include directives as part of code completion 🚫 not today
  • --header-insertion-decorators β€” Prepend a circular dot or space before the completion label, depending on whether an include line will be inserted or not πŸ”΅πŸ«₯ a lil dot tellin' you what's up
  • --import-insertions β€” If header insertion is enabled, add #import directives when accepting code completions or fixing includes in Objective-C code 🍎
  • --limit-references=<int> β€” Limit the number of references returned by clangd. 0 means no limit (default=1000) πŸ”’
  • --limit-results=<int> β€” Limit the number of results returned by clangd. 0 means no limit (default=100) πŸ”’
  • --project-root=<string> β€” Path to the project root. Requires remote-index-address to be set. ⚠️ she literally will not do this one without the address, that's the rule
  • --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. 0 means no limit (default=50) πŸ”’

πŸŽ€ clangd miscellaneous options

  • --check[=<string>] β€” Parse one file in isolation instead of acting as a language server. Useful to investigate/reproduce crashes or configuration problems. With --check=<filename>, attempts to parse a particular file. πŸ•΅οΈ perfect for when something is being weird
  • --enable-config β€” Read user and project configuration from YAML files. πŸ“„
    • Project config is from a .clangd file in the project directory.
    • User config is from clangd/config.yaml in the following directories:
Windows: %USERPROFILE%\AppData\Local
Mac OS: ~/Library/Preferences/
Others: $XDG_CONFIG_HOME, usually ~/.config
  • -j <uint> β€” Number of async workers used by clangd. Background index also uses this many workers. πŸ‘―β™€οΈ
  • --malloc-trim β€” Release memory periodically via malloc_trim(3). 🧹 decluttering queen
  • --pch-storage=<value> β€” Storing PCHs in memory increases memory usages, but may improve performance βš–οΈ the eternal tradeoff
    • =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 πŸ”¬ every last detail, we love a yapper
  • --offset-encoding=<value> β€” Force the offsetEncoding used for character positions. This bypasses negotiation via client capabilities 🎯 no negotiating, we're deciding
    • =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 πŸ”€ first match wins, remember that
  • --pretty β€” Pretty-print JSON output 🌸

⚠️ reminder bestie: run clangd through your editor plugin, not directly. that's the whole design, iykyk πŸ’…

and that's the whole page πŸ₯Ή this was clangd 22, from September 2026 β€” user commands, official manual page, no notes. slay, go forth, and let your editor cook πŸ‘‘πŸ’–πŸŽ€

πŸ“¦ where this page comes from