8
IDE Support and Clangd
This chapter is about the Language Server Protocol (LSP) and how you can utilize it to enhance your Integrated Development Environment (IDE). Our primary IDE of choice is Visual Studio Code (VS Code). LLVM has its own implementation of LSP known as Clangd. We will begin by describing LSP and exploring how Clangd leverages it to extend the capabilities provided by the IDE. Finally, we will conclude with examples of how various Clang tools, such as Clang-Tidy and Clang-Format, can be seamlessly integrated into the IDE through Clangd.
We will cover the following topics in this chapter:
What is Language Server Protocol (LSP) and how does it improve an IDE’s capabilities?
How VS Code and Clangd (the Clang LSP server) can be installed
How LSP is used to connect VS Code and Clangd, through an example
How Clangd is integrated with other Clang tools
Why performance matters for Clangd and what optimizations were made to make Clangd fast