SmingHub / Sming

Sming - powerful open source framework simplifying the creation of embedded C++ applications.
https://sming.readthedocs.io
GNU Lesser General Public License v3.0
1.48k stars 347 forks source link

Intellisense for esp-idf-5.2-beta1 #2723

Closed profjmer closed 7 months ago

profjmer commented 7 months ago

In esp-idf-5.2-beta1 there are drivers in /components/drivers make ide-vscode does not create references for all drivers and Intellisense and compiler complain not finding include files for those drivers (I tested only rmt)

components in /opt/esp-idf/components/driver are: root@efdb887d485d:/workspaces/jmSming/jmESP32_webapp_9# ls /opt/esp-idf/components/driver CMakeLists.txt deprecated i2s mcpwm sdio_slave spi twai Kconfig gpio include parlio sdkconfig.rename temperature_sensor uart analog_comparator gptimer ledc pcnt sdmmc test_apps usb_serial_jtag dac i2c linker.lf rmt sigma_delta touch_sensor

make ide-vscode generates only a few of the references for components/driver: "${IDF_PATH}/components/driver/include", "${IDF_PATH}/components/driver/deprecated", "${IDF_PATH}/components/driver/gpio/include", "${IDF_PATH}/components/driver/ledc/include", "${IDF_PATH}/components/driver/spi/include",

Adding a general reference in c_cpp_properties.json does not help "${IDF_PATH}/components/driver/**",

I added manually in my project, but I guess there is a better way

mikee47 commented 7 months ago

By design we don't want every include path everywhere, however one way you could do this is adding paths to your project's component.mk file:

COMPONENTS_EXTRA_INCDIR += $(IDF_PATH)/components/driver/rmt/include

You can then use #include <driver/rmt_common.h> and intellisense will include the path (after re-running ide-vscode).

The preferred approach is to provide a proper integration for RMT in Sming so applications don't access the IDF directly.

profjmer commented 7 months ago

In esp-idf-5.2, components structure directory changed and is now : /opt/esp-idf/components/driver/rmt/include/driver so i guess COMPONENTS_EXTRA_INCDIR += $(IDF_PATH)/components/driver/rmt/include/driver will be more appropriate I used esp-idf rmt directly because it is not supported by Sming yet and it needs extra work that I can't do yet.