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 e261b4f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions resources/META-INF/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ <h1>v15.0.2</h1>
<p>The API is scheduled for removal and is replaced by <code>Call.align(AlignX.FILL)</code>.</p>
</li>
<li>Ignore <code>group:</code> for docs.</li>
<li>Don't resolve built-in types against the index if index is updating.</li>
<li><code>findModuleForPsiElement</code> in <code>mostSpecificSdk</code> in read action.</li>
</ul>
</li>
</ul>
Expand Down
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 e261b4f

Please sign in to comment.