PTVS Intellisense

Quick question: I’ve been working with PTVS (Python Tools for Visual Studio), but haven’t been able to get the panda3d libraries to be recognized by Intellisense or code completion. Other modules (direct, etc.) are, but I was wondering if anyone here has managed to get all of it working nicely. Alternatively, if you’ve got it completely working in another IDE, I’d be interested to hear that too.

I’ve read the two threads here, but it didn’t seem like anyone there had gotten all of the libraries recognized, due to the wonky imports for panda3d. Do those make code completion infeasible?
[url]Panda Coding with Python in Visual Studio 2012]
[url]New Guy Here - Questions Inside]

Thanks!

I haven’t solved it either, and I’ve done a TON of research on the matter. Nobody had solved it as of 1-2 years ago. But, here’s what I’ve found and some ideas I’ve had but haven’t implemented just yet. First, it’s a very difficult problem for an IDE to solve due to the dynamic typing. Plus, Panda is bound to C++. From what I can tell by using PyCharm the classes defined in C++ are the ones the IDE knows nothing about. I’ve used both VS and PyCharm. I think PyCharm had a slight edge on VS for resolving autocomplete. I’m going to sound a bit like a fanboy, but I just have more experience with PyCharm.

Maybe you could look for the following features in VS.

There are ways I believe you can help the IDEs do it better. PyCharm has set folders as included or excluded in the project. For me, it was picking up “base” from some other code (I think Django). I haven’t gone through all of Panda and told it what to concentrate on via include/exclude. Notice, this has nothing to do with the interpreter. you can exclude something from the project and the interpreter will pick it up.

That said, I think to fully fix the issue will require a hard coded solution. In PyCharm, you can go into settings a set the documentation for PyCharm to find class documentation which will popup in tooltips when hovering over a variable name. You can set it up to work with URLs but I haven’t been able to get it to work for Panda. I experimented one day with NodePath (I believe). Also, you can generate docs. So, I believe you can do something like this. I’ll do pseudo-Python:

attribs = class.__dict__.getKeys()
for attrib in attribs:
    if isCallable(attrib) and not attrib.startswith('__'):
        print attribs.__doc__

The above printed the C++ documentation from the source file complete with “//” style comments. My idea was to make a script that printed each function and class wiht the doc strings below each function and class name. The idea was to do this so the IDE could pull it in automatically as the documentation. Maybe, that would cross over into the autocomplete, IDK. The IDEs can’t work it out as symbols is all I know for certain whether it’s Panda or pure Python. I wish they would guess the type sometimes. It seems they don’t want even try when they’re not sure.

WingIDE is another viable solution (maybe the best as it’s written in Python), but to get a Pro edition costed like $495 where PyCharm was $99. When I tested the free PyCharm vs free WingIDE, there wasn’t much difference. Wing might have been slightly better actually for autocomplete and they way documentation popped up, but not by much.

Note I have a personal license for PyCharm. I think the main/only obstacle in Community Edition would be developing a plugin if need be, since this is likely not a feature in the free version.