Index php file from jar (indexedRootsProvider)


I'm trying to add files from my plugin .jar to php project so that references to classes definitions that are in my .jar could be resolved in phpstorm project.

I would like to do the same as in



Here is my code (copied and modified from PhpIndexedRootProvider):

public class TestIndexableSetContributor extends IndexableSetContributor {
public Set<VirtualFile> getAdditionalRootsToIndex() {
return collectFiles();

public Set<VirtualFile> getAdditionalProjectRootsToIndex(@NotNull Project project) {
return getAdditionalRootsToIndex();

private static Set<VirtualFile> collectFiles() {
THashSet files = new THashSet();
URL resource = TestIndexableSetContributor.class.getResource("phpfile.php");

assert resource != null;

VirtualFile sibling = VfsUtil.findFileByURL(resource);

assert sibling != null;

return files;

registered as follows

<indexedRootsProvider implementation="com.bronek.phpinspections.TestIndexableSetContributor" />

phpfile.php is in the same directory as TestIndexableSetContributor


Unfortunately this is not working.

I've debugging this for hours trying different approaches and still no effects - classes in phpstorm are not visible, files are not searchable, classes doesnt appear in PhpIndex.  


Could someone give me a hint what should I do additionally to make that works? :) List of steps or what classes/extensions register would be enough.



Bronisław Białek

Please sign in to leave a comment.