Code folding
This library support code folding, but only for read-only editors. All editors on this page are therefore read-only. Code folding for writable editors is significantly more complex and therefore not implemented.
Try it
Section titled “Try it”Providers
Section titled “Providers”By default, the readOnlyCodeFolding() extension won’t fold any ranges. You need to pass folding range providers to the extension when it’s created.
There are currently 4 providers you can import:
bracketFolding()adds folding to round-, square-, and curly brackets.tagFolding()adds folding to XML tags.blockCommentFolding()adds folding to block comments.markdownFolding()adds folding to headings and code blocks in markdown.
Adding your own
Section titled “Adding your own”You can easily create your own FoldingRangeProvier. The providers are called with the current editor and should return an array of foldable ranges. These ranges should span multiple lines.