pvl / abap.tmbundle

TextMate support for ABAP
21 stars 9 forks source link

add #region #endregion support #6

Closed odjhey closed 5 years ago

odjhey commented 6 years ago

add Region folding

larshp commented 6 years ago

Hi, I'm not sure how it can be done in a textmate bundle, but pull requests are welcome

FreHu commented 5 years ago

Folding is based on these lines:

<key>foldingStartMarker</key>
<string>/\*\*|\{\s*$</string>
<key>foldingStopMarker</key>
<string>\*\*/|^\s*\}</string>

Since ABAP doesn't use /** or {, I assume they are leftovers from some sort of sample grammar. I guess they could be changed since they are useless, but I would be against adding something like #region since is not part of ABAP. Folding for methods/classes/control blocks could be useful.

Another question is whether editors actually support this. Vscode doesn't respect the markers at all and does its own thing (and does it better, for example it folds function calls which the grammar isn't even aware of):

code_2018-10-01_18-11-49

Edit: Not really that relevant since this is a general purpose grammar, but I figured out the vscode folding system. It's based on indentation:

code_2018-10-01_18-25-30