[inlays] Fix slow operation in AnnotationsPreloader

Retrieving the file type can be slow in some cases and shouldn't be called on EDT. #IDEA-352817 Fixed

GitOrigin-RevId: 1c9550cf2a8c5a499700c740df31a38b5f09a9dd
This commit is contained in:
Bart van Helvert
2024-05-01 10:59:28 +02:00
committed by intellij-monorepo-bot
parent 1465ba0763
commit 5088053cf6

View File

@@ -43,7 +43,7 @@ internal class AnnotationsPreloader(private val project: Project) {
}
fun schedulePreloading(file: VirtualFile) {
if (project.isDisposed || file.fileType.isBinary) return
if (project.isDisposed) return
updateQueue.queue(object : DisposableUpdate(project, file) {
override fun doRun() {
@@ -51,6 +51,7 @@ internal class AnnotationsPreloader(private val project: Project) {
val start = System.currentTimeMillis()
if (!FileEditorManager.getInstance(project).isFileOpen(file)) return
if (file.fileType.isBinary) return
val annotationProvider = getAnnotationProvider(project, file) ?: return
annotationProvider.populateCache(file)