Minor: changes after review
This commit is contained in:
committed by
Natalia Selezneva
parent
fc100d13dd
commit
75a23b4bc4
+16
-13
@@ -18,6 +18,7 @@ import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
import org.jetbrains.kotlin.idea.core.script.*
|
||||
import org.jetbrains.kotlin.idea.core.script.configuration.DefaultScriptConfigurationManagerExtensions.LOADER
|
||||
import org.jetbrains.kotlin.idea.core.script.configuration.DefaultScriptConfigurationManagerExtensions.LISTENER
|
||||
import org.jetbrains.kotlin.idea.core.script.configuration.cache.ScriptConfigurationFileAttributeCache
|
||||
import org.jetbrains.kotlin.idea.core.script.configuration.cache.ScriptConfigurationMemoryCache
|
||||
import org.jetbrains.kotlin.idea.core.script.configuration.cache.ScriptConfigurationSnapshot
|
||||
@@ -107,18 +108,23 @@ internal class DefaultScriptConfigurationManager(project: Project) :
|
||||
if (ApplicationManager.getApplication().isUnitTestMode) TestingBackgroundExecutor(rootsIndexer)
|
||||
else DefaultBackgroundExecutor(project, rootsIndexer)
|
||||
|
||||
private val outsiderLoader = ScriptOutsiderFileConfigurationLoader(project)
|
||||
private val fileAttributeCache = ScriptConfigurationFileAttributeCache(project)
|
||||
private val defaultLoader = DefaultScriptConfigurationLoader(project)
|
||||
private val loaders: Sequence<ScriptConfigurationLoader>
|
||||
get() = sequence {
|
||||
yield(outsiderLoader)
|
||||
yield(fileAttributeCache)
|
||||
yieldAll(LOADER.getPoint(project).extensionList)
|
||||
yield(defaultLoader)
|
||||
}
|
||||
|
||||
private val loaders: List<ScriptConfigurationLoader>
|
||||
get() = listOf(
|
||||
ScriptOutsiderFileConfigurationLoader(project),
|
||||
ScriptConfigurationFileAttributeCache(project)
|
||||
) + project[LOADER] + listOf(
|
||||
DefaultScriptConfigurationLoader(project)
|
||||
)
|
||||
|
||||
private val listeners: List<ScriptChangeListener>
|
||||
get() = project[DefaultScriptConfigurationManagerExtensions.LISTENER] + listOf(DefaultScriptChangeListener())
|
||||
private val defaultListener = DefaultScriptChangeListener()
|
||||
private val listeners: Sequence<ScriptChangeListener>
|
||||
get() = sequence {
|
||||
yieldAll(LISTENER.getPoint(project).extensionList)
|
||||
yield(defaultListener)
|
||||
}
|
||||
|
||||
private val notifier = ScriptChangesNotifier(project, updater, listeners)
|
||||
|
||||
@@ -131,9 +137,6 @@ internal class DefaultScriptConfigurationManager(project: Project) :
|
||||
}
|
||||
}
|
||||
|
||||
private operator fun <T> Project.get(epName: ExtensionPointName<T>): List<T> =
|
||||
Extensions.getArea(this).getExtensionPoint(epName).extensionList
|
||||
|
||||
/**
|
||||
* Will be called on [cache] miss to initiate loading of [file]'s script configuration.
|
||||
*
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ import org.jetbrains.kotlin.scripting.definitions.isNonScript
|
||||
internal class ScriptChangesNotifier(
|
||||
private val project: Project,
|
||||
private val updater: ScriptConfigurationUpdater,
|
||||
private val listeners: List<ScriptChangeListener>
|
||||
private val listeners: Sequence<ScriptChangeListener>
|
||||
) {
|
||||
private val scriptsQueue = Alarm(Alarm.ThreadToUse.SWING_THREAD, project)
|
||||
private val scriptChangesListenerDelay = 1400
|
||||
|
||||
Reference in New Issue
Block a user