What is the Eclipse equivalent of IntelliJ "Live templates"?
I mean stuff like typing "iter" and getting a开发者_开发知识库 "for" loop with a choice of what variable to iterate on , typing "soutv" to generate a "System.out.println" with the "variable=" already in ...
Thanks !
It is called Templates and it's found under,
Window → Preferences → Java → Editor → Templates
The "soutv" template does not exist ("sysout" does, and it's similar), but it's easy to add. I used this pattern:
System.out.println("variable=" + ${cursor}${});
For 'soutv' particularly, I found the following pattern worked well in Eclipse:
System.out.println("${var} = ${cursor}" + ${var});
As others have mentioned, you can add this template by navigating to Window > Preferences > Java > Editor > Templates and clicking New.
The equivalent of 'iter' seems to be 'for' in Eclipse.
Check under
Window -> Preferences -> Java -> Editor -> Templates
Reference:
- Template Variables
They are called Templates.
Go to Preferences > Java > Editor > Templates
to see a list of pre-defined templates.
For example, sysout
is:
System.out.println(${word_selection}${});${cursor}
You can also create your own.
精彩评论