tags:

views:

15

answers:

1

In NetBeans I can set up a bunch of templates such that typing psvm tab expands to

public static void main(String[] args) { 

}

I see that Eclipse also has templates, but they are triggered in a different way - Ctrl-Space. But I don't see a way that you can have the template automatically triggered -instead, a popup appears and you pick which of the code completions to execute. Is there a way to make Eclipse pick the template that matches automatically, without showing that popup? In Netbeans it's a lot less intrusive to insert these code snippets, and I'm hoping it's possible to do the same in Eclipse. Any experts know for sure?

A: 

In Eclipse push Enter after typing the template name. The popup comes up quickly but you can STILL type.

Say your template name is: tr

type: tr[PUSH:ENTER] template will complete without the popup, or even if the popup comes up push enter to finish and make it go away.

Also do not name your templates the same name as a PHP keyword as the keyword is listed first

i.e

template name: function

typing: function popup will come and list function function - Template

and you'll have to select the second one

if you named it: func then type func[enter] it'll autocomplete

Viper_Sb
Hum, no. If you press <enter> it will go to the next line.
smink
Doesn't work for me. One of my templates is pr for private. Other code completions popup before the private template.Basically I want a separation between code completion suggestions and my macro expansions... which NetBeans does beautifully (the tab completion is completely separate from the ctrl+space code suggestion).Ugh
I82Much