Scroll to navigation

CLANGD(1) User Commands CLANGD(1)


clangd - manual page for clangd 9


OVERVIEW: clangd is a language server that provides IDE-like features to editors.

It should be used via an editor plugin rather than invoked directly. For more information, see:

clangd accepts flags on the commandline, and in the CLANGD_FLAGS environment variable.

USAGE: clangd [options]


Generic Options:

--help - Display available options (--help-hidden for more)

--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

--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

--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-tidy files). Only meaningful when -clang-tidy flag is on

--completion-style=<value> - Granularity of code completion suggestions

- One completion item for each semantically distinct completion, with full type information
- Similar completion items (e.g. function overloads) are combined. Type information shown where possible

--fallback-style=<string> - clang-format style to apply by default when no .clang-format file is found

--header-insertion=<value> - Add #include directives when accepting code completions

- 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 insert #include directives 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. 0 means no limit (default=100)

--suggest-missing-includes - Attempts to fix diagnostic errors caused by missing includes using index

clangd miscellaneous options:

-j=<uint> - Number of async workers used by clangd. Background index also uses this many workers.

--pch-storage=<value> - Storing PCHs in memory increases memory usages, but may improve performance

- store PCHs on disk
- store PCHs in memory

clangd protocol and logging options:

--log=<value> - Verbosity of log messages written to stderr

- Error messages only
- High level execution tracing
- Low level details

--offset-encoding=<value> - Force the offsetEncoding used for character positions. This bypasses negotiation via client capabilities

- Offsets are in UTF-8 bytes
- Offsets are in UTF-16 code units

--pretty - Pretty-print JSON output

December 2019 clangd 9