Serialize PsiElements with possibility to restore their positions in PsiTree
Hello!
I am developing a plugin for Intellij and looking for a way to serialize SmartPsiElementPointer instances.
I know that Intellij API offers a way to save plugin state in xml file with the help of http://www.jetbrains.org/intellij/sdk/docs/basics/persisting_state_of_components.html . But PersistentState can persist only a primitives and basic data structures and I need somehow save a SmartPsiElementPointer. I need this because my plugin builds some data structures based on commit history of project and because parsing whole history of commits may take a while I want to do this only once for project and save in order to just deserialize this data later.
Can I use custom serializer like Kryo, or is there something that is already in Idea API?
Thanks!
Please sign in to leave a comment.
There's no way to serialize smart pointers. It's not clear how that could work, because smart pointers are changed together with the code changes. In addition, I'd expect the commit history to be related to something in the history, mostly not present in the current code anymore. But smart pointers are only available for currently committed PSI, not for its history. Perhaps it would help if you describe your problem in more detail.
Hi Peter!
Well, it was my design mistake, therefore, I do not need to serialize psi element pointers anymore.
Thank you for answer!