How to add code folding and syntax checking?

Post a reply

Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:
BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON
Topic review
   

Expand view Topic review: How to add code folding and syntax checking?

Re: How to add code folding and syntax checking?

Post by Debels » Fri Mar 07, 2014 4:42 pm

Thanks again, can't wait for the syntax checking guide :)

Re: How to add code folding and syntax checking?

Post by robert » Fri Mar 07, 2014 1:36 pm

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.

How to add code folding and syntax checking?

Post by Debels » Tue Mar 04, 2014 10:09 pm

The title says it all, how can I implement code folding and syntax checking to a custom language?

I already made the jflex and java file.

Thanks

Top

cron