diff --git a/.idea/misc.xml b/.idea/misc.xml
index 8f4e3ebc3de..b6513e71f2e 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -52,7 +52,13 @@
-
+
diff --git a/idea/src/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinInProjectUtils.kt b/idea/src/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinInProjectUtils.kt
index 55499786449..a97fc0f3991 100644
--- a/idea/src/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinInProjectUtils.kt
+++ b/idea/src/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinInProjectUtils.kt
@@ -37,6 +37,7 @@ import org.jetbrains.kotlin.idea.configuration.ui.notifications.ConfigureKotlinN
import org.jetbrains.kotlin.idea.framework.JSLibraryKind
import org.jetbrains.kotlin.idea.util.application.runReadAction
import org.jetbrains.kotlin.idea.util.projectStructure.allModules
+import org.jetbrains.kotlin.idea.versions.SuppressNotificationState
import org.jetbrains.kotlin.idea.versions.getKotlinJvmRuntimeMarkerClass
import org.jetbrains.kotlin.idea.versions.hasKotlinJsKjsmFile
import org.jetbrains.kotlin.idea.vfilefinder.IDEVirtualFileFinder
@@ -132,7 +133,7 @@ fun getConfigurableModulesWithKotlinFiles(project: Project): List = emptyList()) {
val notificationString = DumbService.getInstance(project).runReadActionInSmartMode(Computable {
val modules = getConfigurableModulesWithKotlinFiles(project).exclude(excludeModules)
- if (modules.all(::isModuleConfigured))
+ if (modules.all(::isNotConfiguredNotificationRequired))
null
else
ConfigureKotlinNotification.getNotificationString(project, excludeModules)
@@ -153,6 +154,10 @@ fun showConfigureKotlinNotificationIfNeeded(project: Project, excludeModules: Li
}
}
+fun isNotConfiguredNotificationRequired(moduleGroup: ModuleSourceRootGroup): Boolean {
+ return !SuppressNotificationState.isKotlinNotConfiguredSuppressed(moduleGroup) && isModuleConfigured(moduleGroup)
+}
+
fun getAbleToRunConfigurators(project: Project): Collection {
val modules = getConfigurableModules(project)
diff --git a/idea/src/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinNotificationManager.kt b/idea/src/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinNotificationManager.kt
index e0ad5899781..8dbc8488851 100644
--- a/idea/src/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinNotificationManager.kt
+++ b/idea/src/org/jetbrains/kotlin/idea/configuration/ConfigureKotlinNotificationManager.kt
@@ -76,7 +76,7 @@ fun checkHideNonConfiguredNotifications(project: Project) {
if (!checkInProgress.compareAndSet(false, true)) return@executeOnPooledThread
DumbService.getInstance(project).waitForSmartMode()
- if (getConfigurableModulesWithKotlinFiles(project).all(::isModuleConfigured)) {
+ if (getConfigurableModulesWithKotlinFiles(project).all(::isNotConfiguredNotificationRequired)) {
ApplicationManager.getApplication().invokeLater {
ConfigureKotlinNotificationManager.expireOldNotifications(project)
checkInProgress.set(false)
diff --git a/idea/src/org/jetbrains/kotlin/idea/configuration/KotlinSetupEnvironmentNotificationProvider.kt b/idea/src/org/jetbrains/kotlin/idea/configuration/KotlinSetupEnvironmentNotificationProvider.kt
index 339707a0bca..e4d5b85f001 100644
--- a/idea/src/org/jetbrains/kotlin/idea/configuration/KotlinSetupEnvironmentNotificationProvider.kt
+++ b/idea/src/org/jetbrains/kotlin/idea/configuration/KotlinSetupEnvironmentNotificationProvider.kt
@@ -41,6 +41,7 @@ import org.jetbrains.kotlin.idea.KotlinFileType
import org.jetbrains.kotlin.idea.KotlinLanguage
import org.jetbrains.kotlin.idea.configuration.ui.KotlinConfigurationCheckerComponent
import org.jetbrains.kotlin.idea.util.application.runWriteAction
+import org.jetbrains.kotlin.idea.versions.SuppressNotificationState
import org.jetbrains.kotlin.idea.versions.UnsupportedAbiVersionNotificationPanelProvider
import org.jetbrains.kotlin.idea.versions.createComponentActionLabel
@@ -79,8 +80,10 @@ class KotlinSetupEnvironmentNotificationProvider(
}
if (!KotlinConfigurationCheckerComponent.getInstance(module.project).isSyncing &&
+ !SuppressNotificationState.isKotlinNotConfiguredSuppressed(module.toModuleGroup()) &&
!hasAnyKotlinRuntimeInScope(module) &&
- UnsupportedAbiVersionNotificationPanelProvider.collectBadRoots(module).isEmpty()) {
+ UnsupportedAbiVersionNotificationPanelProvider.collectBadRoots(module).isEmpty()
+ ) {
return createKotlinNotConfiguredPanel(module)
}
@@ -121,6 +124,11 @@ class KotlinSetupEnvironmentNotificationProvider(
configuratorsPopup.showUnderneathOf(label)
}
}
+
+ createComponentActionLabel("Ignore") {
+ SuppressNotificationState.suppressKotlinNotConfigured(module)
+ EditorNotifications.getInstance(module.project).updateAllNotifications()
+ }
}
}
}
diff --git a/idea/src/org/jetbrains/kotlin/idea/versions/SuppressNotificationState.kt b/idea/src/org/jetbrains/kotlin/idea/versions/SuppressNotificationState.kt
index 1fa44c5b1d1..890c1595daf 100644
--- a/idea/src/org/jetbrains/kotlin/idea/versions/SuppressNotificationState.kt
+++ b/idea/src/org/jetbrains/kotlin/idea/versions/SuppressNotificationState.kt
@@ -16,19 +16,34 @@
package org.jetbrains.kotlin.idea.versions
-import com.intellij.openapi.components.PersistentStateComponent
-import com.intellij.openapi.components.State
-import com.intellij.openapi.components.Storage
-import com.intellij.openapi.components.StoragePathMacros
+import com.intellij.openapi.components.*
+import com.intellij.openapi.module.Module
+import com.intellij.openapi.project.Project
import com.intellij.util.xmlb.XmlSerializerUtil
+import org.jetbrains.kotlin.idea.configuration.ModuleSourceRootGroup
+import org.jetbrains.kotlin.idea.configuration.toModuleGroup
@State(name = "SuppressABINotification", storages = arrayOf(Storage(file = StoragePathMacros.PROJECT_FILE)))
class SuppressNotificationState : PersistentStateComponent {
var isSuppressed: Boolean = false
+ var modulesWithSuppressedNotConfigured = sortedSetOf()
override fun getState(): SuppressNotificationState = this
override fun loadState(state: SuppressNotificationState) {
XmlSerializerUtil.copyBean(state, this)
}
+
+ companion object {
+ fun getInstance(project: Project) = ServiceManager.getService(project, SuppressNotificationState::class.java)
+
+ fun isKotlinNotConfiguredSuppressed(moduleGroup: ModuleSourceRootGroup): Boolean {
+ val baseModule = moduleGroup.baseModule
+ return baseModule.name in getInstance(baseModule.project).modulesWithSuppressedNotConfigured
+ }
+
+ fun suppressKotlinNotConfigured(module: Module) {
+ getInstance(module.project).modulesWithSuppressedNotConfigured.add(module.toModuleGroup().baseModule.name)
+ }
+ }
}