I created PersistentStateComponent which looks like this
@State(name = "MyState", storages = [Storage("my_state.xml")])
class MyStatePersistence : PersistentStateComponent<MyState> {
...
}
and I registered it in plugin.xml:
<extensions defaultExtensionNs="com.intellij">
<applicationService serviceImplementation="com.example.MyStatePersistence"/>
</extensions>
I can't figure out where is file my_state.xml, which I specified. Is it located in project or what?
There are two kind of services, and both store their data in different locations.
A project service stores its xml file in the .idea directory that you find inside the root of the IDE project (or possible module when working with IntelliJ).
An application service stores its xml file in the options directory, which is located in the configuration directory.
In the sandbox IDE, this is build/idea-sandbox/config/options.
To summarize, on Linux, you can find the my_state.xml in ~/.config/JetBrains/IntelliJIdea2022.2/options (for the latest IntelliJ version).
For similar situations in the future (on Linux) you could find the file by running find . -name "my_state.xml" in your home directory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With