How can you get eclipse code complete for CI when using &get_instance()?

时间:2023-01-14 11:00:15

I'm currently using Eclipse PDT and CodeIgniter, is it possible to get code-completion for the sessions library like so:

我目前正在使用Eclipse PDT和CodeIgniter,是否可以像这样获得会话库的代码完成:

$CI = &get_instance();
$CI->session->se   (No auto-completion here.)

Also, is there some sort of plug-in (or just a method) that would allow eclipse to do this for all my CodeIgniter libraries.

此外,是否有某种插件(或只是一种方法)允许eclipse为我的所有CodeIgniter库执行此操作。

Note: I already have support in most contexts courtesy of this tutorial, however I am looking specifically for when I am using a variable to reference CodeIgniter instead of

注意:我已经在本教程的大多数情况下得到了支持,但是我正在寻找专门用于何时使用变量来引用CodeIgniter而不是

$this->

Thanks,

谢谢,

Lemiant

Lemiant

1 个解决方案

#1


2  

Since there seems to be a reasonable amount of interest in this; I thought I'd share my solution to this problem. Using the method from this tutorial I mentioned above, you can use PHPDoc to tell the compiler that a variable is a reference to some object in your project. In this case I want $CI to reference the CI_Base object. so I declare my variable like this:

由于似乎对此有合理的兴趣;我以为我会分享我对这个问题的解决方案。使用上面提到的本教程中的方法,您可以使用PHPDoc告诉编译器变量是对项目中某个对象的引用。在这种情况下,我希望$ CI引用CI_Base对象。所以我声明我的变量是这样的:

/**
 * @var CI_Base
 */
private $CI;

and voila, I have code complete (NOTE: you have to use the tutorial above to get code complete from $this->CI-> to anything else.)

瞧,我有完整的代码(注意:你必须使用上面的教程才能从$ this-> CI->到其他任何东西完成代码。)

Hope this helps somebody,

希望这有助于某人,

Lemiant

Lemiant

#1


2  

Since there seems to be a reasonable amount of interest in this; I thought I'd share my solution to this problem. Using the method from this tutorial I mentioned above, you can use PHPDoc to tell the compiler that a variable is a reference to some object in your project. In this case I want $CI to reference the CI_Base object. so I declare my variable like this:

由于似乎对此有合理的兴趣;我以为我会分享我对这个问题的解决方案。使用上面提到的本教程中的方法,您可以使用PHPDoc告诉编译器变量是对项目中某个对象的引用。在这种情况下,我希望$ CI引用CI_Base对象。所以我声明我的变量是这样的:

/**
 * @var CI_Base
 */
private $CI;

and voila, I have code complete (NOTE: you have to use the tutorial above to get code complete from $this->CI-> to anything else.)

瞧,我有完整的代码(注意:你必须使用上面的教程才能从$ this-> CI->到其他任何东西完成代码。)

Hope this helps somebody,

希望这有助于某人,

Lemiant

Lemiant