Jeroen van der Ham wrote:
I'm not completely sure, but I don't think you can use scope selectors when defining folds.
That would explain why I haven't managed to do so. But I do think folding markers inside comments should be defined completely separate from those outside comments. (I'd also like to specify pairs, so if and end_while don't match, but thanks to snippets, that's less of an issue.)
But note that the if occuring in the comment might match the foldstartmarker, but there would have to be a matching foldstopmarker at the same indent level to make it a fold. So I don't think that it would show up as a fold.
I do get a start-of-fold marker.
I think that if you really want this to work properly, you'll have to expand the match more to not only match "if", but also the pattern after it.
That would have to be a multi-line match, and still catch ordinary English text in comments.
best regards, Christopher