diff --git a/platform/configuration-store-impl/src/ComponentStoreImpl.kt b/platform/configuration-store-impl/src/ComponentStoreImpl.kt index 041ff0cb9059..80f9ce7759d5 100644 --- a/platform/configuration-store-impl/src/ComponentStoreImpl.kt +++ b/platform/configuration-store-impl/src/ComponentStoreImpl.kt @@ -818,11 +818,11 @@ abstract class ComponentStoreImpl : IComponentStore { val componentNames = HashSet() for (storage in changedStorages) { - LOG.runAndLogException { + runCatching { // we must update (reload in-memory storage data) even if a non-reloadable component is detected later // not saved -> user does a modification -> new (on disk) state will be overwritten and not applied storage.analyzeExternalChangesAndUpdateIfNeeded(componentNames) - } + }.getOrLogException(LOG) } if (componentNames.isEmpty()) { diff --git a/platform/configuration-store-impl/src/DefaultProjectStoreImpl.kt b/platform/configuration-store-impl/src/DefaultProjectStoreImpl.kt index 1d455f272b5d..f6e26635b2ff 100644 --- a/platform/configuration-store-impl/src/DefaultProjectStoreImpl.kt +++ b/platform/configuration-store-impl/src/DefaultProjectStoreImpl.kt @@ -30,7 +30,7 @@ internal class DefaultProjectStoreImpl(override val project: Project) : Componen private val storage by lazy { val file = ApplicationManager.getApplication().stateStore.storageManager.expandMacro(PROJECT_DEFAULT_FILE_SPEC) - DefaultProjectStorage(file, PROJECT_DEFAULT_FILE_SPEC, PathMacroManager.getInstance(project), compoundStreamProvider) + DefaultProjectStorage(file = file, fileSpec = PROJECT_DEFAULT_FILE_SPEC, pathMacroManager = PathMacroManager.getInstance(project), streamProvider = compoundStreamProvider) } override val serviceContainer: ComponentManagerEx diff --git a/platform/configuration-store-impl/src/DirectoryBasedStorage.kt b/platform/configuration-store-impl/src/DirectoryBasedStorage.kt index cf730236801d..8f583ecd7341 100644 --- a/platform/configuration-store-impl/src/DirectoryBasedStorage.kt +++ b/platform/configuration-store-impl/src/DirectoryBasedStorage.kt @@ -44,7 +44,7 @@ open class DirectoryBasedStorage( private fun getLineSeparator(name: String): LineSeparator = nameToLineSeparatorMap.get(name) ?: LineSeparator.getSystemLineSeparator() - override fun analyzeExternalChangesAndUpdateIfNeeded(componentNames: MutableSet) { + override suspend fun analyzeExternalChangesAndUpdateIfNeeded(componentNames: MutableSet) { // todo reload only changed file, compute diff val newData = loadData() storageDataRef.set(newData) diff --git a/platform/configuration-store-impl/src/XmlElementStorage.kt b/platform/configuration-store-impl/src/XmlElementStorage.kt index 711f863fcb83..7dd5c2d84b9c 100644 --- a/platform/configuration-store-impl/src/XmlElementStorage.kt +++ b/platform/configuration-store-impl/src/XmlElementStorage.kt @@ -134,7 +134,7 @@ abstract class XmlElementStorage protected constructor( protected abstract fun createSaveSession(states: StateMap): SaveSessionProducer - final override fun analyzeExternalChangesAndUpdateIfNeeded(componentNames: MutableSet) { + final override suspend fun analyzeExternalChangesAndUpdateIfNeeded(componentNames: MutableSet) { LOG.debug("Running analyzeExternalChangesAndUpdateIfNeeded") val oldData = storageDataRef.get() val newData = getStorageData(reload = true) diff --git a/platform/projectModel-api/src/com/intellij/openapi/components/StateStorage.kt b/platform/projectModel-api/src/com/intellij/openapi/components/StateStorage.kt index 1e895d76a14e..8a5299d2aec0 100644 --- a/platform/projectModel-api/src/com/intellij/openapi/components/StateStorage.kt +++ b/platform/projectModel-api/src/com/intellij/openapi/components/StateStorage.kt @@ -29,7 +29,7 @@ interface StateStorage { /** * Get changed component names */ - fun analyzeExternalChangesAndUpdateIfNeeded(componentNames: MutableSet) + suspend fun analyzeExternalChangesAndUpdateIfNeeded(componentNames: MutableSet) fun getResolution( component: PersistentStateComponent<*>, diff --git a/platform/projectModel-impl/src/com/intellij/configurationStore/NonPersistentStore.kt b/platform/projectModel-impl/src/com/intellij/configurationStore/NonPersistentStore.kt index 9e2a883d3751..72cc22906389 100644 --- a/platform/projectModel-impl/src/com/intellij/configurationStore/NonPersistentStore.kt +++ b/platform/projectModel-impl/src/com/intellij/configurationStore/NonPersistentStore.kt @@ -74,5 +74,5 @@ private object NonPersistentStateStorage : StateStorage { override fun createSaveSessionProducer(): SaveSessionProducer? = null - override fun analyzeExternalChangesAndUpdateIfNeeded(componentNames: MutableSet) {} + override suspend fun analyzeExternalChangesAndUpdateIfNeeded(componentNames: MutableSet) {} } \ No newline at end of file diff --git a/platform/settings-local/src/com/intellij/platform/settings/local/StateStorageBackedByController.kt b/platform/settings-local/src/com/intellij/platform/settings/local/StateStorageBackedByController.kt index 9baab856f3e7..ead95d7aaea7 100644 --- a/platform/settings-local/src/com/intellij/platform/settings/local/StateStorageBackedByController.kt +++ b/platform/settings-local/src/com/intellij/platform/settings/local/StateStorageBackedByController.kt @@ -108,7 +108,7 @@ internal class StateStorageBackedByController( return ControllerBackedSaveSessionProducer(storageController = this) } - override fun analyzeExternalChangesAndUpdateIfNeeded(componentNames: MutableSet) { + override suspend fun analyzeExternalChangesAndUpdateIfNeeded(componentNames: MutableSet) { // external change is not expected and not supported } diff --git a/plugins/configuration-script/src/providers/ConfigurationScriptProjectStoreFactory.kt b/plugins/configuration-script/src/providers/ConfigurationScriptProjectStoreFactory.kt index b0fc52a7ec4d..8c0fc71b90eb 100644 --- a/plugins/configuration-script/src/providers/ConfigurationScriptProjectStoreFactory.kt +++ b/plugins/configuration-script/src/providers/ConfigurationScriptProjectStoreFactory.kt @@ -167,6 +167,6 @@ private class ReadOnlyStorage( override fun createSaveSessionProducer(): SaveSessionProducer? = null - override fun analyzeExternalChangesAndUpdateIfNeeded(componentNames: MutableSet) { + override suspend fun analyzeExternalChangesAndUpdateIfNeeded(componentNames: MutableSet) { } }