StubIndex not Indexing injected PsiFile


I have created a plugin which contains a custom language (odt) which can exist in .odt files or it can be injected at specific locations in another language (omt). OMT is a YAML flavor that implements the MetaTypeProvider of the YAML plugin to inject the odt language at certain positions. This means that for OMT I'm not controlling a lot, mainly using the existing YAML API. 

To improve performance I managed to create stubs using the Indexing framework that creates stubs for certain ODT element types. This all works fine if the code is part of an odt file, but the StubIndex is not extended with ODT stubs/elements that are contained in OMT/YAML files. 

I couldn't find any example where this is succesfully implemented, is there anything I need to do to the OMT file to make it 'trigger' the StubIndex process for the injected fragments?

The issue is quite serious for me since 99% of the project code actually exists in injected fragments.

The entire codebase is available at: (make sure to use the stubbing branch)

1 comment

Stubs/indexing does not process injected content. To provide multiple PSI trees per file, com.intellij.psi.MultiplePsiFilesPerDocumentFileViewProvider can be used.


Please sign in to leave a comment.