...I found the same 'problem' - ie., I use alot of zero-indented
{}s to group sections of code together. After much digging and
I found somewhere a statement that Vscode doesn't do folding on zero-indents, but will on indented braces (as has been pointed out).
This really ticked me off - so much goodness in vscode, but this drawback.
But, FYI, I use this extension:
AutoHotkey Plus by cweijan. If you look in
C:\Users\Dave\.vscode\extensions\cweijan.vscode-autohotkey-plus-2.6.2 and open the file
ahk.configuration.json you can edit the text which marks the "regions" alluded above. So, for me, the end of this file looks like:
Code: Select all
// Folding regions marked by ";region" and ";endregion" comments.
"folding": {
"markers": {
"start": "\\s*\\;\\s*Region\\b",
"end": "\\s*\\;\\s*endRegion\\b"
}
},
// Changed folding regions. These only apply to zero indent lines, as folding applies to indented lines.
"folding": {
"markers": {
"start": "\\s*\\;\\s*sReg\\b",
"end": "\\s*\\;\\s*eReg\\b"
}
}
}
where the second definition seems to trump the first. So for me a grouping of code using zero-indented braces looks like:
I'd love to understand more about how to get this flexibility without going the whole hog and learning (and probably failing!) to write my own extensions. Better still to get vscode to have some built-in way of folding zero-indented
{}s. Of course, if there were an update to
AutoHotkey Plus I'd lose this hack - so I'll figure out how to keep a copy in case!
HTHs.