See also this question: How do I avoid expanding folded regions when I invoke the code formatter?
This is not a dupe, because I'm interested in solving the problem using the ToolsApi.
When I press CTRL + D the code formats nicely (mostly).
But all my folded code sections get unfolded.
Is there a way to keep these sections folded.
If not, is it possible to save the code folding info prior to formatting, so I can restore it later?
I'm thinking of writing IDE-addin using the Open Tools api.
I'm using XE7, but this problem exists in all versions that have source formatting.
Possible scenario's involve:
- Record and replay code foldings (hook
elide
calls). - Only allow formatting to work on the current block (redefine the CTRL + D action).