PlatformIO prototype files for new projects

Hello:

I am somewhat a scatterbrain, and as such I begin a lot of different projects and I find I have to do the same tasks at the beginning of each new project.

For example, I have some libraries I must include using the build_flags in PlatformIO.ini, and I like to delete the big comment field in the PlatformIO.ini file. Also, I want a [platformio] section in all my new projects.

Also, the new project creates a main.cpp and the template is not for me. I’d like to have my own main.cpp file with my own starting format.

Does PlatformIO have come template files it uses to build these files during creation of a new project?, And if so, where are they?

Thanks, Mark.

In VSCode, you can create your own “Snippets” that you can then easily insert using the VSCode command pallete. See

https://code.visualstudio.com/docs/editing/userdefinedsnippets

So, you could create your own platformio.ini snippet, and your own main.cpp snippet (Ctrl+Shift+P → Configure Snippets). Then just delete the autogenerated file and then Ctrl+Shift+P → Insert snippet to fill it in.

The main.cpp snippet is hardcoded in the PlatformIO core, unless a specific platform (like platform-ststm32 etc.) overides at. As thus, it’s not really user-configurable.