PersistantStateComponent storage inside project root

Answered

Is it possible to, instead of saving the .xml related to the PersistantStateComponent on the plugin options folder, save it under the project root that is using the plugin? If not, is there another simple way to achieve this?

0
12 comments

There are two types of state - application- and project-level. The second one is stored in the project scope. Please read more in the docs: Persisting State of Components

0
Avatar
Permanently deleted user

Thank you. I did read it before coming here but I didn't really understand it. So PersistentStateComponent is for app level and PropertiesComponent for project level?

0
Avatar
Permanently deleted user

Yes, thats how I've implemented it in the first place:

But, like this, it is stored in the options folder shared between all plugins. I couldn't figure out how to make it project dependent (a different file for each project, stored below its root)

0

Can you please just check

@Storage(StoragePathMacros.WORKSPACE_FILE)

 

0
Avatar
Permanently deleted user

Jakub Chrzanowski when I do that, I get the following error:

Caused by: com.intellij.configurationStore.UnknownMacroException: Unknown macro: $WORKSPACE_FILE$ in storage file spec: $WORKSPACE_FILE$

 

0

Sorry for the late reply. Can you please provide some minimal reproducible project that I may verify locally?

0
Avatar
Permanently deleted user

How can I send it directly to you?

0

Just create some GitHub repository and add me to it directly: hsz

0
Avatar
Permanently deleted user

Jakub Chrzanowski i've already added you

0

I tried to run it locally, but there is plantuml library missing in the Gradle dependencies.

0
Avatar
Permanently deleted user

Probably had an old build.gradle file on the repo. Please try it again Jakub Chrzanowski

 

Thanks in advance for your time.

0

Please sign in to leave a comment.