Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse | code template for System.out.println()

Tags:

java

eclipse

I have got the following as the code template for System.out.println in Eclipse

System.out.println(${word_selection}${});${cursor}

I was under the impression that I could write a text, select it, enter ctrl+space, and then write sop - and Eclipse will write the proper line for me. But this is not happening. Can anyone help me understand the way ${word_selection} is supposed to work?

like image 294
Tech for good Avatar asked Nov 01 '22 03:11

Tech for good


1 Answers

You need to select the text and press ctrl+space twice. The first time you do it, "default proposals" are shown. The next time the applicable code templates are shown. Unfortunately you cannot type the name of the template since that will overwrite the selected text, but you can select it with arrow keys and press return.

It will look like this after the second ctrl+space on an Eclipse with default templates:

sysout template

like image 119
K Erlandsson Avatar answered Nov 12 '22 11:11

K Erlandsson