Check that project is open before starting highlighting

This may be false when user opens Kotlin Scripting Settings, so default project is passed to ScriptDefinitionsManager
^KT-30206 Fixed
This commit is contained in:
Natalia Selezneva
2019-09-26 15:13:40 +03:00
parent 5ab119ecfb
commit 917a7f572d
@@ -102,7 +102,9 @@ class ScriptConfigurationManagerImpl internal constructor(private val project: P
override fun clearConfigurationCachesAndRehighlight() {
ScriptDependenciesModificationTracker.getInstance(project).incModificationCount()
clearAndRehighlight()
if (project.isOpen) {
rehighlightOpenedScripts()
}
}
@Deprecated("Use getScriptClasspath(KtFile) instead")
@@ -322,7 +324,7 @@ class ScriptConfigurationManagerImpl internal constructor(private val project: P
return isConfigurationCached(file) && memoryCache.isConfigurationUpToDate(file)
}
private fun clearAndRehighlight() {
private fun rehighlightOpenedScripts() {
val openedScripts = FileEditorManager.getInstance(project).openFiles.filterNot { it.isNonScript() }
updateHighlighting(openedScripts)
}