Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NotFound getDataclassParameters error #573

Merged
merged 1 commit into from
Nov 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/com/koxudaxi/pydantic/PydanticParametersProvider.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import com.intellij.openapi.project.Project
import com.intellij.psi.util.QualifiedName
import com.jetbrains.python.codeInsight.PyDataclassParameters
import com.jetbrains.python.codeInsight.PyDataclassParametersProvider
import com.jetbrains.python.psi.PyClass
import com.jetbrains.python.psi.PyElementGenerator
import com.jetbrains.python.psi.types.PyCallableParameter
import com.jetbrains.python.psi.types.PyCallableParameterImpl
import com.jetbrains.python.psi.types.TypeEvalContext

class PydanticParametersProvider : PyDataclassParametersProvider {

Expand All @@ -19,6 +21,7 @@ class PydanticParametersProvider : PyDataclassParametersProvider {
parameters.addAll(DATACLASS_ARGUMENTS.map { name -> PyCallableParameterImpl.nonPsi(name, null, ellipsis) })
return Triple(DATACLASS_QUALIFIED_NAME, PydanticType, parameters)
}
override fun getDataclassParameters(cls: PyClass, context: TypeEvalContext?): PyDataclassParameters? = null

private object PydanticType : PyDataclassParameters.Type {
override val name: String = "pydantic"
Expand Down