Code Beautifier/Formatter

Post a reply

: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: Code Beautifier/Formatter

Re: Code Beautifier/Formatter

Post by robert » Mon Aug 08, 2011 1:37 am

Yes, you should be able to use the tokens made by RSTA. Get the tokens for a line via:

Code: Select all
Token tokenList = textArea.getTokenListForLine(int line);

This is a linked list of tokens.

Re: Code Beautifier/Formatter

Post by franz » Thu Aug 04, 2011 4:47 pm

Hi, I think about implementing a SQL code formatter myself.
Do you think it is possible to reuse the tokens generated by for this task?

Thanks and kind regards,


Re: Code Beautifier/Formatter

Post by kenston » Sat May 01, 2010 2:41 am

Hi Robert,

I think the idea of allowing user to define their formatter library would be good. Here are some libraries shared by other people I was thinking of using Eclipse' Source format, which actually has a lot of customizable features like line width etc., but I'm not sure how we can port these things to RText. Thanks

Re: Code Beautifier/Formatter

Post by robert » Fri Apr 30, 2010 1:01 pm

Hi Kenston,

There aren't currently plans to add a beautifier library. In the RText editor which uses RSTA, there will be a beautifier plug-in in the next release, though it will likely only handle HTML/XML via JTidy, a Java port of HTMLTidy.

Do you know of high-quality beautifiers for other languages? Preferably (though not required to be) written in Java for in-process integration? There are a few for Java, but it appears that many are no longer maintained and don't handle Java 5 syntax properly. One project that looks promising for Java is JIndent, but unfortunately I could not ship the library with RText (or an RSTA add-on), judging from the license - I would require the user to download it themselves and drop it into a certain location for the add-on to pick up.

Any ideas or suggestions?

Code Beautifier/Formatter

Post by kenston » Fri Apr 30, 2010 4:55 am


Are there any plans of integrating a code beautifier/formatter which will auto-format the code, placing necessary indentions, new lines, etc. for different syntax?