Evan
Evan

Reputation: 412

TextMate source.java comment block folding

How do I modify the java language definition bundle foldingStartMarker and foldingStopMarker entries to allow for folding of these types of comment blocks?

This is the comment style:

/**
 * This is a comment...
 * Yet another comment...
 */

I've tried this:

foldingStartMarker = '(\{\s*(//.*)?$|^\s*// \{\{\{|^\s*\/\*\*)';
foldingStopMarker = '^\s*(\}|// \}\}\}$|\*\/)';

I get the first match for '/**' characters, but I can't get it to find the StopMarker '*/'.

Thanks!

Upvotes: 1

Views: 736

Answers (4)

Jürgen Strobel
Jürgen Strobel

Reputation: 2248

Cannot be done at the moment. Documented textmate behaviour, folding start and stop must have exactly the same indention level. Use the **/ workaround.

Upvotes: 0

Petr Vostrel
Petr Vostrel

Reputation: 2332

This works for me (in Javascript language):

foldingStartMarker = '^\s*\/\*';
foldingStopMarker = '\s*\*\/$';

Upvotes: 1

Alexander Klimetschek
Alexander Klimetschek

Reputation: 3714

Same problem here (custom language, but same comment block style). It seems that the foldingStopMarker never works on lines starting with a whitespace.

I tried many combinations and whenever the line does start with a whitespace, I was unable to build a foldingStopMarker regex that would match it, independent of the other characters in that line.

Seems like a bug.

Upvotes: 0

Reputation:

It's not ideal but I found that if you end your comment with **/ instead of */ in a C++ source file, it recognizes them for folding.

Upvotes: 0

Related Questions