Questions on stubs

currently I'm looking at the stub functionality used by custom language plugins.
I do have some questions, some help is really appreciated here.

1. What are stubs used for?
I think they are used to store a parser result (psi) to disk and can be used in indexes, too. Is this correct?

2. Do I need to create a stub element for each available PSI element?
Would be quite a lot of work... I digged through the Scala plugin source but couldn't find a clear answer to this.

3. How are stub elements stored? Do I need to implement custom serialization or is there an automatic way which saves/restored stub elements to/from disk?

4. I want to quickly look up a method name to find all classes where the method is available - do I need just stubs, do I need an index or both?

5. Is there a small plugin available which uses stubs?

I couldn't find detailed information on stubs so I'd appreciate some help

Kind regards,

Please sign in to leave a comment.