Dynamic plugin & lost settings



I have following setup in my plugin - there are 3 configurations (PersistentStateComponent with Kotlin data classes as state):

  1. application level - annotated with @State(name = "GitToolBoxAppSettings2", storages = [Storage("git_toolbox_2.xml")])
  2. project level 1 - @State(name = "GitToolBoxProjectSettings", storages = [Storage("git_toolbox_prj.xml")])
  3. project level 2 - @State(name = "GitToolBoxStore", storages = [Storage(StoragePathMacros.WORKSPACE_FILE)])

When I modify the plugin to be dynamic I'm faced with following issue:

  1. plugin is enabled and config is modified - storage files are created and contain the changes
  2. plugin is disabled
  3. plugin is re-enabled - storage files disappear, config is lost

What I noticed is that after plugin is re-enabled PersistentStateComponent.noStateLoaded get's called on application level and project level 1. This does not happen on project level 2 (workspace one).

Issue is not always reproducable for application level but is 100% reproducable on project level 1.

This issue also does not occur when plugin is marked as not dynamic.


Lukasz Z.

Comment actions Permalink

This sounds like a bug. Could you please file a bug https://youtrack.jetbrains.com/issues/IDEA with exact IDE version and ideally link to your plugin's sources? Thanks.


Please sign in to leave a comment.