【问题标题】:How to get Zend Framework view helper code completion in Eclipse (Aptana Studio 3)?如何在 Eclipse(Aptana Studio 3)中获得 Zend Framework 视图帮助代码完成?
【发布时间】:2011-06-13 22:05:39
【问题描述】:

我正在使用 Aptana Studio 3(基于 Eclipse)来编辑我的 Zend Framework 应用程序。当我编辑视图脚本时,我希望我的 IDE 提供代码完成/自动完成。

<?php echo $this->form...

由于视图辅助函数并不完全是实例化的类,因此我没有开箱即用的这种功能。我该如何向 Eclipse 添加此类功能?

【问题讨论】:

    标签: eclipse zend-framework code-completion aptana


    【解决方案1】:

    你唯一能做的就是使用变量类型提示,例如

    <?php
    /* @var $form Zend_Form */
    $form = $this->form;
    

    然后您将获得 $form 属性和方法的代码完成。

    View helpers 大多可以被同等对待,例如

    <?php
    /* @var $headLinkHelper Zend_View_Helper_HeadLink */
    $headLinkHelper = $this->getHelper('HeadLink');
    

    【讨论】:

    • 恐怕此支持目前在 Aptana Studio 3 中已被破坏。正在尽快修复它。
    【解决方案2】:

    由于您使用的是 Aptana Studio,而不是 PDT,因此我将添加到我在上面发布的评论中(作为答案)。

    Aptana Studio 中的正确语法是:

    /**
     * @var Foobar 
     */ 
    $obj; // You have to call the variable here (redundant call...)
    $obj-> // will code assist the FooBar functions.
    

    那个多余的调用是一个交易破坏者(恕我直言),所以我正在努力获得额外的支持,比如@Phil 的回答中建议的 PDT 特殊 @var 语法)。

    /* @var $obj Foobar */
    $obj-> // will code assist the FooBar functions.
    

    无论如何,为了向后兼容,Studio 的下一个版本都将支持两者。

    希望有帮助

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-07-03
      • 2012-03-20
      • 2013-11-18
      • 1970-01-01
      • 1970-01-01
      • 2011-01-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多