【问题标题】:how to better use of eclipse code templates (PHP)?如何更好地使用eclipse代码模板(PHP)?
【发布时间】:2011-02-04 06:16:22
【问题描述】:

我遇到的一个特殊问题是在 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”,我知道使用 Code Assist 的唯一方法是键入:“getset”,然后点击我的代码辅助键(我将它设置为 Esc,但我认为默认值是 Ctrl+空间)。问题是,这实际上并没有让我选择 ${word_selection} 使用的单词。

如何输入我的模板名称、点击组合键并同时选择一个单词?

我还想知道人们设置了哪些类型的模板以及使用模板加快编程速度的任何其他技巧。

【问题讨论】:

  • 我遇到了同样的问题,我很沮丧 word_selection 什么也没做......它只是被替换了......你找到解决方案了吗?
  • 我开始使用 phpStorm... :p

标签: eclipse eclipse-pdt eclipse-templates


【解决方案1】:

看这个链接:http://2tbsp.com/node/104 它描述了两件事:pdt 代码模板和代码 sn-ps。

如何输入我的模板名称、点击组合键并同时选择一个单词?

我认为这不能用代码模板来实现,而是用代码 sn-ps。就我个人而言,我根本不使用它们,但我可能会开始 :-)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-06-17
    • 2011-07-21
    • 2011-04-08
    • 2014-10-16
    • 1970-01-01
    • 2016-11-23
    • 1970-01-01
    • 2016-10-26
    相关资源
    最近更新 更多