eclipse Eclipse自动todo任务添加

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7500269/
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 17:01:25  来源:igfitidea点击:

Eclipse automatic todo task addition

eclipsetodo

提问by Emil

Is there a way in eclipse to automatically add TODO task eg:- //TODO: TO BE TESTEDto the top of the function or class so that i can easily keep track of the changes yet to be tested ?

在 Eclipse 中有没有办法自动添加 TODO 任务,例如:- //TODO: TO BE TESTED到函数或类的顶部,以便我可以轻松跟踪尚未测试的更改?

回答by Kai

Do you want to add the TODO when you generate the methods/classes? Then you could use code templates for that. Like // TODO Auto-generated method stubis added when you generate a method you could put any other comment on top of a method. Window-> Preferences-> Java-> Code Style-> Code Templates

您想在生成方法/类时添加 TODO 吗?然后你可以使用代码模板。// TODO Auto-generated method stub生成方法时添加Like ,您可以在方法之上放置任何其他注释。Window-> Preferences-> Java-> Code Style->Code Templates

Or do you want to add the TODO to all methods/classes which currently do exist? Thats a bit harder, you could write a plugin which does that for you: Eclipse JDT

还是要将 TODO 添加到当前存在的所有方法/类中?那有点难,你可以写一个插件来为你做这件事Eclipse JDT

If that TODO should always be created when you have modified a class or method you could also write an eclipse plugin which monitors the CompilationUnitin the editor. See recordModifications()here

如果在修改类或方法时应始终创建 TODO,您还可以编写一个 eclipse 插件来监视CompilationUnit编辑器中的 。看recordModifications()这里

回答by DwB

You can edit the code templates and include the TODO comment there. Code templates are located on the preferences dialog

您可以编辑代码模板并在其中包含 TODO 注释。代码模板位于首选项对话框中

Window > Preferences > Java > Code Style > Code Templates

窗口 > 首选项 > Java > 代码样式 > 代码模板

Unfortunately, this will only help for new methods and classes.

不幸的是,这只会对新方法和类有所帮助。