Skip to content

Commit

Permalink
Fix field names treated with incorrect scope (#90)
Browse files Browse the repository at this point in the history
* Fix field names treated with incorrect scope
  • Loading branch information
koxudaxi authored Nov 27, 2019
1 parent 5f2dd6c commit 83cd142
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
<idea-plugin url="https://github.com/koxudaxi/pydantic-pycharm-plugin">
<id>com.koxudaxi.pydantic</id>
<name>Pydantic</name>
<version>0.0.27</version>
<version>0.0.28</version>
<vendor email="koaxudai@gmail.com">Koudai Aono @koxudaxi</vendor>
<change-notes><![CDATA[
<h2>version 0.0.28</h2>
<p>BugFixes</p>
<ul>
<li>Fix field names treated with incorrect scope [#90] </li>
</ul>
<h2>version 0.0.27</h2>
<p>Features</p>
<ul>
Expand Down
2 changes: 1 addition & 1 deletion src/com/koxudaxi/pydantic/PydanticTypeProvider.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class PydanticTypeProvider : PyTypeProviderBase() {

override fun getReferenceType(referenceTarget: PsiElement, context: TypeEvalContext, anchor: PsiElement?): Ref<PyType>? {
if (referenceTarget is PyTargetExpression) {
val pyClass = referenceTarget.containingClass ?: return null
val pyClass = referenceTarget.parent?.parent?.parent as? PyClass ?: return null
if (!isPydanticModel(pyClass, context)) return null
val name = referenceTarget.name ?: return null
getRefTypeFromFieldName(name, context, pyClass)?.let { return it }
Expand Down

0 comments on commit 83cd142

Please sign in to comment.