Clangd

The SDK includes a build of the clangd language server. This allows semantic features of code editors and IDEs that support the Language Server Protocol to work with the SDK.

The specifics of setting up clangd depend on one's choice of editor and build system. There are three general rules, though:


 * 1) Make sure that your build system is generating a   file. Look for this in your build or output directory.
 * 2) Make sure that the editor is pointed at the clangd binary included with the SDK, not a system one. The clang included with the SDK supports language extensions that aren't in upstream clang, which can confuse upstream clangd.
 * 3) Set your editor so that the argument   is passed to clangd. This authorizes clangd to query the SDK clang about what path a specific SDK target uses. Without this, clangd won't have any idea where to look for target headers.

CMake + Visual Studio Code
To set up clangd when building using CMake and editing with Visual Studio Code:


 * 1) Make sure that you've installed the Clangd extension in the Visual Studio Code marketplace. You should also disable the default C++ extension, since it conflicts with clangd.
 * 2) Pass   to CMake when generating the build files. This ensures that a build produces a   file. Note that this only works with the Makefile and Ninja generators.
 * 3) Build the project.
 * 4) In Visual Studio Code, open your project, then go to the Settings page. Click the "Workspace" tab and search for "Clangd."
 * 5) In the setting titled "Clangd: Arguments", add the argument , substituting the absolute path to your SDK installation for.
 * 6) Set "Clangd: Path" to , again substituting your install path.
 * 7) Issue the command "clangd: Restart language server". Clangd integration should now work; you can test this by clicking "Go To Definition" on a  line. This should take you to the corresponding header in your SDK install.