How to find out the state of code folding in VS Code

30 Views Asked by At

There is an API for installing a folding provider ie your own logic for what ranges of source code are eligible for folding. However, I can't find any way to determine the state of folding - what ranges are currently folded.

Why would I want this? To print the file as it displays, so that when a section is collapsed in the editor it's also collapsed in the print job. It's a feature request from a user of a VS Code extension I wrote.

At first I thought I might hook onDidChangeFoldingRanges?: Event<void> and maintain my own model but this event merely announces to VS Code that eligible folding ranges have changed, presumably because the document has changed.

0

There are 0 best solutions below