8.5 Integration with Clang tools
Clangd takes advantage of the LLVM module architecture and has a very strong integration with other Clang tools. In particular, Clangd uses Clang-Format libraries to provide formatting functionality and Clang-Tidy libraries (such as libraries with clang-tidy checks) to support linters in the IDE. The integration is schematically shown in the following figure:
Figure 8.27: VS Code with LSP extension and Clangd server for C++
The configuration from .clang-format
(see Section 7.4.1, Clang-Format configuration and usage examples) is used for formatting, and from .clang-tidy
(see Figure 5.12, Clang-Tidy configuration) for linters. Let’s see how the formatting works in Clangd.
8.5.1 Clangd support for code formatting using LSP messages
Clangd provides robust support for code formatting. This feature is essential for developers to maintain consistent code styles and readability in their C and C++ projects. Clangd leverages LSP...