diff --git a/CHANGELOG.md b/CHANGELOG.md index e5b2bf736..f220813e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -294,6 +294,8 @@ * Ignore `group:` for docs. * [#3242](https://github.com/KronicDeth/intellij-elixir/pull/3242) - [@KronicDeth](https://github.com/KronicDeth) * Don't resolve built-in types against the index if index is updating. +* [#3249](https://github.com/KronicDeth/intellij-elixir/pull/3249) - [@KronicDeth](https://github.com/KronicDeth) + * `findModuleForPsiElement` in `mostSpecificSdk` in read action. ## v15.0.1 diff --git a/resources/META-INF/changelog.html b/resources/META-INF/changelog.html index 3dcf88e42..240a9bf44 100644 --- a/resources/META-INF/changelog.html +++ b/resources/META-INF/changelog.html @@ -10,6 +10,8 @@

v15.0.2

The API is scheduled for removal and is replaced by Call.align(AlignX.FILL).

  • Ignore group: for docs.
  • +
  • Don't resolve built-in types against the index if index is updating.
  • +
  • findModuleForPsiElement in mostSpecificSdk in read action.
  • diff --git a/src/org/elixir_lang/sdk/elixir/Type.kt b/src/org/elixir_lang/sdk/elixir/Type.kt index 1971734d8..9a94920eb 100644 --- a/src/org/elixir_lang/sdk/elixir/Type.kt +++ b/src/org/elixir_lang/sdk/elixir/Type.kt @@ -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 @@ -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 @@ -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 { + ModuleUtilCore.findModuleForPsiElement(psiElement) + } } catch (_: AlreadyDisposedException) { null }