Lukas,

On May 9, 2006, at 2:39 AM, Lukas Felber wrote:

I recently looked at the RDT CodeFormat. When I get it ( RubyPlugin.getDefault().getCodeFormatter() ) I get an Instance of OldCodeFormatter. As I see it the OldCodeFormatter is not really smart. Is that the reason it's called OldCodeFormater? Now I wonder if there are plans about writing a new formatter (or if there is already one)?

Yes, I recently reworked the infrastructure for the code formatting. In the process I renamed our code formatter to OldCodeFormatter to signal that we really need a newer one which can do many more adjustments and also does everything by building up TextEdits (rather than just wiping away the old text and replacing it with one single TextEdit).

There are plans to eventually write a new formatter, but no work has started yet. I wanted one which could take the AST and do more advanced modifications based on user preferences, much like the JDT - so users could tweak the formatting/styling very heavily. One example would be to turn single line conditionals to modifiers automatically if they fit in the line length:

if something?
  puts "Hello"
end

becomes...

puts "Hello" if something?

Other ideas include automatically converting function calls to skip the parentheses if the call wouldn't be ambiguous, smartly inserting newlines to match the line length, regulating empty lines around constant/method/type definitions, etc. The CodeFormatter might be a good way for you guys to get an idea of how to build up TextEdits and spit out alternate syntax for an equivalent AST. I'd appreciate any help I could get with this.

Thanks,
Chris



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Rubyeclipse-development mailing list
Rubyeclipse-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rubyeclipse-development

Reply via email to