How to keep code-folding on save in Visual studio code
Had the same issue and it turned out to be the sort-imports extension. Removing it fixed the issue.
Thank you for bringing up the extensions Mark. It was indeed an extension: lonefy.vscode-js-css-html-formatter
.
Once this was disabled, the folding kept its state after saving.
For me it was the prettier plugin :(
Here is the closed issue: https://github.com/prettier/prettier-vscode/issues/408.
At the moment, there doesn't seem to be a fix.