IDEA-348081 2024.1 keeps deleting project settings in .idea folder if these settings are using the default value

GitOrigin-RevId: 36c6860f35c00b8a7e3dcdfb5bcc2e0232748f51
This commit is contained in:
Sergey Pak
2024-03-25 00:25:49 +00:00
committed by intellij-monorepo-bot
parent a9e1406257
commit 53349a42ec
4 changed files with 11 additions and 2 deletions
@@ -36,6 +36,9 @@ open class ApplicationStoreImpl(private val app: Application) : ComponentStoreWi
override val storageManager: StateStorageManagerImpl =
ApplicationStateStorageManager(pathMacroManager = PathMacroManager.getInstance(app), controller = app.getService(SettingsController::class.java))
override val allowSavingWithoutModifications: Boolean
get() = true
override val serviceContainer: ComponentManagerImpl
get() = app as ComponentManagerImpl
@@ -93,6 +93,9 @@ abstract class ComponentStoreImpl : IComponentStore {
open val loadPolicy: StateLoadPolicy
get() = StateLoadPolicy.LOAD
protected open val allowSavingWithoutModifications: Boolean
get() = false
abstract override val storageManager: StateStorageManager
private val featureUsageSettingManager by lazy {
@@ -298,7 +301,7 @@ abstract class ComponentStoreImpl : IComponentStore {
SAVE_MOD_LOG.debug(
"${if (isUseModificationCount) "Skip " else ""}$name: modificationCount $currentModificationCount equals to last saved")
}
if (isUseModificationCount && !isForce) {
if (isUseModificationCount && !(isForce && allowSavingWithoutModifications)) {
continue
}
}
@@ -19,6 +19,9 @@ internal class DefaultProjectStoreImpl(override val project: Project) : Componen
// see note about default state in project store
private val compoundStreamProvider = CompoundStreamProvider()
override val allowSavingWithoutModifications: Boolean
get() = true
override val loadPolicy: StateLoadPolicy
get() = if (ApplicationManager.getApplication().isUnitTestMode) StateLoadPolicy.NOT_LOAD else StateLoadPolicy.LOAD
@@ -58,7 +58,7 @@ private class MyProjectStore(project: Project) : ProjectWithModuleStoreImpl(proj
info = info,
componentName = componentName,
stateClass = stateClass,
useLoadedStateAsExisting = false,
useLoadedStateAsExisting = useLoadedStateAsExisting,
)
val configurationSchemaKey = info.configurationSchemaKey ?: return stateGetter
val configurationFileManager = ConfigurationFileManager.getInstance(project)