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 134205 - JSP: tab key does not cause code template to expand
Summary: JSP: tab key does not cause code template to expand
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Completion & Templates (show other bugs)
Version: 6.x
Hardware: PC All
: P2 blocker (vote)
Assignee: Vitezslav Stejskal
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-30 00:07 UTC by mbarnes
Modified: 2008-06-07 16:12 UTC (History)
0 users

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 mbarnes 2008-04-30 00:07:42 UTC
I've been using NB 6.01 for several months. I was using it earlier today.
Then I installed NB 6.1.

When editing a JSP file, on a new blank line I type ag<tab> and the "ag" code template
does not get expanded.  A <tab> gets inserted after the "ag" instead.

I'm using Windows XP SP2 with JDK 1.6.0_06.

If I quit 6.1 and bring up 6.0.1, the code templates work.

There's no problem when editing Java code.

I could go to Tools -> Options -> Code Templates, scroll to the desired template and
select it, select all the text for the template, and use ctl-C to copy it into the
clipboard, but that's extremely cumbersome.  It actually works better to keep a gvim
(editor) session listing my templates and using copy/paste.
Comment 1 Jiri Prox 2008-04-30 10:37:55 UTC
I think the problem is in mime-types, in html part of jsp there are working code templates from language HTML, in the
java parts, commonn java abbreviations can be used.

This brings me to the question: Isn't language JSP in code templates options redundant?
Comment 2 Vitezslav Stejskal 2008-05-04 16:13:26 UTC
> This brings me to the question: Isn't language JSP in code templates options redundant?

I think, they are not. There can be templates specifically useful for writing JSP tags/code that have no meaning in
plain HTML. We should be able to offer these in HTML sections of a JSP file.
Comment 3 mbarnes 2008-05-07 20:22:38 UTC
It sure would be nice to have a fix for this.

Our site uses a lot of common JSP elements. I use fill-in-
the-blanks.  And there's a nasty problem on 6.0.1 on Windows
that keeps adding and adding blank lines to Code Templates
that makes Code Templates only slightly more useful than on
6.1, where they don't work at all.
Comment 4 Jiri Prox 2008-05-12 10:01:52 UTC
mbarnes: have you tried to move the templates to language html if they are supposed to by uses within html code or to
language java, if they should be used inside java code?
Comment 5 mbarnes 2008-05-15 23:48:26 UTC
Well, duplicating the code templates as HTML templates does seem to work.

Is there a way to move them all, without having to enter, copy, and paste each, one-by-one???
Comment 6 Vitezslav Stejskal 2008-05-19 10:34:07 UTC
I think you could do the following:

0. Shutdown the IDE and backup your userdir
1. In your userdir create the following folders: config/Editors/text/x-jsp/text/html/CodeTemplates/Defaults
2. In the above folder create 'codetemplates-hack.shaddow' file
3. Make sure that the file has only one line with the following content 'Editors/text/x-jsp' and the file's encoding is
UTF8.

You can now start the IDE and try JSP templates in HTML parts of a JSP file. They should work now. Please let me know if
it works.
Comment 7 Vitezslav Stejskal 2008-06-07 10:01:23 UTC
http://hg.netbeans.org/main/rev/8608885d6877
Comment 8 Quality Engineering 2008-06-07 16:12:31 UTC
Integrated into 'main-golden', available in NB_Trunk_Production #243 build
Changeset: http://hg.netbeans.org/main/rev/8608885d6877
User: Vita Stejskal <vstejskal@netbeans.org>
Log: #134205 (fixed): enabling jsp code templates in HTML sections of JSP files