开发者

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

What is the Eclipse equivalent of IntelliJ "Live 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜