CLANGD(1)
β¨ CLANGD β¨
okay bestie, sit down, hydrate, and let me tell you about clangd π
this is the manual page for clangd 13 and it's lowkey iconic, so let's go.
πΈ NAME πΈ
clangd β the manual page for clangd 13. yes that's it, that's the name, she's simple and she's serving π
π¦ DESCRIPTION π¦
OVERVIEW: clangd is a language server that gives your editor IDE-like features. like, autocomplete, go-to-def, all the good stuff. she's the main character behind the scenes so your editor can be the main character on screen π
fr fr bestie: use her through an editor plugin, not by invoking her directly. that's the vibe. don't rawdog the language server.
for more info, go look at:
clangd accepts flags on the commandline, and also in the CLANGD_FLAGS environment variable. so you've got options, literally π
USAGE:
clangd [options]
π OPTIONS π
π§ Generic Options π§
--helpβ Display available options. (and--help-hiddenfor more, if you're nosy like that π)--help-listβ Display list of available options. (and--help-list-hiddenfor more π)--versionβ Display the version of this program. she'll tell you who she is π
π clangd compilation flags options π
--compile-commands-dir=<string>β Specify a path to look forcompile_commands.json. And if that path is invalid? no stress, clangd will look in the current directory and parent paths of each source file. she'll find it, she always does π₯--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++-*
β οΈ note the vibe here: these are drivers that are safe to execute. clangd is literally running them. so, like, be careful who you whitelist, 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. she's reaching outside her bubble and honestly? slay.--background-indexβ Index project code in the background and persist index on disk. multi-tasking queen π--clang-tidyβ Enable clang-tidy diagnostics. she will absolutely tell you about your problems. lovingly. π--completion-style=<value>β Granularity of code completion suggestions. pick your fighter:=detailedβ One completion item for each semantically distinct completion, with full type information. every single one gets her own moment β¨=bundledβ Similar completion items (e.g. function overloads) are combined. Type information shown where possible. group chat energy, they're all in one message π
--fallback-style=<string>β clang-format style to apply by default when no.clang-formatfile is found. the backup outfit when the planned outfit isn't there π--header-insertion=<value>β Add#includedirectives when accepting code completions. two moods:=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. very mindful, very demure π§=neverβ Never insert#includedirectives as part of code completion. boundaries. she said no β
--header-insertion-decoratorsβ Prepend a circular dot or space before the completion label, depending on whether an include line will be inserted or not. little dot, little hint, big brain energy π₯--inlay-hintsβ Enable preview of InlayHints feature. it's giving β¨previewβ¨ so yk, treat it like a preview, not a promise π--limit-references=<int>β Limit the number of references returned by clangd.0means no limit (default=1000). go off, unlimited, but the default is a chill1000.--limit-results=<int>β Limit the number of results returned by clangd.0means no limit (default=100). again:0= no limit, default100. numbers, copied exactly, no cap π―--project-root=<string>β Path to the project root. Requires remote-index-address to be set. she's not going anywhere without her plus-one π«Ά--remote-index-address=<string>β Address of the remote index server. long distance relationship, but make it indexing π
π 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. detective mode activated π--check-lines[=<string>]β If specified, limits the range of tokens in-checkfile on which various features are tested. Example--check-lines=3-7restricts testing to lines 3 to 7 (inclusive) or--check-lines=5to restrict to one line. Default is testing entire file. she can zoom in or take the whole picture πΈ--enable-configβ Read user and project configuration from YAML files. Project config is from a.clangdfile in the project directory. User config is 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. Background index also uses this many workers. she's hiring. headcount matters π--malloc-trimβ Release memory periodically viamalloc_trim(3). self-care routine. she's doing a little cleanup, as a treat πΈ--pch-storage=<value>β Storing PCHs in memory increases memory usages, but may improve performance. the eternal tradeoff, bestie. pick:=diskβ store PCHs on disk. old school, reliable, no RAM drama πΎ=memoryβ store PCHs in memory. fast girl, hungry girl π
π clangd protocol and logging options π
--log=<value>β Verbosity of log messages written to stderr. choose your volume:=errorβ Error messages only. she only speaks when something's wrong π=infoβ High level execution tracing. the group chat update π±=verboseβ Low level details. she is telling you EVERYTHING π
--offset-encoding=<value>β Force the offsetEncoding used for character positions. This bypasses negotiation via client capabilities. she's not negotiating, she's 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--prettyβ Pretty-print JSON output. because she's pretty, and so is her JSON β¨π
π«Ά sign-off π«Ά
and that's the whole page, bestie!! this was clangd 13, dated July 2023, served to you in style. go forth and let your editor be iconic. no cap, you got this. πππ¦β¨
CLANGD(1) β User Commands β CLANGD(1) πΈ
π¦ where this page comes from
- ubuntu jammy: clangd-13 1:13.0.1-2ubuntu2.2 Β· APACHE-2-LLVM-EXCEPTIONS
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms