Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib_deps for multiple environment setup are installed, but include paths not modified #4124

Open
bentron2000 opened this issue Sep 13, 2024 · 1 comment

Comments

@bentron2000
Copy link

When working with multiple environments, libraries installed via lib_deps will only have their include path added to c_cpp_properties.json if they are in the first environment listed in platformio.ini.

Example:

[platformio]
default_envs = controller, sensors 

[env:controller]
platform = espressif32
board = esp32dev
framework = arduino
build_src_filter = 
	+<controllerMain.cpp>
lib_deps = 
	lovyan03/LovyanGFX@^1.1.16
	lvgl/[email protected]

[env:sensors]
platform = espressif32
board = esp32dev
framework = arduino
build_src_filter = 
	+<sensorsMain.cpp>
lib_deps =
	adafruit/Adafruit AHTX0@^2.0.5 
	adafruit/Adafruit BusIO@^1.16.1

Once platformio has finished downloading the libraries, they can be found in the .pio/libdeps/<env> folders correctly.
At this stage, the projects will build properly.
However, the c_cpp_properties.json file does not get updated with the appropriate libdeps paths.
In this example, only the following lines are added:

"<full_path_to_my_project>/.pio/libdeps/controller/lvgl",
"<full_path_to_my_project>/.pio/libdeps/controller/lvgl/src",
"<full_path_to_my_project>/.pio/libdeps/controller/LovyanGFX/src",

This results in errors in the IDE stating that the libraries cannot be found. While the projects still build, the issue should not be there and it completely borks any related intellisense.

You can see this in action if you change the order of controller and sensors then rebuild the project.

@bentron2000
Copy link
Author

I have just discovered that using 'rebuild intelliSense index' will repopulate the c_cpp_properties.json file with the correct values.
I don't feel this is intuitive behaviour. This probably requires some additional documentation or an alternative approach to multi environment setups.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant