Code completion for generated classes

description

Dear PTVS team,

we have a python class wrapping an external library.
At run-time, this class loads the external library and generates its methods dynamically (using ast).
As such, these methods are "invisible" to PTVS.

In PTVS, is there a way to achieve code completion for these methods or dynamically generated objects in general? For example a data format or an API in which they could be added to the Completion DB?

(Note that this works because we don't try and figure out whether an if condition is true or false - we just assume that all conditions will run at some point. I believe most IDEs behave like this, and there are certainly projects out there
already using it for better completions.)

Oh, there are two other ways this can be done, but neither is as simple as the above method:

If you include a .pyd then we will load it and rely on dir() and the
inspect module to find out its contents. This means you can dynamically generate the members and we will store them in the completion DB. This is only going to work for installed packages though, and the end result is basically identical to the
if False method.

The other alternative involves writing a C# DLL that injects itself into our process. Our analysis engine is extensible and you can implement special object types in C#. We've done this with IronPython to support types that come from .NET and with Django to
support completions in templates. It isn't an easy process, however, so you'd have to be
really keen to go this route. We're happy to help though, and to make changes to PTVS to make it easier to extend.