platformio-core: Project Configuration does not preserve comments in `platformio.ini`

Behaviour Change Request

I think this may go in the ‘too hard basket’ … but still have to ask 😉

The (fantastic, btw!) project configuration GUI does some… Makes some questionable changes to the platformio.ini configuration file. I shorten the header text on a lot of mine, and also comment my libdeps lines, but by …

  1. opening the configurator
  2. adding a description
  3. hitting save

… this removes the comments, and re-adds the full header to the file. Also, as noted by another user, it sometimes adds

lib_archive = yes
test_build_project_src = no

on it’s own, even though these options haven’t been touched.

So is it possible to not change lines if they haven’t been modified… i.e. don’t strip the comments, and perhaps not make changes to the header.

2019-11-16_16-20 vscode pio configurator

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Comments: 16 (11 by maintainers)

Commits related to this issue

Most upvoted comments

Sorry, now I understand. You can use custom fields in environment sections. Just add custom_ prefix. For example, custom_env_comment = Simple MCVE environment.

Ahhh, formatting? We do not do this. We use native Python’s ConfigParser to save the configuration in a raw INI file. They know better how to do this.

Nope, that’s also not what I meant. See these added (not existing) parameters:

env_comment = Simple MCVE environment
env_description = Simple MCVE environment to build POC for new reported issues

Just to make sure it is not about formatting, I removed the spaces 😉

We will assess this package in the upcoming PlatformIO Core 7.0. The last time we tried it (Python 2.7), it was buggy and didn’t parse complex INI files very well.

Just ran into this issue myself. I see the discussion above but this issue is still listed as open. Is PIO going to preserve platformio.ini comments by default? That’d be amazing, but otherwise, I’d suggest closing this issue with Won’t Fix

Can you add a description or comment tag to the env section? Maybe that can also be used later for other purposes in PIO to maybe show in a tooltip or whatever fancy way to give more info on the env section.

That would help overcome the lost comments. A single line and multi line option would be great. One for a more short description and one for something like an abstract. It would also be useful to be able to wrap them in a define in the accompanying Python script so you can use it in the build itself.

configobj

I saw this project, it’s fully abandoned => https://github.com/DiffSK/configobj/releases