Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where are PersistentStateComponent's state stored?

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?

like image 263
lishee loo Avatar asked Mar 28 '26 17:03

lishee loo


1 Answers

There are two kind of services, and both store their data in different locations.

  1. 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).

  2. 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.

like image 184
Abby Avatar answered Apr 02 '26 23:04

Abby