Skip to content

Commit

Permalink
Improve folding settings
Browse files Browse the repository at this point in the history
Don't mark lines that both end and start a block as completing a fold, example:

```perl
if ($foo eq 'bar') {

} elsif ($baz > 8) {

} else {

}
```

Also now allow comments to follow the opening of a `{}` group.
  • Loading branch information
infininight committed Feb 12, 2019
1 parent 80826ab commit 7390bf7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Preferences/Folding.tmPreferences
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,17 @@
<key>settings</key>
<dict>
<key>foldingStartMarker</key>
<string>((\{|\[|\()\s*$)</string>
<string>(?x)
^ \s* (?![\s}]) .* # Ensure a block doesnt both start and end on the line
\{ \s* ($|\#) # Open block
| (\[|\() \s* ($|\#)
</string>
<key>foldingStopMarker</key>
<string>(^\s*(\}|\]|\)))</string>
<string>(?x)
^ \s* \} # Close block
(?! .* \{ \s* ($|\#)) # Ensure a block doesnt both start and end on the line
| ^ \s* (\]|\))
</string>
</dict>
<key>uuid</key>
<string>ABBA3E7D-D306-4E27-8DE3-FECBA5C5A6C6</string>
Expand Down

0 comments on commit 7390bf7

Please sign in to comment.