This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Thus making the feature forbidden fruit for affected scripts. In the following code the culprit is the comment. If you remove it, reformatting works nicely. Try to reformat following code: ==== class TTTest def howdy puts "Howdy" # I'm the comment who destroys formatting. Try to remove me. unless some_condition puts "some_thing" end end def i_am_misformatted puts "misformatted" end end ====
I took a quick peek at this testcase with a debugger, and this is not a formatter bug; the problem is in the lexer (bracket matching is also broken for example). Without the comment there, the lexer correctly identifies the "unless" token as kUNLESS, whereas with the comment, it returns kUNLESS_MOD (that is, it thinks the unless is a modifier which means that it does not consume a corresponding end.). The formatter uses the lexer tokens to control identation. I've gotta debug this to see why the comment trips up the lexer.
Here's another test case posted to dev@jruby by Uwe Hartl: class Bluff def blub return true if (false) # if (true) p "test" end end end tt = Bluff.new tt.blub
This is fixed (in Ruby feature module level 0.40).
Reassigning this issue to newly created 'ruby' component.
Changing target milestone of all resolved Ruby issues from TBD to 6.0 Beta 1 build.