From 20d19ee66f427c8c83252fe82a73de3e0872a5d6 Mon Sep 17 00:00:00 2001 From: Natalia Selezneva Date: Mon, 3 Jun 2019 11:42:07 +0300 Subject: [PATCH] Temporary workaround for ProcessCanceledException that may happen during dependencies update This happens during finding script definition (especially during virtual file to psi file search) In this case dependencies may be already saved to cache, so makeRootChangeEvent should be generated, otherwise indexes aren't updated and highlighting in the script can be broken --- .../script/ScriptsCompilationConfigurationUpdater.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/script/ScriptsCompilationConfigurationUpdater.kt b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/script/ScriptsCompilationConfigurationUpdater.kt index e3bffac148c..7bad15538e2 100644 --- a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/script/ScriptsCompilationConfigurationUpdater.kt +++ b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/script/ScriptsCompilationConfigurationUpdater.kt @@ -68,8 +68,13 @@ class ScriptsCompilationConfigurationUpdater( fun getCurrentCompilationConfiguration(file: VirtualFile): ScriptCompilationConfigurationResult? { cache[file]?.let { return it } - updateDependencies(file) - makeRootsChangeIfNeeded() + // Try-catch block is a temporary workaround for ProcessCanceledException + // that may happen during VirtualFile to PsiFile transformation + try { + updateDependencies(file) + } finally { + makeRootsChangeIfNeeded() + } return cache[file] }