LarsHill / metadict

MetaDict is a powerful dict subclass enabling (nested) attribute-style item access/assignment and IDE autocompletion support.
Apache License 2.0
33 stars 0 forks source link

VSCode Support #3

Closed BrutalSimplicity closed 2 years ago

BrutalSimplicity commented 2 years ago

Does this solution happen to also work with VSCode? At first attempt, it doesn't seem that pyright is able to resolve this, but maybe I'm missing a configuration setting.

Thanks. This is beautiful work!

LarsHill commented 2 years ago

I have not tested it with VS Code or other IDE’s than PyCharm so I cannot tell.

However, many interpreters, e.g. ipython or pycharm debugger, utilize the __dir__ method of in-memory objects to dynamically show their attributes and methods via autocomplete (hit tab key). This works only in an interactive environment, e.g. a debugger. The MetaDict() object must be in memory, otherwise it cannot work. So statically, in the editor there cannot be any autocompletion, since the IDE cannot look up the attributes from a typed Class.