package io.j99.idea.vue.settings;

import com.intellij.openapi.components.*;
import com.intellij.openapi.project.Project;
import com.intellij.util.xmlb.XmlSerializerUtil;
import org.jetbrains.annotations.Nullable;

@State(name = "VueProjectSettingsComponent",
        storages = {
                @Storage(id = "default", file = StoragePathMacros.PROJECT_FILE),
                @Storage(id = "dir", file = StoragePathMacros.PROJECT_CONFIG_DIR + "/vue_for_idea.xml", scheme = StorageScheme.DIRECTORY_BASED)
        })
public class SettingStorage implements PersistentStateComponent<SettingStorage> {
    public String builtinRulesPath = "";
    public String vueExePath = "";
    public String nodeInterpreter="";
    public boolean treatAllIssuesAsWarnings;


    public static SettingStorage getInstance() {
        SettingStorage settingStorage = ServiceManager.getService(SettingStorage.class);
        return settingStorage;
    }

    @Nullable
    @Override
    public SettingStorage getState() {
        return this;
    }

    @Override
    public void loadState(SettingStorage state) {
        XmlSerializerUtil.copyBean(state, this);
    }

    public String getVersion() {
        return nodeInterpreter + vueExePath + builtinRulesPath;
    }
}

@@ -230,152 +230,29 @@
 %22Vue
-ProjectSettingsComponent%22,%0A        storages = %7B%0A                @Storage(id = %22default%22, file = StoragePathMacros.PROJECT_FILE),%0A               
+%22,%0A        storages =
  @St
@@ -298,26 +298,18 @@
 ros.
-PROJECT
+APP
 _CONFIG
-_DIR
  + %22
@@ -330,59 +330,9 @@
 xml%22
-, scheme = StorageScheme.DIRECTORY_BASED)%0A        %7D
+)
 )%0Apu

update setting storage