Php Type Providers

I'm trying to create completions (and references) for a PHP library that relies heavily on magic methods (__call()) to achieve its API.

A typical call from within ClassC would look like this:

$this->someMethodFromClassA()->someMethodFromClassB();

Using a type provider I've managed to get the methods from ClassA to appear when typing $this-> (and the references work also, as expected).

The problem I'm facing is this: ClassA exists within the PHP codebase, but ClassB is effectively a "stub" class with a series of methods on it that lives inside my plugin.

I figured this would work out since the PHP standard library exists within the JetBrains PHP plugin as a series of stub PHP files.

However, this approach works fine if ClassB exists within the PHP project, but I can't get it to work if the PHP class exists within my plugin.

Using PhpPsiElementFactory.createPsiFileFromText() after reading the PHP file from the JAR, I'm creating a PSI file and then getting the PSI class from that - in the debugger I can see that it's a proper instance of the class with all the correct methods etc, however, when I add this to the list of classes in my type provider's getBySignature() method, it doesn't appear in the completion list and references don't work.

Is this a limitation of the Type Providers as they currently stand? Am I approaching this in the wrong way? Can you suggest how I might resolve this issue?

Many thanks,

3 comments
Comment actions Permalink

Please file this all as an issue at http://youtrack.jetbrains.net/issues/WI#newissue=yes and we'll continue there.
You'll need to create IndexableSetContributor and we'll need to provide you with an extension point to extend our default Scope.

0
Comment actions Permalink

Thanks, that's helpful - have added new issue in YT as requested.

Thanks,

0

Please sign in to leave a comment.