@@ -185,6 +185,30 @@ For the folding functions, ts-fold provides some default
185
185
int main() {...} // Folded node
186
186
```
187
187
188
+ - `ts-fold-range-markers` - Folds the node starting from a giving delimiter
189
+ character. Useful if tree-sitter's node definition doesn't align with the
190
+ start of the desired folding section.
191
+
192
+ **NOTE:** This folding function requires a lambda (or an externally
193
+ defined function wrapper) so that the delimiter can be specified. You
194
+ usually don't need to worry about the `node` and `offset` variables, so just
195
+ pass them through.
196
+
197
+ ```go
198
+ type Dog interface {
199
+ Bark() (string, error)
200
+ Beg() (bool, error)
201
+ }
202
+
203
+ /* | Note: The tree-sitter node starts at the word interface, not at the '{'.
204
+ * | '(interface_type . (lambda (node offset)
205
+ * | (ts-fold-range-markers node offset "{" "}")))
206
+ * V
207
+ */
208
+
209
+ type Dog interface {...}
210
+ ```
211
+
188
212
- ` ts-fold-range-block-comment ` - Folds multi-line comments that are of the form
189
213
` /*...*/ ` . Should show a summary if the commentary plugin is turned on.
190
214
@@ -210,8 +234,10 @@ For the folding functions, ts-fold provides some default
210
234
211
235
- `ts-fold-range-line-comment` - For languages that have one line comment blocks
212
236
with the comment delimiter starting each line. Condenses all the comment nodes
213
- into a single fold. This folding function requires a lambda (or an externally
214
- defined function wrapper) so that the comment delimiter can be specified. You
237
+ into a single fold.
238
+
239
+ **Note:** This folding function requires a lambda (or an externally
240
+ defined function wrapper) so that the delimiter can be specified. You
215
241
usually don't need to worry about the `node` and `offset` variables, so just
216
242
pass them through.
217
243
0 commit comments