putCopyableUserData and undo/redo


I want to attach an object to a PSI element. Presumably I would use putCopyableUserData to do this. But getCopyableUserData returns null if the element is deleted and then restored via an undo action. Is there a better way to associate my objects with tree elements?

1 comment

There's no such built-in way. PSI elements come and go and shouldn't be relied upon. You could try to associate your data with some other thing, based e.g. on names or indices of your elements.


Please sign in to leave a comment.