Old values in .iml file overwrite changes made by plugin

Answered

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?

0
3 comments

Hi,

It's hard to help without more details. What is your StartupActivity implementation. Why is it DumbAware? How is it registered in plugin.xml? Does it have order attribute defined to last? Can you use com.intellij.openapi.startup.ProjectActivity as StartupActivity is obsolete?

0

Why is it DumbAware?

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.

Does it have order attribute defined to last?

What does the order attribute do?

Can you use com.intellij.openapi.startup.ProjectActivity as StartupActivity is obsolete?

I will try this and see if the issue still happens.

Thanks.

0

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.

0

Please sign in to leave a comment.