Hi,
I’m trying to us code folding to show specific lines of content and hide the irrelevant lines at initialisation. The lines I want to fold are ad hoc and not dependant on any feature of the language mode.
For example in one editor I need to show only lines 3-7 and 19-23, and fold the rest.
I’ve tried dispatching foldEffects for the lines I want to fold, but nothing happens, I get no errors and not sure how to go about debugging this.
view.dispatch({
effects: foldEffect.of({ from: 1, to: 5 })
});
Guesswork, but I think what is happening is that the background code is determining that the code at these lines are not ‘foldable’. Is this likely to be the case?
I’ve tried providing a FoldService but I don’t think there’s anything here that can help. Foldable sounds like it might be a direction to investigate but I haven’t managed to figure out how to provide my own foldable implementation yet as examples are quite sparse.
Is this something that should be possibl, and if so does anyone have any pointers as to where to look?
Alternatively, while it feels hacky, could selecting multiple lines programmatically and calling FoldCode potentially be a solution? While this feels hacky, I suspect it would probably fall foul of the same issue I have dispatching the FoldEffect as this feels like it’s probably doing something very similar in the background.