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.

Bug 160612 - possible regression in RHTML indentation
Summary: possible regression in RHTML indentation
Status: NEW
Alias: None
Product: ruby
Classification: Unclassified
Component: RHTML (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: issues@ruby
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-19 09:26 UTC by David Konecny
Modified: 2011-01-28 20:13 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Konecny 2009-03-19 09:26:05 UTC
[please evaluate and lower priority if not important. thanks. below is snippet from my announcement of HTML/JSP/CSS
indentation rewrite]

Ruby and PHP formatters relied on behavior of old HTML formatter which indented all lines regardless if they start with
html or not and Ruby/PHP would then just further adjust indentation of some lines. This is completely different now: one
of the rules I set for rewrite of HTML formatter was that formatter touches only lines which belongs to it: if line
start with an HTML tag then it will be indented by HTML indenter; if not then it's a job of formatter of the language of
that line. For now I resolved this by storing Map<line-number, suggested-indentation> in document's properties. This is
done by HTML (or CSS or JSP) formatter and can be reused by Ruby/others to.

For Ruby fix was straightforward (de607f2c3cb3) and seems to work. The only problem I'm aware of are failing tests in
RhtmlKitTest (testNewline4a , 4b, 5* and 6). These tests worked before but do not work now but I cannot figure out how
could it be related to HTML indentation because it is purely Ruby formatter's job (eg. "<% if true %>^\n" should become
"<% if true %>\n  ^\n"). SImilarly pressing Enter in editor after ruby expression does not indent line properly.
Comment 1 Erno Mononen 2009-03-19 09:37:28 UTC
Thanks for the reminder, I had forgotten to look at this.
Comment 2 Erno Mononen 2009-05-12 12:12:21 UTC
I had a look at this some time ago, while debugging a 6.5 build it seemed to me that it wasn't really the rhtml 
indenter that indented this correctly in 6.5; perhaps it got (incorrectly) indented by another indenter before the 
changes. But that was really my first ever peek into indententation and I may well have misunderstood how it is 
supposed to work.
Comment 3 David Konecny 2009-05-12 20:52:06 UTC
RE. "perhaps it got (incorrectly) indented by another indenter" - that's the case. It was indented by HTML formatter
despite it being pure Ruby code that HTML formatter knows nothing about. I fixed the HTML formatter to stop doing that.
:-) What needs to be done is to simply (though it is faaaar from simple) enhance RHTML formatter to handle all its
lines. I will have a look at it again. I originally filed this as P2 just to get early evaluation. If nobody complained
about this so far then perhaps it is P3.
Comment 4 Petr Jiricka 2009-05-13 08:55:14 UTC
Not sure how common it is to have long blocks of Ruby inside RHTML. If it's not that common, I agree this is a P3,
especially if noone complained.
Comment 5 Erno Mononen 2009-05-13 13:17:13 UTC
David, thanks a lot for the evaluation. I would agree that this is a P3, as far as I can tell the problem is only after 
inserting the first new line within <% %>, indentation works fine within multiline blocks. So I'm downgrading this for 
now.
Comment 6 Quality Engineering 2010-03-17 05:16:37 UTC
Integrated into 'main-golden', will be available in build *201003170201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/5609d79712e3
User: Erno Mononen <emononen@netbeans.org>
Log: #160612 related, made the failing test only to report a warning until the issue gets fixed