Tech for good
Tech for good

Reputation: 187

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

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?

Upvotes: 5

Views: 1624

Answers (1)

K Erlandsson
K Erlandsson

Reputation: 13696

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

Upvotes: 2

Related Questions