I'm developing a custom language plugin (Ceylon language). A new PsiFile instance is created (ie. ParserDefinition#createFile gets called) each time the file is edited. Is this normal? I'd expect same PsiFile to remain the same, since it says here http://confluence.jetbrains.com/display/IDEADEV/IntelliJ+IDEA+Architectural+Overview#IntelliJIDEAArchitecturalOverview-PsiFiles :
Unlike VirtualFile and Document, which have application scope (even if multiple projects are open, each file is represented by the same VirtualFile instance), PSI has project scope (the same file is represented by multiple PsiFile instances if the file belongs to multiple projects open at the same time).
The reason this is problematic for me is that I'm using an Annotator that tries to access some data that I store in my implementation of the PsiFile, and the Annotator always gets the same PsiFile instance, while there are new instances created when editing and the one Annotator gets is thus stale.
If it's normal that createFile is called after each edit, why does the Annotator then get the old instance? If it's not normal, what might I be doing wrong to cause this?
Thanks for any help!