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 121663

Summary: Code templates should expand from embedded languages' templates
Product: editor Reporter: jamespb <jamespb>
Component: Completion & TemplatesAssignee: Vitezslav Stejskal <vstejskal>
Status: RESOLVED FIXED    
Severity: blocker CC: pjiricka, tor
Priority: P2    
Version: 6.x   
Hardware: All   
OS: Windows Vista   
Issue Type: DEFECT Exception Reporter:

Description jamespb 2007-11-10 20:12:47 UTC
None of the ruby code templates appear to be working in a erb file.  The Ruby HTML templates are working (things like
table), but the regular Ruby templates aren't expanding.

Product Version: NetBeans Ruby IDE 20071110080227
Java: 1.6.0_01; Java HotSpot(TM) Client VM 1.6.0_01-b06
System: Windows Vista version 6.0 running on x86; Cp1252; en_US (nbrubyide)
Userdir: C:\Users\James\AppData\Roaming\.nbrubyide\dev
Comment 1 Torbjorn Norbye 2007-11-13 16:52:36 UTC
(As far as I know, this has never worked)

The problem is in the editor code templates code; it needs to check abbreviations in embedded languages, such that when
you're in JavaScript it expands JavaScript code templates, in HTML the HTML templates, and so on.
Comment 2 Vitezslav Stejskal 2007-11-14 10:46:51 UTC
Yeah, this needs to be fixed. Currently the editor uses codetemplates from a top-level language _anywhere_ in a file.
Comment 3 jamespb 2007-11-14 16:30:57 UTC
Given a choice between

1.  erb files use Ruby templates, and there's no way to define templates just for an *.html.erb file
2.  erb files and Ruby files have completely different code templates, so I can define templates that only work in
*.html.erb files, and different templates in *.css.erb, etc.

I'd definitely choose #1.  When I'm editing foo.html.erb, and I'm in a <% %> section, I'm writing Ruby; it's very
surprising that the code templates I use all the time don't work.
Comment 4 Vitezslav Stejskal 2008-02-11 12:58:52 UTC
I'm working on this one now.
Comment 5 Vitezslav Stejskal 2008-02-14 12:54:48 UTC
Should be working now. I also updated ruby.rhtml to make both its ruby and rhtml templates work. James, we did #1.

changeset 329dd78d09a7 in main
details: http://hg.netbeans.org/main?cmd=changeset;node=329dd78d09a7
changeset 3275161479d9 in main
details: http://hg.netbeans.org/main?cmd=changeset;node=3275161479d9