to avoid deadlock, don't refresh VFS during service initialization, instead refresh asynchronously during plugin initialization
This commit is contained in:
+14
-6
@@ -94,12 +94,7 @@ public class BuiltInsReferenceResolver(val project: Project, val startupManager:
|
||||
val vf = VirtualFileManager.getInstance().findFileByUrl(fromUrl)
|
||||
assert(vf != null) { "Virtual file not found by URL: $url" }
|
||||
|
||||
// Refreshing VFS: in case the plugin jar was updated, the caches may hold the old value
|
||||
vf!!.getChildren()
|
||||
vf.refresh(false, true)
|
||||
PathUtil.getLocalFile(vf).refresh(false, true)
|
||||
|
||||
val psiDirectory = PsiManager.getInstance(project).findDirectory(vf)
|
||||
val psiDirectory = PsiManager.getInstance(project).findDirectory(vf!!)
|
||||
assert(psiDirectory != null) { "No PsiDirectory for $vf" }
|
||||
return psiDirectory!!.getFiles().filterIsInstance<JetFile>().toHashSet()
|
||||
}
|
||||
@@ -188,5 +183,18 @@ public class BuiltInsReferenceResolver(val project: Project, val startupManager:
|
||||
}
|
||||
return setOf(defaultBuiltIns)
|
||||
}
|
||||
|
||||
public fun refreshBuiltIns() {
|
||||
getBuiltInsDirUrls().forEach { url ->
|
||||
val fromUrl = VfsUtilCore.convertFromUrl(url)
|
||||
val vf = VirtualFileManager.getInstance().findFileByUrl(fromUrl)
|
||||
assert(vf != null) { "Virtual file not found by URL: $url" }
|
||||
|
||||
// Refreshing VFS: in case the plugin jar was updated, the caches may hold the old value
|
||||
vf!!.getChildren()
|
||||
vf.refresh(true, true)
|
||||
PathUtil.getLocalFile(vf).refresh(true, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user