There will (hopefully soon) be guides on the wiki on GitHub
, but in the mean time your best bet is to examine how it's implemented by looking at the classes in the org.fife.ui.rsyntaxtextarea.folding
package. Basically, you create your own implementation of FoldParser
, register with the singleton FoldParserManager
for the application, then create an RSTA instance and set it up to use your language. The folding will automatically be used (assuming folding is enabled in the RSyntaxTextArea).
Check out the CurlyFoldParser
class for a concrete example. It's used for many languages: C, C++, Java, Perl, etc. The key piece of a FoldParser is the getFolds() method. It's called whenever the document changes (after a small delay, to coalesce small changes), and is supposed to return a list of all folds for the entire document.