Folding for LaTeX


#1

I was looking at the bracket-matcher package, and came across some weird method it uses called adviseBefore Turns out, that method literally replaces the existing method with the provided one, and conditionally falls back to the original.

At the same time, I managed to find how fold arrows are made in the gutter and I have now happily updated my latex-folding package to just override the existing fold methods, and get “native” like custom folding.

The result is so effective and simple, I’m really happy I found this. I may even be able to extend it to a folding provider, where other languages that don’t really fit with indentation or Tree-sitter can provide custom folding logic.