Refactor the mechanism how script configurations are updated
Introduce file attributes cache, which is only applicable when no dependencies are cached in memory cache Refactor ScriptDependenciesCache to memory cache that is able to get configuration from cache and checks if it is up to date Move all public methods to ScriptDependenciesManager Introduce ScriptClassRootsManager that checks if root change event should be called after script configuration update
This commit is contained in:
+1
-1
@@ -105,7 +105,7 @@ sealed class ScriptDependenciesInfo(val project: Project) : IdeaModuleInfo, Bina
|
||||
class ForProject(project: Project) : ScriptDependenciesInfo(project) {
|
||||
override val sdk: Sdk?
|
||||
get() {
|
||||
return ScriptDependenciesManager.getInstance(project).getAllScriptsSdks().firstOrNull()
|
||||
return ScriptDependenciesManager.getInstance(project).getFirstScriptsSdk()
|
||||
?: ScriptDependenciesManager.getScriptDefaultSdk(project)
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.idea.caches.project.NotUnderContentRootModuleInfo
|
||||
import org.jetbrains.kotlin.idea.caches.project.getModuleInfo
|
||||
import org.jetbrains.kotlin.idea.core.script.IdeScriptReportSink
|
||||
import org.jetbrains.kotlin.idea.core.script.ScriptDefinitionsManager
|
||||
import org.jetbrains.kotlin.idea.core.script.ScriptsCompilationConfigurationUpdater
|
||||
import org.jetbrains.kotlin.idea.core.script.ScriptDependenciesManager
|
||||
import org.jetbrains.kotlin.idea.util.ProjectRootsUtil
|
||||
import org.jetbrains.kotlin.idea.util.isRunningInCidrIde
|
||||
import org.jetbrains.kotlin.psi.KtCodeFragment
|
||||
@@ -70,7 +70,7 @@ object KotlinHighlightingUtil {
|
||||
@Suppress("DEPRECATION")
|
||||
private fun shouldHighlightScript(ktFile: KtFile): Boolean {
|
||||
if (isRunningInCidrIde) return false // There is no Java support in CIDR. So do not highlight errors in KTS if running in CIDR.
|
||||
if (!ScriptsCompilationConfigurationUpdater.areDependenciesCached(ktFile)) return false
|
||||
if (!ScriptDependenciesManager.getInstance(ktFile.project).isConfigurationCached(ktFile)) return false
|
||||
if (IdeScriptReportSink.getReports(ktFile).any { it.severity == ScriptDiagnostic.Severity.FATAL }) {
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user