I decided to add stub tree/index support to my custom language plugin to speed up some operations. The best documentation I'm able to find for this is found here:
but the example links are mostly dead ends, and even where they take you to the sample project, it doesn't line up anymore, e.g., the sample stubElementTypeHolder doesn't seem to exist anymore.
My plugin uses a Grammar-Kit parser so I've also followed the directions from 3.5 here using the stubClass-based approach:
At this point I've implemented every step from both of these except for the stubElementTypeHolder because honestly I'm not sure how it fits in since, unlike most other extension points, that extension point doesn't comform to any interface to help guide implementation. Even without a stubElementTypeHolder, I can see my stub index being serialized in the debugger. However, I don't ever see it being deserialized once the index is built, and getStub() always returns null in my stub-based PsiElements.
Obviously I'm missing something here, but for the life of me I can't see what it might be. I've looked at other open source plugins that implement stub trees/indices and can't see what they're doing that I'm not. I imagine I'm REALLY close to having this working, but I just can't figure out that last piece of glue required to close the deal! Any guidance is GREATLY appreciated!
One more question on this...all of the documentation I've found seems to indicate that use of information from the stub and read-through to the parsed result happens automagically, but in reality it looks like you still have to implement this read-through yourself using the idiom:
if (getStub() != null)
That makes sense to me, but before I make things harder than they need to be, I wanted to verify that there's not some way to have both the stub element and the PSI element implement a common interface and have the runtime know whether it can get the information from the stub when available and read-through when not available.
Again, thanks much in advance for all insights and guidance here!