CLANGD(1)
β¨ clangd β the manual page, bestie edition β¨
okay so you opened the User Commands section of the manual and found clangd (specifically, the manual page for clangd 12). Sit down, grab a boba, we're doing this π
πΈ NAME πΈ
clangd β it's the manual page for clangd 12, and it's about to become your whole personality π
π¦ DESCRIPTION π¦
OVERVIEW: clangd is a language server that provides IDE-like features to editors. iconic. no notes. π
Real talk though: it should be used via an editor plugin rather than invoked directly. So likeβ¦ don't just raw-dog it in your terminal, bestie π
For more information, see:
clangd accepts flags on the commandline, and in the CLANGD_FLAGS environment variable. yes, both. it's giving flexible π
USAGE:
clangd [options]
π OPTIONS π
β Generic Options
--helpβ Display available options (--help-hiddenfor more). the classic "help me bestie" move π«Ά--help-listβ Display list of available options (--help-list-hiddenfor more).--versionβ Display the version of this program.
π§ clangd compilation flags options
--compile-commands-dir=<string>β Specify a path to look forcompile_commands.json. If path is invalid,clangdwill look in the current directory and parent paths of each source file. she'll find it herself if you fumble it, ngl π--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++-*
π₯ 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. she's reaching across the whole codebase for you, main character energy β¨--background-indexβ Index project code in the background and persist index on disk.--clang-tidyβ Enable clang-tidy diagnostics.--clang-tidy-checks=<string>β List of clang-tidy checks to run (this will override.clang-tidyfiles). Only meaningful when-clang-tidyflag is on.--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.
--cross-file-renameβ Enable cross-file rename feature.--fallback-style=<string>β clang-format style to apply by default when no.clang-formatfile is found.--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.--limit-results=<int>β Limit the number of results returned by clangd.0means no limit (default=100). yes bestie, zero is the "yolo, give me everything" option π--project-root=<string>β Path to the project root. Requiresremote-index-addressto be set.--remote-index-address=<string>β Address of the remote index server.
π 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. it's giving detective mode π--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
Configuration is documented at https://clangd.llvm.org/config.html
-j=<uint>β Number of async workers used by clangd. Background index also uses this many workers.--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 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. she's not asking, she's telling π=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. because unformatted JSON is a crime and we don't commit crimes πΈ
and that's the whole page, bestie, you ate it π
This lil love letter comes from clangd 12, dated February 2022, living in the CLANGD(1) section of your manual. go forth and LSP ππ¦β¨
π¦ where this page comes from
- ubuntu jammy: clangd-12 1:12.0.1-19ubuntu3 Β· APACHE-2-LLVM-EXCEPTIONS
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms