Skip to content

Commit 556da23

Browse files
committed
Allow folding indented code blocks below ‘when’ statements
Since when statements can have their code “inline”, e.g. “when match: do_something” we match lines with ‘when’ keywords either not containing any ‘then’ or colon (‘:’), or where ‘then’ or colon are the last things on the line (except for a trailing line comment).
1 parent 05698e9 commit 556da23

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Preferences/Folding.tmPreferences

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88
<string>source.ruby -string.unquoted.heredoc</string>
99
<key>settings</key>
1010
<dict>
11+
<key>foldingIndentedBlockStart</key>
12+
<string>(?x)
13+
^ \s+ when \s
14+
( .* (\s then | :) \s* (\#.*)? $
15+
| (?! .*? (\s then | :) \s+ [^#\s] )
16+
)
17+
</string>
1118
<key>foldingStartMarker</key>
1219
<string>(?x)^
1320
(\s*+

0 commit comments

Comments
 (0)