I'm reworking how I use stubs for indexing at the moment to try to make it more general, and I have a few questions about the stub element lifecycle.
- I'm assuming that when indexStub is called the whole stub tree has been built, so I can navigate within that tree to use information from other stubs, is that correct?
- Similarly, is createStub always called with a PSI element from a fully parsed file, i.e. a whole PSI tree?
- Is shouldCreateStub always called with a full PSI tree available via node.getPsi()?
- I understand why the createStub method is required, but why is createPsi required? My understanding was that the PSI tree would always be built by parsing the whole file, and often the stubs do not contain enough information to create a complete PsiElement. When is this used?
- Poking around in the code I've seen a bunch of references to a LighterAST and LightStub. What are these used for?
Thanks for any help!
Edited one of the questions after thinking about this.