putCopyableUserData and undo/redo

Answered

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
Comment actions Permalink

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.

0

Please sign in to leave a comment.