mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-16 02:27:06 +08:00
Improve a bit of dataclasses support, so at least the attributes can be seen
see #1213
This commit is contained in:
@@ -599,4 +599,8 @@ _implemented = {
|
||||
# being used instead. This only matters for 3.7+.
|
||||
'_alias': lambda obj, arguments: NO_CONTEXTS,
|
||||
},
|
||||
'dataclasses': {
|
||||
# For now this works at least better than Jedi trying to understand it.
|
||||
'dataclass': lambda obj, arguments: NO_CONTEXTS,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -310,11 +310,14 @@ follow_statement(1)
|
||||
# class decorators should just be ignored
|
||||
@should_ignore
|
||||
class A():
|
||||
x = 3
|
||||
def ret(self):
|
||||
return 1
|
||||
|
||||
#? int()
|
||||
A().ret()
|
||||
#? int()
|
||||
A().x
|
||||
|
||||
|
||||
# -----------------
|
||||
|
||||
@@ -103,3 +103,13 @@ d.var_class1
|
||||
d.var_class2
|
||||
#? []
|
||||
d.int
|
||||
|
||||
|
||||
|
||||
import dataclasses
|
||||
@dataclasses.dataclass
|
||||
class DC:
|
||||
name: int = 1
|
||||
|
||||
#? int()
|
||||
DC().name
|
||||
|
||||
Reference in New Issue
Block a user