Open studyingegret opened 1 year ago
You can use "explicitFolding.debug": true,
to print some info in the output panel.
With the non-working rule, you will get:
[main] regex: /(?<_0_0>\/\/\/)|(?<_2_0>\/\/\/ \-)|(?<_0_1>\{\{\{)|(?<_2_1>\}\}\})/g
[main] line: 43, offset: 0, type: BEGIN, match: ///, regex: 0
[main] line: 46, offset: 0, type: BEGIN, match: ///, regex: 0
[main] line: 48, offset: 0, type: BEGIN, match: ///, regex: 0
[main] line: 51, offset: 0, type: BEGIN, match: ///, regex: 0
[document] foldings: []
The begin
is matching both markers...
With the following rule, it is working as you intended:
{
"beginRegex": "\\/\\/\\/(?! -)",
"end": "/// -"
},
Thanks. It looks like the begin
pattern and the end
pattern must have no overlap, or the begin
pattern will take precedence.
What about noting this in the documentation?
Yep, I did forgot to add that...
Another solution is to use "nested": false
to disable nesting, which will make the rule truly unambiguous (tested).
{
"begin": "///",
"end": "/// -",
"nested": false
}
But "nested": false
disables all other folding ranges within the folding ranges created by this rule, which means code in sections cannot be further folded. So your solution is the ultimate solution.
I guess beginners will be confused by this for a while...
VSCode: 1.70.1 Explicit Folding: 0.21.0 Language: C
I'm trying to fold code with sections like this:
into this:
When I use:
the folding ranges appear correctly.
But when I use:
no folding ranges appear.
Did I misunderstand anything?