When VS Code folds the range, it just completely hides its contents:

When IntelliJ folds the range, it shows a certain replacement string instead:

The latter behavior is more flexible, and it would be cool if the protocol supported it. It allows for the following features:
-
folding a subrange in the string, which allows to hide boilerplate (see this post for example)
-
folded blocks take one line instead of two:


- showing some important info from the fold, without making it more verbose:

To implement these features, we need to add two things to the protocol:
- a
replacementText?: string field to FoldingRange (this covers bullet points 1 & 2)
- add a
group?: number field to FoldingRange, such that all ranges in the group are folded-unfolded in lockstep. This covers use case 3, where { and } are separate folding ranges, linked into one group
However, I assume that the bulk of work here needs to happen on the editor's side as it seems like VS Code doesn't support such replacements yet.
When VS Code folds the range, it just completely hides its contents:
When IntelliJ folds the range, it shows a certain replacement string instead:
The latter behavior is more flexible, and it would be cool if the protocol supported it. It allows for the following features:
folding a subrange in the string, which allows to hide boilerplate (see this post for example)
folded blocks take one line instead of two:
To implement these features, we need to add two things to the protocol:
replacementText?: stringfield toFoldingRange(this covers bullet points 1 & 2)group?: numberfield toFoldingRange, such that all ranges in the group are folded-unfolded in lockstep. This covers use case3, where{and}are separate folding ranges, linked into one groupHowever, I assume that the bulk of work here needs to happen on the editor's side as it seems like VS Code doesn't support such replacements yet.