talira

clangd understands your C++ code and adds smart features to your editor

open sourceApache-2.0 WITH LLVM-exceptionfree

clangd is a language server for C and C++ that gives editors code completion, compile errors and warnings as you type, go-to-definition, find references, hover documentation, renaming, formatting and semantic highlighting through the Language Server Protocol. It is based on the Clang compiler and is part of the LLVM project: it runs Clang on your code to show diagnostics in place, suggests fixes and missing includes, and embeds clang-tidy so your project's .clang-tidy checks show up in the editor too. It works with any LSP editor (VS Code through its official extension, Vim and Neovim, Emacs, Sublime Text and others), reading a project's compile_commands.json to understand its build.

Problems it solves

  • code completion and go-to-definition for C++ in my editor
  • see C and C++ compile errors inline as I type instead of after a build
  • run clang-tidy checks live in my editor
  • C++ IDE features in Vim, Neovim or Emacs
  • a faster, more accurate C/C++ IntelliSense than the default VS Code extension
  • rename a symbol across a large C++ codebase safely
  • automatically insert missing #include lines in C++

Features

  • code completion with include insertion
  • errors and warnings as you type from Clang
  • automatic fixes
  • embedded clang-tidy checks
  • go-to-definition and find references
  • hover documentation
  • rename refactoring
  • formatting
  • semantic highlighting
  • experimental C++20 modules support

Limitations

  • Diagnostics that require expanding templates in headers are disabled for performance reasons.1
  • Not all clang-tidy checks work within clangd.1

Alternatives

The same job

These do what clangd does.

  1. CLion The IDE for professional C and C++ development
  2. gopls The language server for Go
  3. rust-analyzer Bringing a great IDE experience to the Rust programming language
  4. Metals Scala language server with rich IDE features

Compare clangd with the top 3