gradle.kts standalone scripts: show actions inside single notification
This commit is contained in:
+7
-6
@@ -175,14 +175,15 @@ class DefaultScriptingSupport(manager: CompositeScriptConfigurationManager) : De
|
||||
loaders.firstOrNull { it.loadDependencies(isFirstLoad, file, scriptDefinition, loadingContext) }
|
||||
} else {
|
||||
val autoReloadEnabled = KotlinScriptingSettings.getInstance(project).autoReloadConfigurations(scriptDefinition)
|
||||
val postponeLoading = !skipNotification && !autoReloadEnabled && async.any { it.isPostponedLoad(virtualFile) }
|
||||
val forceSkipNotification = skipNotification || autoReloadEnabled || postponeLoading
|
||||
val forceSkipNotification = skipNotification || autoReloadEnabled
|
||||
|
||||
if (postponeLoading) {
|
||||
LoadScriptConfigurationNotificationFactory.showNotification(virtualFile, project) {
|
||||
runAsyncLoaders(file, virtualFile, scriptDefinition, async, forceSkipNotification)
|
||||
val intercepted = !forceSkipNotification && async.any {
|
||||
it.interceptBackgroundLoading(virtualFile) {
|
||||
runAsyncLoaders(file, virtualFile, scriptDefinition, listOf(it), true)
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
if (!intercepted) {
|
||||
runAsyncLoaders(file, virtualFile, scriptDefinition, async, forceSkipNotification)
|
||||
}
|
||||
}
|
||||
|
||||
+2
-7
@@ -15,15 +15,10 @@ import org.jetbrains.kotlin.scripting.definitions.ScriptDefinition
|
||||
* @see [org.jetbrains.kotlin.idea.core.script.configuration.DefaultScriptConfigurationManager] for more details.
|
||||
*/
|
||||
interface ScriptConfigurationLoader {
|
||||
/**
|
||||
* Show notification before doing load
|
||||
*
|
||||
* (by default loading notification will be shown only after loading, to check that configuration is changed)
|
||||
*/
|
||||
fun isPostponedLoad(virtualFile: VirtualFile): Boolean = false
|
||||
|
||||
fun shouldRunInBackground(scriptDefinition: ScriptDefinition): Boolean = false
|
||||
|
||||
fun interceptBackgroundLoading(file: VirtualFile, doLoad: () -> Unit): Boolean = false
|
||||
|
||||
/**
|
||||
* Implementation should load configuration and call `context.suggestNewConfiguration` or `saveNewConfiguration`.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user