Skip to content

Commit

Permalink
findMOduleForPsiElement in mostSpecificSdk in read action
Browse files Browse the repository at this point in the history
Fixes #3212
  • Loading branch information
KronicDeth committed Jun 3, 2023
1 parent 5bd799a commit 073721f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/org/elixir_lang/sdk/elixir/Type.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package org.elixir_lang.sdk.elixir
import com.intellij.facet.FacetManager
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.application.ModalityState
import com.intellij.openapi.application.ReadAction
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.fileChooser.FileChooserDescriptor
import com.intellij.openapi.module.Module
Expand All @@ -15,10 +16,7 @@ import com.intellij.openapi.roots.ModuleRootManager
import com.intellij.openapi.roots.OrderRootType
import com.intellij.openapi.roots.ProjectFileIndex
import com.intellij.openapi.roots.ProjectRootManager
import com.intellij.openapi.util.InvalidDataException
import com.intellij.openapi.util.SystemInfo
import com.intellij.openapi.util.Version
import com.intellij.openapi.util.WriteExternalException
import com.intellij.openapi.util.*
import com.intellij.openapi.vfs.VfsUtil
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.openapi.vfs.VirtualFileManager
Expand Down Expand Up @@ -532,7 +530,9 @@ ELIXIR_SDK_HOME
ProjectFileIndex is available first */
if (ProjectFileIndex.SERVICE.getInstance(project) != null) {
val module = try {
ModuleUtilCore.findModuleForPsiElement(psiElement)
ReadAction.compute<Module, Throwable> {
ModuleUtilCore.findModuleForPsiElement(psiElement)
}
} catch (_: AlreadyDisposedException) {
null
}
Expand Down

0 comments on commit 073721f

Please sign in to comment.