在 Eclipse 中放置任务标签的键盘快捷键

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14129400/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 19:43:48  来源:igfitidea点击:

Keyboard shortcut to place tasktags in Eclipse

eclipsetagskeyboardtask

提问by Ajay

Is there any keyboard shortcut for placing task tags in eclipse like the TODO / FIXME / XXX ( user-defined)

是否有任何键盘快捷键可以在 Eclipse 中放置任务标签,例如 TODO / FIXME / XXX(用户定义)

Have searched on Google and was not able to find a shortcut.

在 Google 上搜索过,但找不到快捷方式。

回答by vitfo

I did not find any TODO shortcut but a possible solution is to create a template so when you write some string and hit Ctrl + spacebar and Enter your TODO code will be entered.

我没有找到任何 TODO 快捷方式,但一个可能的解决方案是创建一个模板,这样当您编写一些字符串并按 Ctrl + 空格键并输入您的 TODO 代码时,将被输入。

Window -> Preferences -> Java -> Editor -> Templates -> New

窗口 -> 首选项 -> Java -> 编辑器 -> 模板 -> 新建

  • Set the Name of the template (e.g. todo)
  • Set the Pattern (e.g. //TODO)
  • 设置模板的名称(例如 todo)
  • 设置模式(例如//TODO)

When you type todo and press Ctrl + spacebar and Enter // TODOwill be inserted

当您输入 todo 并按 Ctrl + 空格键时,// TODO将插入Enter

Such a trivial todo is useless but you can tweak it by using variables as shown in the picture. Use "Insert Variable" button to insert variables.

如此琐碎的待办事项是无用的,但您可以通过使用变量来调整它,如图所示。使用“插入变量”按钮插入变量。

enter image description here

在此处输入图片说明

When you use the pattern shown in the picture following will be inserted:

当您使用如下图所示的模式时,将插入:

// TODO inserted by UserName [21. 1. 2015, 13:07:07]

// TODO inserted by UserName [21. 1. 2015, 13:07:07]



More about Java Editor Template Variables can be found here

可以在此处找到有关 Java 编辑器模板变量的更多信息