PIo/vsc breaks code when I try to format the source

Hi there!

Please help. Just installed PIO with VSC it was working great for a while but after some update, I suppose, it started to break my sources when I try to format it with the “editor.action.formatDocument”. It works for a while formatting well, but then, I don’t understand after what happened, but it starts to mess my sources completely. After restart the situation repeats - it works again for a while, then starts to break the source while formatting.

I have installed home 2.3.3, core 4.0.3, c/c++ (ms) 0.25.1, pio ide 1.8.3, ini for vsc 0.0.4 and that’s all.

  • Example of a before and after code snippet?
  • VSCode version?

Sorry, forgot to include:
Version: 1.38.0
Commit: 3db7e09f3b61f915d03bbfa58e258d6eee843f35
Date: 2019-09-03T21:47:00.464Z
Electron: 4.2.10
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Darwin x64 18.7.0

Will send an example as soon as it will start to do that again, usually it happens when I write the code and format it time after time.

Before:


After formatting:

Installed plugins:
image
Version:
image

Hm I see. Can you find a way to make it reproducable? E.g., does the formatter always go crazy on that particular source code?

Tried to understand when it happens but did not succeed. It happens on different sources, usually after I upload my program but not always. Sometime after save - don’t understand exactly when

You have another formatting extension loaded - the ini file formatter. Although it shouldn’t be having any effect on a cpp file, you could try disabling it or removing it to see if the behaviour changes. In particular, I wonder what happens when platformio.ini updates when you have this extension loaded. The right answer would be ‘nothing’, but…

1 Like

Agree. Deleted it. Restarted vsc. Will observe further and let you know, thank you!

1 Like