Go to definition redirects to function prototype and not definition, workaround keeps reverting back

i’ve just moved to platformio from the eclipse based ides, i noticed on using ‘ctrl+click’ to go the definition, i got redirected to the function prototype present in the header and not the actual source file.

was able to workaround by changing the “limitSymbolsToIncludedHeaders”: true, to false in the 'c_cpp_properties.json" file and adding the location for the source files in the list of paths.


which works as i now get redirected to the definition in the concerned c file.
however, it has to be done every time i open VSCode and doesn’t work sometimes. is there a more accurate was to achieving this ? i read a discussion about build flags but couldn’t seem to work with it with my limited knowledge of python

You might want to just export the PlatformIO project for Eclipse and keep working in Eclipse (Eclipse — PlatformIO latest documentation)…

The normal symbol browse paths are added via the Python code of the platform (e.g. ststm32, all the CPPPATH additions e.g. here). If you want these standard paths to be modified so that VSCode finds the implementation, you can open an issue (Issues · platformio/platform-ststm32 · GitHub).

Still, build_flags may be able to be used in a build_flags = -I <path> fashion to further add to the explorable paths.

1 Like

Add -I "$PROJECT_CORE_DIR/packages/framework-stm32cube/f4/Drivers/STM32F4xx_HAL_Driver/Src" to your build_flags to add that particular folder, and then Ctrl+click / F12 should take you to the definition, not the declaration.

1 Like

Thanks a lot.
A quick restart and it works. i presume using python commands and reading more syntax would help me grow beyond my scope currently only limited to electronics.

1 Like

Fantastic! :slight_smile: In this case, more PlatformIO specific bits (to make VSCode work properly), rather than python.

1 Like