diff --git a/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/ProjectCodeStyleImporter.kt b/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/ProjectCodeStyleImporter.kt index a4c15a69538..846665cb06d 100644 --- a/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/ProjectCodeStyleImporter.kt +++ b/idea/formatter/src/org/jetbrains/kotlin/idea/formatter/ProjectCodeStyleImporter.kt @@ -1,10 +1,11 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package org.jetbrains.kotlin.idea.formatter +import com.intellij.application.options.CodeStyle import com.intellij.openapi.project.Project import com.intellij.psi.codeStyle.CodeStyleSettings import com.intellij.psi.codeStyle.CodeStyleSettingsManager @@ -27,14 +28,14 @@ object ProjectCodeStyleImporter { fun apply(project: Project, predefinedCodeStyle: KotlinPredefinedCodeStyle) { val settingsManager = CodeStyleSettingsManager.getInstance(project) - val currentSettings = settingsManager.currentSettings - if (predefinedCodeStyle.codeStyleId == currentSettings.kotlinCodeStyleDefaults()) { + val customSettings = CodeStyle.getSettings(project) + if (predefinedCodeStyle.codeStyleId == customSettings.kotlinCodeStyleDefaults()) { // Don't bother user that already have correct code style return } val projectSettingsUpdated: CodeStyleSettings = if (settingsManager.USE_PER_PROJECT_SETTINGS) { - settingsManager.currentSettings.clone() + customSettings.clone() } else { CodeStyleSettings() }