Skip to content

Commit

Permalink
Merge pull request #1786 from odk211/remove-unresolved-module-attribu…
Browse files Browse the repository at this point in the history
…te-error-annotation

Remove "Unresolved module attribute" error annotation
  • Loading branch information
KronicDeth committed Jun 5, 2020
2 parents 71ff1fc + be45125 commit 48fb6e0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@
* Fix Unchecking Show Method Separator still showing on `@doc` and `@spec`.

Previously, unchecking Show Method Separator would still show the method separator if it was the module attributes (such as `@doc` and `@spec`) associated with the call definition (`def`, `defp`, `defmacro`, or `defmacrop`) and only disabled the ones directly above the call definition. This is fixed by checking if method separators are enabled in `getLineMarkerInfo(PsiElement)` instead of the specialized `getLineMarkerInfo(Call)`, so that the check happens for both module attributes and call definitions.
* [#1786](https://github.com/KronicDeth/intellij-elixir/pull/1786) - [@odk211](https://github.com/odk211)
* Remove "Unresolved module attribute" error annotation because module attributes cannot be resolved through `use` yet, so current annotation is a false positive in those cases.

## v11.7.0
### Enhancements
Expand Down
4 changes: 4 additions & 0 deletions resources/META-INF/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ <h1>v11.7.1</h1>
that the check happens for both module attributes and call definitions.
</p>
</li>
<li>
Remove "Unresolved module attribute" error annotation because module attributes cannot be resolved through
<code>use</code> yet, so current annotation is a false positive in those cases.
</li>
</ul>
</li>
</ul>
Expand Down
18 changes: 0 additions & 18 deletions src/org/elixir_lang/annotator/ModuleAttribute.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import com.intellij.openapi.editor.markup.TextAttributes
import com.intellij.openapi.project.DumbAware
import com.intellij.openapi.util.TextRange
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiPolyVariantReference
import com.intellij.psi.PsiRecursiveElementVisitor
import com.intellij.psi.tree.TokenSet
import org.elixir_lang.ElixirSyntaxHighlighter
Expand All @@ -25,7 +24,6 @@ import org.elixir_lang.psi.impl.stripAccessExpression
import org.elixir_lang.psi.operation.*
import org.elixir_lang.reference.ModuleAttribute.Companion.isCallbackName
import org.elixir_lang.reference.ModuleAttribute.Companion.isDocumentationName
import org.elixir_lang.reference.ModuleAttribute.Companion.isNonReferencing
import org.elixir_lang.reference.ModuleAttribute.Companion.isSpecificationName
import org.elixir_lang.reference.ModuleAttribute.Companion.isTypeName
import org.elixir_lang.structure_view.element.CallDefinitionHead.Companion.stripAllOuterParentheses
Expand Down Expand Up @@ -112,22 +110,6 @@ class ModuleAttribute : Annotator, DumbAware {
holder,
ElixirSyntaxHighlighter.MODULE_ATTRIBUTE
)

if (!isNonReferencing(atNonNumericOperation)) {
atNonNumericOperation.reference?.let { reference ->
val hasValidResults = when (reference) {
is PsiPolyVariantReference -> reference.multiResolve(false).any { it.isValidResult }
else -> reference.resolve() != null
}

if (!hasValidResults) {
holder
.newAnnotation(HighlightSeverity.ERROR, "Unresolved module attribute")
.range(atNonNumericOperation)
.create()
}
}
}
}
}
)
Expand Down

0 comments on commit 48fb6e0

Please sign in to comment.