When a class is wrapped with a decorator that adds attributes to the class, the added attributes are not recognized by the language server #8817
ytxmobile98
started this conversation in
General
Replies: 1 comment 2 replies
-
Converting this to a discussion topic since it isn't a bug. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Environment data
Code Snippet
I recently ran into this issue when I needed to use a class decorator to add custom attributes (methods and properties) to it. As seen below, when I added a decorator (
wrap
) along the classFoo
, it adds a class methodbar
and a data attributeone
to it. But when I then reference these two added attributes, the editor shows red squiggles underneath, and jumping to the initial definitions in the decoration function or auto-completing these attributes are also not possible. Here is a minimal example to reproduce it:Repro Steps
main.py
Expected behavior
The references to
bar
andone
should work normally, i.e. the language server should recognize them as corresponding to what I defined above.Actual behavior
The language server sees them as unknown attributes.
Beta Was this translation helpful? Give feedback.
All reactions