@CodeBiene said in Perl folding fails on comment with right curley brace "#}":
So it has nothing to do with the fact that there are several consecutive comment lines.
I agree that It is something that has not been mentioned yet.
The hexadecimal 3FF displayed in the margin is negative folding caused by unbalanced braces.
perl_fold4.gif
2 frames alternate every 4 seconds displaying the default lexer property value of
fold.perl.comment.explicit=1
and the changed value of
fold.perl.comment.explicit=0
Comment explicit enabled for the lexer is usually the leading comment character(s) followed with a brace. Perl comment explicit is #{ as a open fold and #} as a close fold.
Notice the line with #} { shows fold flags of 402 401 which means it is closing a fold. The next frame with that same line shows fold flags as 402 402 which means that there is no change in the folding state.
The Ctrl+Q key sequence changes } { to # } { which is not recognized as a fold by comment explicit as to the space after the # symbol.
PythonScript can be used to disable the comment explicit option which is enabled with the value of 1 by default:
editor.setProperty('fold.perl.comment.explicit', 0)
This setting will not survive changing buffers so may need a callback to be setup.