Old values in .iml file overwrite changes made by plugin
I have a plugin that is supposed to configure projects using an implementation of StartupActivity.DumbAware
. But sometimes, the changes made by the plugin are overwritten by older values in .iml file of the project. For example, the plugin is supposed to mark the src
directory as source root on loading the project. Now if the directory is already marked as a source root and I unmark it, ideally the plugin should mark it as source root again after I close the project and open it again. But what happens is that the directory is marked as source root for a while (I can see it highlighted in blue) but it goes back to the previous state and is colored grey. I am guessing the older values in the .iml file overwrite the changes made by the plugin.
Am I missing something here?
Please sign in to leave a comment.
Hi,
It's hard to help without more details. What is your
StartupActivity
implementation. Why is itDumbAware
? How is it registered in plugin.xml? Does it haveorder
attribute defined tolast
? Can you usecom.intellij.openapi.startup.ProjectActivity
asStartupActivity
is obsolete?The startup activity is dumbaware because we are also marking some files as excluded and we need to do it before indexing so that those files are not indexed. This is necessary to reduce indexing time.
What does the order attribute do?
I will try this and see if the issue still happens.
Thanks.
The
order
attribute allows sorting extensions when they are processed by the platform code. See https://plugins.jetbrains.com/docs/intellij/plugin-extensions.html#extension-default-properties. Maybe in your case, there is another activity that overwrites your changes.