Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 336989 - [templates] ${} is ignored when ${:import(...)} is defined inside a template pattern
Summary: [templates] ${} is ignored when ${:import(...)} is defined inside a template ...
Status: CLOSED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.5.2   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-11 13:16 EST by Terry Denney CLA
Modified: 2019-12-22 18:53 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Terry Denney CLA 2011-02-11 13:16:48 EST
I am trying to define a code template for creating a new method and would like to have the cursor stop at the empty parameter list. I have a pattern similar to this:
private void get(${}) {
	${cursor}
} ${:import(...)}

The cursor starts at the method body and when I hit tab it doesn't go to the method parameter list. When I remember the ${:import(...)} variable, then the cursor starts at the method parameter list and on tab jumps to the method body as expected.
Comment 1 Markus Keller CLA 2011-02-14 09:19:56 EST
> When I remember the ${:import(...)} variable, ...
I guess you meant "remove", not "remember".

As a workaround, give the "import" variable a dummy name, e.g.

private void get(${}) {
    ${cursor}
}${x:import(java.util.Vector)}
Comment 2 Terry Denney CLA 2011-02-14 10:58:06 EST
Yes sorry..I meant remove. Thanks for the workaround!
Comment 3 Markus Keller CLA 2011-02-14 12:24:39 EST
The general problem is that multiple variables without a name are not handled gracefully.

The parser doesn't even allow templates like this:
    ${:import(java.util.Vector)}${:importStatic(java.lang.Math.PI)}

But it doesn't yell if there are one or more ${} in the template.
Comment 4 Eclipse Genie CLA 2019-12-22 18:53:51 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.