How to create custom launch tasks?

I am working on a cross-platform project that requires me to build, run and debug my codebase on various embedded boards as well as on desktop computers. This is a bit tricky, though, because PlatformIO keeps rebuilding the launch.json file in VSCode overwriting any custom launch configurations that may have been added.

Is there a way to properly and permanently add an additional LLDB desktop launch configuration to PlatformIO so that I can select whether I want to run any of my embedded builds or a desktop build?

Does this help at all? I have been meaning to give it a try to see what it actually does, but having quite got there yet…

https://docs.platformio.org/en/latest/ide/vscode.html#custom-tasks

Not from what I can tell. This is to create custom tasks and yes, it works. However, launch configurations are entirely separate from tasks from what I can tell, so that this does not help with my actual problem.
The launch.json is automatically generated by PIO and I do not know where it actually retrieves the information from so it is not possible to add or modify these launch configurations. :frowning:

No one has had the need to create custom launch tasks before?

launch.json is created from the template file located at https://github.com/platformio/platformio-core/tree/develop/platformio/ide/tpls/vscode/.vscode. You can add static new content to that. On your computer it should be under <home directory/.platformio/penv/Lib/site-packages/platformio/ide/tpls/vscode/.vscode

2 Likes

Thanks so much for tip! Couldn’t find the file at first but then located it in <home directory/.platformio/penv/Lib/Python2.7/site-packages/platformio/ide/tpls/vscode/.vscode instead.
Made the change and it works!!! :slight_smile:

This answer looks to be out of date. What’s the modern equivalent? Thanks

Currently the specified path does not exist.
Can you you please update the current valid path?

I found the path located at :
.platformio\penv\Lib\site-packages\platformio\project\integration\tpls\vscode.vscode\c_cpp_properties.json.tpl