Skip to content

Commit

Permalink
Don't resolve built-in types against the index if index is updating
Browse files Browse the repository at this point in the history
Fixes #3168
  • Loading branch information
KronicDeth committed May 26, 2023
1 parent 66cb85e commit 5bd799a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@
The API is scheduled for removal and is replaced by `Call.align(AlignX.FILL)`.
* [#3214](https://github.com/KronicDeth/intellij-elixir/pull/3214) - [@KronicDeth](https://github.com/KronicDeth)
* 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.

## v15.0.1

Expand Down
1 change: 1 addition & 0 deletions resources/META-INF/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ <h1>v15.0.1</h1>
<code>175</code> in IntelliJ 2023.1's builder number, <code>231.8109.175</code>.
</p>
</li>
<li>Don't resolve built-in types against the index if index is updating.</li>
</ul>
</li>
</ul>
Expand Down
21 changes: 12 additions & 9 deletions src/org/elixir_lang/reference/resolver/Type.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.elixir_lang.reference.resolver

import com.intellij.openapi.project.DumbService
import com.intellij.psi.PsiElement
import com.intellij.psi.ResolveResult
import com.intellij.psi.impl.source.resolve.ResolveCache
Expand Down Expand Up @@ -56,16 +57,18 @@ object Type : ResolveCache.PolyVariantResolver<org.elixir_lang.reference.Type> {
val project = entrance.project
val resolveResultList = mutableListOf<ResolveResult>()

StubIndex.getInstance().processElements(
ModularName.KEY,
":erlang",
project,
GlobalSearchScope.allScope(project),
NamedElement::class.java
) { namedElement ->
resolveResultList.addAll(MultiResolve.resolveResults(name, arity, false, namedElement))
if (!DumbService.isDumb(project)) {
StubIndex.getInstance().processElements(
ModularName.KEY,
":erlang",
project,
GlobalSearchScope.allScope(project),
NamedElement::class.java
) { namedElement ->
resolveResultList.addAll(MultiResolve.resolveResults(name, arity, false, namedElement))

true
true
}
}

return resolveResultList.toTypedArray()
Expand Down

0 comments on commit 5bd799a

Please sign in to comment.