如何更好的使用eclipse代码模板(PHP)?
我遇到的一个特殊问题是在 Eclipse PDT 模板中使用 ${word_selection}。
我最近尝试在 Eclipse PDT 2.1 中使用一些代码模板来加速一些常见任务。我们使用了很多 getter/setter,所以我编写了以下模板。
function get${word_selection}() {
return $$this->getData('${word_selection}');
}
function set${word_selection}($$${word_selection}) {
$$this->setData('${word_selection}', $$${word_selection});
}
我将模板命名为“getset”,我知道使用代码辅助的唯一方法是键入:“getset”,然后按我的代码辅助键(我将其设置为 Esc,但我认为默认值是 Ctrl+Space)。问题是,这实际上并没有让我选择 ${word_selection} 使用的单词。
如何输入模板名称、按下组合键并同时选择一个单词?
我还想知道人们设置了哪些类型的模板以及使用模板来加快编程速度的任何其他技巧。
One particular problem I was having was using ${word_selection} in an Eclipse PDT template.
I was recently trying to use some code templates with Eclipse PDT 2.1 to speed up some common tasks. We use a lot of getters/setters, so I wrote the following template.
function get${word_selection}() {
return $this->getData('${word_selection}');
}
function set${word_selection}($${word_selection}) {
$this->setData('${word_selection}', $${word_selection});
}
I named the template "getset" and the only way I know to use the Code Assist is to type: "getset" then hit my code assist keys (I have it set to Esc, but I think the default was Ctrl+Space). The problem is, this doesn't actually let me select a word to be used by the ${word_selection}.
how do I type in my template name, hit the key combo, and have a word selected all at the same time?
I also want to know what kinds of templates people have set up and any other tips for using templates to speed of programming.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看这个链接:http://2tbsp.com/node/104
它描述了两件事:pdt 代码模板和代码片段。
我认为这不能通过代码模板来实现,而是通过代码片段来实现。就我个人而言,我根本不使用它们,但我可能会开始:-)
Look at this link : http://2tbsp.com/node/104
It describes two things : pdt code templates and code snippets.
I think this cannot be achieved with code templates, but with code snippets. Personnally I do not use them at all, but I might start :-)