Skip to content

Instantly share code, notes, and snippets.

@TheClams
Created September 18, 2022 08:39
Show Gist options
  • Save TheClams/f8b43391e2ec9ede9f8172a2d7fcb3e7 to your computer and use it in GitHub Desktop.
Save TheClams/f8b43391e2ec9ede9f8172a2d7fcb3e7 to your computer and use it in GitHub Desktop.
C# Region Fold
diff --git a/C#/C#.sublime-syntax b/C#/C#.sublime-syntax
index e1d97064..fbfc2941 100644
--- a/C#/C#.sublime-syntax
+++ b/C#/C#.sublime-syntax
@@ -120,11 +120,11 @@ contexts:
2: string.unquoted.cs
- match: '\b(region)\b\s*(.*)'
captures:
- 1: keyword.other.preprocessor.cs
+ 1: keyword.other.preprocessor.begin.cs
2: entity.name.section.cs
- match: '\b(endregion)\b\s*(.*)'
captures:
- 1: keyword.other.preprocessor.cs
+ 1: keyword.other.preprocessor.end.cs
2: variable.other.section.cs
- match: '\b(line)\s+(default|hidden)\b'
diff --git a/C#/Fold.tmPreferences b/C#/Fold.tmPreferences
index 3e224184..dd5b0f82 100644
--- a/C#/Fold.tmPreferences
+++ b/C#/Fold.tmPreferences
@@ -6,7 +6,7 @@
<key>settings</key>
<dict>
<key>indentationFoldingEnabled</key>
- <false/>
+ <true/>
<key>foldScopes</key>
<array>
<dict>
@@ -15,6 +15,12 @@
<key>end</key>
<string>punctuation.section.block.end</string>
</dict>
+ <dict>
+ <key>begin</key>
+ <string>keyword.other.preprocessor.begin</string>
+ <key>end</key>
+ <string>keyword.other.preprocessor.end</string>
+ </dict>
<dict>
<key>begin</key>
<string>punctuation.section.parameters.begin</string>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment