Do not attach script reports if 'reload dependencies' isn't pressed (KT-24706)
^KT-24706 Fixed
This commit is contained in:
+9
-2
@@ -22,6 +22,7 @@ import java.util.concurrent.ConcurrentHashMap
|
|||||||
import kotlin.script.experimental.dependencies.AsyncDependenciesResolver
|
import kotlin.script.experimental.dependencies.AsyncDependenciesResolver
|
||||||
import kotlin.script.experimental.dependencies.DependenciesResolver
|
import kotlin.script.experimental.dependencies.DependenciesResolver
|
||||||
import kotlin.script.experimental.dependencies.ScriptDependencies
|
import kotlin.script.experimental.dependencies.ScriptDependencies
|
||||||
|
import kotlin.script.experimental.dependencies.ScriptReport
|
||||||
|
|
||||||
abstract class ScriptDependenciesLoader(
|
abstract class ScriptDependenciesLoader(
|
||||||
protected val file: VirtualFile,
|
protected val file: VirtualFile,
|
||||||
@@ -71,24 +72,30 @@ abstract class ScriptDependenciesLoader(
|
|||||||
protected fun processResult(result: DependenciesResolver.ResolveResult) {
|
protected fun processResult(result: DependenciesResolver.ResolveResult) {
|
||||||
loaders.remove(file)
|
loaders.remove(file)
|
||||||
|
|
||||||
ServiceManager.getService(project, ScriptReportSink::class.java)?.attachReports(file, result.reports)
|
|
||||||
|
|
||||||
val newDependencies = result.dependencies?.adjustByDefinition(scriptDef) ?: return
|
val newDependencies = result.dependencies?.adjustByDefinition(scriptDef) ?: return
|
||||||
if (cache[file] != newDependencies) {
|
if (cache[file] != newDependencies) {
|
||||||
if (shouldShowNotification() && cache[file] != null && !ApplicationManager.getApplication().isUnitTestMode) {
|
if (shouldShowNotification() && cache[file] != null && !ApplicationManager.getApplication().isUnitTestMode) {
|
||||||
file.addScriptDependenciesNotificationPanel(newDependencies, project) {
|
file.addScriptDependenciesNotificationPanel(newDependencies, project) {
|
||||||
saveDependencies(newDependencies)
|
saveDependencies(newDependencies)
|
||||||
|
attachReports(result.reports)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
saveDependencies(newDependencies)
|
saveDependencies(newDependencies)
|
||||||
|
attachReports(result.reports)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
attachReports(result.reports)
|
||||||
|
|
||||||
if (shouldShowNotification()) {
|
if (shouldShowNotification()) {
|
||||||
file.removeScriptDependenciesNotificationPanel(project)
|
file.removeScriptDependenciesNotificationPanel(project)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun attachReports(reports: List<ScriptReport>) {
|
||||||
|
ServiceManager.getService(project, ScriptReportSink::class.java)?.attachReports(file, reports)
|
||||||
|
}
|
||||||
|
|
||||||
private fun saveDependencies(dependencies: ScriptDependencies) {
|
private fun saveDependencies(dependencies: ScriptDependencies) {
|
||||||
if (shouldShowNotification()) {
|
if (shouldShowNotification()) {
|
||||||
file.removeScriptDependenciesNotificationPanel(project)
|
file.removeScriptDependenciesNotificationPanel(project)
|
||||||
|
|||||||
Reference in New Issue
Block a user