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 183453 - ERB Parsing Error
Summary: ERB Parsing Error
Status: RESOLVED FIXED
Alias: None
Product: ruby
Classification: Unclassified
Component: RHTML (show other bugs)
Version: 6.x
Hardware: PC Linux
: P2 normal (vote)
Assignee: Erno Mononen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-04 13:55 UTC by xiljin
Modified: 2010-04-13 17:39 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Screenshot of the parsing error (72.83 KB, image/png)
2010-04-07 15:45 UTC, xiljin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description xiljin 2010-04-04 13:55:29 UTC
With Rails3 Beta2 is a new deprecation -

"<% %> style block helpers are deprecated. Please use <%= %>."

These warnings are for blocks such as -

<% form_for %>
<% form.fields_for %>

Converting these blocks to the <%= xxx %> style results in a parsing error.
Comment 1 xiljin 2010-04-04 14:09:44 UTC
Beta2 CHANGELOG reference -

http://github.com/rails/rails/raw/v3.0.0.beta2/actionpack/CHANGELOG
Comment 2 Erno Mononen 2010-04-06 08:09:21 UTC
Thanks for the report. For some reason I'm not seeing the error, can you please post here an example view where you get the parsing error? Thanks.
Comment 3 xiljin 2010-04-07 15:45:52 UTC
Created attachment 96868 [details]
Screenshot of the parsing error

This screenshot shows the parsing error caused by line 1 and the syntax highlighting side effects it has.  The view was generated using the following command -

rails generate scaffold User name:string email:string
Comment 4 Erno Mononen 2010-04-08 13:04:41 UTC
Thanks. One more thing: which Ruby version do you use, 1.8 or 1.9? I can reproduce this with 1.9, but not with 1.8.
Comment 5 xiljin 2010-04-08 14:30:10 UTC
(In reply to comment #4)
> Thanks. One more thing: which Ruby version do you use, 1.8 or 1.9? I can
> reproduce this with 1.9, but not with 1.8.

ruby 1.9.1p376 (2009-12-07 revision 26041) [x86_64-linux]
Comment 6 Erno Mononen 2010-04-08 14:39:35 UTC
OK, so this is specific to the 1.9 parser. I'll need to fix this in jruby-parser and then upgrade it in NB.
Comment 7 Erno Mononen 2010-04-12 07:04:31 UTC
Turns out the problem is not in the parser really, but in the translated code produced by our embedding provider. I'm not sure how to fix that though as even ERB itself produces uncompilable code for this case, e.g. if you do the following in the Rails console

template = %(
 # form_for ... 
}
rhtml = ERB.new(template)
rhtml.src => shows the translated code
rhtml.run => syntax error

I guess there is something magical that Rails does to make this work, but I haven't found yet what exactly, and even if I found it I'm not sure if our embedding provider could mimic that behavior. I guess I may just end up disabling error badges for rhtml files.
Comment 8 Erno Mononen 2010-04-12 09:34:13 UTC
Fixed in b1b4b687bfd6 by disabling explorer error badges for rhtml files. Will revisit this if I figure out what Rails is doing to make views with <%= form_for %> compilable.
Comment 9 xiljin 2010-04-12 15:26:37 UTC
(In reply to comment #8)
> Fixed in b1b4b687bfd6 by disabling explorer error badges for rhtml files. Will
> revisit this if I figure out what Rails is doing to make views with <%=
> form_for %> compilable.

Thanks Erno.  Is it possible for end users to disable syntax checking for particular file types like rhtml?  

I'm still stuck on 6.8 (mainly because of the nbgit plugin) and although there are no error badges in that version, this issue still causes problems with the syntax highlighting there as well.
Comment 10 Erno Mononen 2010-04-13 08:58:22 UTC
>Thanks Erno.  Is it possible for end users to disable syntax checking for
>particular file types like rhtml?  

Unfortunately not, the syntax errors are from the parser, but we can't skip parsing rhtml files altogether as most of the editing features would not work then (highlighting, code completion etc). I will still try to investigate how we could make the translated code for <$=form_for%> views error free.
Comment 11 Quality Engineering 2010-04-13 17:39:57 UTC
Integrated into 'main-golden', will be available in build *201004131450* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/b1b4b687bfd6
User: Erno Mononen <emononen@netbeans.org>
Log: #183453 - ERB Parsing Error