If I edit a python file in Visual Studio Code with the ms-python.python extension enabled, I get proposals for member variables and methods, but not for class attributes on the class. In the Image 1 below you can see that it does propose something for the class -- but not the class attribute I was hoping for.
Is there some way to fix this (fix a setting, install another plugin, ...)?
As an example, consider the following code and see the comments that indicate where autocompletion works/does not work.
class MyClass:
"""
A class with a single class attribute ``value`` and an instance attribute ``member``.
"""
value: int = 3
def __init__(self):
self.member = 5
def method(self, i: int) -> int:
"""return ``i`` + ``value`` + ``self.member``"""
return i + MyClass.value + self.member
instance = MyClass()
print(instance.method(5)) # autocompletion for method works
print(instance.member) # autocompletion for member works
print(MyClass.value) # autocompletion for value DOES NOT work
print(instance.value) # autocompletion for value works
I'm running VSCode 1.43.2 with the Python extension in version 2020.3.71659 on Arch Linux with Python 3.8.
Edit: There is an old question that goes into a similar direction, but that did not solve my problem.