PlatformIO Community

Add sources' and headers' directories for VS Code IntelliSense


#1

IDE: VSCode + PlatfotmIO + ESP32 IDF

Hi,
I hope you can help me.
Initially, I desired to post this in VS Code support, but I’ve found PlatformIO community more appropriate cause an issue is related more with Platformio than VS Code.

I want VS Code’s IntelliSense to make GoTo Declaration\Definition in all IDF SDK directories. But not all directories is used in project, so IntelliSense doesn’t go there.
VS Code Community recommends to add needed paths to c_cpp_properties.json of the project.
But in c_cpp_properties.json there’s a notation:

“!!! WARNING !!! AUTO-GENERATED FILE, PLEASE DO NOT MODIFY IT AND USE https://docs.platformio.org/page/projectconf/section_env_build.html#build-flags

Yes, I’ve tried append needed path/* there, but c_cpp_properties.json is rewritable after reopen of VS Code, and after project rebuilding.
I think advices to use build_flags in platformio.ini is acceptable only for headers nor source files.
So How could I add src pathes for IntelliSense using PlatformIO in VS Code?
Thanx in advance, guys.


#2

Yes, please use http://docs.platformio.org/en/latest/projectconf/section_env_build.html#build-flags


#3

I’ve tried.
I’ve appended platformio.ini with paths to tasks.c:

[env:specific_inclibs]
build_flags =
-I/home/USER/.platformio/packages/framework-espidf/components/freertos
-L/home/USER/.platformio/packages/framework-espidf/components/freertos

I have in application’s main.c:

vTaskDelay(1000 / portTICK_RATE_MS);

Ctrl+Clicking on it I’ve gotoed to declaration in
/home/USER/.platformio/packages/framework-espidf/components/freertos/include/freertos/task.h:

void vTaskDelay( const TickType_t xTicksToDelay ) PRIVILEGED_FUNCTION;

Ctrl+Clicking on it here to get a definition in tasks.c nothing happens.

It doesn’t help. It seems IntelliSense doesn’t care these compiler options.

  1. What flag exactly should I use for source directory in this case?
  2. How should I care about sources in many directories in SDK?

#4

Could you try to delete .vscode folder from a project and restart VSCode?