Setup

Step 1: Installation

Install clang provided by Espressif

source ~/src/esp/esp-idf/export.sh
idf_tools.py install esp-clang

We now need to find the path to the clangd binary

which clangd

This will print the path, which should look something like
/home/aa55/.espressif/tools/esp-clang/esp-19.1.2_20250312/esp-clang/bin/clangd

Step 2: Configuring QtCreator

We will use Espressif’s clangd language server only while developing for ESP32, for rest of the C/C++ projects we will use the clang binaries provided by the OS distribution. To achieve this, we will clone the current settings directory and make the required modifications in this new cloned directory. While developing ESP32 projects, we will instruct QtCreator to use this directory.

First clone the current settings directory

rsync -av ~/.config/QtProject ~/.config/QtProjectESP

and then launch QtCreator with the new configuration directory

qtcreator -settingspath ~/.config/QtProjectESP

Open the clangd settings from Edit > Preferences > C++ and then open the clangd tab.

Set the Path to executable field to clangd binary path from Step 1

QtCreator settings page

Running QtCreator during development

To run QtCreator, we need to source the export.sh file inside the esp-idf directory and then run QtCreator from the same terminal

source ~/src/esp/esp-idf/export.sh
qtcreator -settingspath ~/.config/QtProjectESP