After updates to code folding, now it is not possible to use indentation level folding.
This is still very useful as I have written an extension around the original behavior which provides a much better experience to code folding.
https://marketplace.visualstudio.com/items?itemName=dakara.dakara-foldplus
However, this extension is now broken.
I see potential options:
(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:
There is a new setting "editor.foldingStrategy": "indentation" to get back the old behavior.
I really like the idea of having syntax-aware folding, but I think it's important to keep some of the "indentation folding logic" as well.
If you have a look at ES6 template strings, for example, they cannot be folded with the new strategy which is a no-go in my opinion and the reason I am switching back to the old strategy.
Ideally, the syntax-aware folding should go on top of of the indentation based one, so indentation based folding works the same as always with the added bonus of the syntax-aware folding.
In regards to the setting editor.foldingStrategy, thanks this is helpful; however, in #46944 it seems this may only be temporary. I would like to see some clarification if indentation folding will continue to be supported.
@T-Specht Supporting combined strategies would be great; however, not sure if that is possible. What happens when you have a conflict? Indentation folding for a line might fold differently than the folding defined for the language of the same line.
I think for my extension, I will add a command toggle to make it faster and easier to switch between the folding strategies.
@T-Specht Thinking more about the combined strategies, I'm thinking it might actually be better if there was a new commands introduced called something like Fold By Structure instead of fold by level. This would signify using the language defined folding. Then both could be used at the same time.
"editor.foldingStrategy": "indentation" is not going away.
API to access the folding level at a given line is currently not planed.
Most helpful comment
There is a new setting
"editor.foldingStrategy": "indentation"to get back the old behavior.