Clangd — Extra Clang Tools 7 documentation

# Extra Clang Tools 7 documentation

## Clangd

Contents

- Clangd
  - Using Clangd
  - Installing Clangd
  - Building Clangd
  - Current Status
  - Getting Involved

Clangd is an implementation of the Language Server Protocol leveraging Clang. Clangd’s goal is to provide language “smartness” features like code completion, find references, etc. for clients such as C/C++ Editors.

## Using Clangd

Clangd is not meant to be used by C/C++ developers directly but rather from a client implementing the protocol. A client would be typically implemented in an IDE or an editor.

At the moment, Visual Studio Code is mainly used in order to test Clangd but more clients are likely to make use of Clangd in the future as it matures and becomes a production quality tool. If you are interested in trying Clangd in combination with Visual Studio Code, you can start by installing Clangd or building Clangd, then open Visual Studio Code in the clangd-vscode folder and launch the extension.

## Installing Clangd

Packages are available for debian-based distributions, see the LLVM packages page. Clangd is included in the clang-tools package. However, it is a good idea to check your distribution’s packaging system first as it might already be available.

Otherwise, you can install Clangd by building Clangd first.

## Building Clangd

You can follow the instructions for building Clang but “extra Clang tools” is not optional.

## Current Status

Many features could be implemented in Clangd. Here is a list of features that could be useful with the status of whether or not they are already implemented in Clangd and specified in the Language Server Protocol. Note that for some of the features, it is not clear whether or not they should be part of the Language Server Protocol, so those features might be eventually developed outside Clangd or as an extension to the protocol.

C/C++ Editor feature | LSP | Clangd
--- | --- | ---
Formatting | Yes | Yes
Completion | Yes | Yes
Diagnostics | Yes | Yes
Fix-its | Yes | Yes
Go to Definition | Yes | Yes
Signature Help | Yes | Yes
Document Highlights | Yes | Yes
Rename | Yes | Yes
Source hover | Yes | Yes
Find References | Yes | No
Code Lens | Yes | No
Document Symbols | Yes | Yes
Workspace Symbols | Yes | No
Syntax and Semantic Coloring | No | No
Code folding | No | No
Call hierarchy | No | No
Type hierarchy | No | No
Organize Includes | No | No
Quick Assist | No | No
Extract Local Variable | No | No
Extract Function/Method | No | No
Hide Method | No | No
Implement Method | No | No
Gen. Getters/Setters | No | No

## Getting Involved

A good place for interested contributors is the Clang developer mailing list. If you’re also interested in contributing patches to Clangd, take a look at the LLVM Developer Policy and Code Reviews page. Contributions of new features to the Language Server Protocol itself would also be very useful, so that Clangd can eventually implement them in a conforming way.