Code errors are shown as you type (both as red squiggle underlines, and in the “Problems” panel). These are the same as produced by the clang compiler, and suggested fixes can automatically be applied.
Most clang-tidy checks are supported (these can be enabled using a .clang-tidy file).
Go-to-definition and find-references work across your code, using a project-wide index.
Press Ctrl-P #
to quickly navigate to a symbol by name.
Code completion works across your codebase and adds #include
directives where needed. The •
shows includes that will be inserted.
clangd can also suggest inserting missing #includes, where they cause errors.
clangd uses the clang-format
engine. You can format a file or the selection. When “Format on Type” is enabled in the settings, pressing enter will cause clangd to format the old line and semantically reindent.
The style used for formatting (and certain other operations) is controlled by the .clang-format file is controlled by the project's .clang-format file.
clangd supports some local refactorings. When you select an expression or declaration, the lightbulb menu appears and you can choose a code action.
Current refactorings include:
auto
types and macros<F2>
, rather than a contextual code action)clangd and vscode-clangd are part of the LLVM project.
If you'd like to help out, reach out to clangd-dev@lists.llvm.org.
If you've found a bug, please file at https://github.com/clangd/clangd/issues.