Add external framework so code completion works

Jan 30, 2013 at 1:56 PM

Hi @all. First off I am completely new to Python Tools for VS as well as to Python in general. I started down this path to write a simple plugin for Plex Media Server (plexapp.com). Their Plugin-Framework is mostly Python. After coding a tiny bit in Notepad++ I was looking for some extra functionality like code completion.

Now I am struggling to figure out what I have to do so that I get some code completion working for objects and methods included in that framework. As far as I can see the relevant .py files that contain the framework objects are scattered in various sub-folders of a folder called "Framework.bundle". Plugins do not require you to add any "import" statements as the framework is already loaded by the time the plugin code gets called by Plex Media Server.

Any help on this matter would be much appreciated.

Thanks & Best Regards,

Gundy

Feb 4, 2013 at 12:30 AM
Anyone? Sorry, I probably am not making much sense. Just let me know if that is the case and I'll try to explain better.
Coordinator
Feb 4, 2013 at 12:40 AM
I think the easiest thing might be to add the library to your search path (via the search paths node in solution explorer). Adding the files into the search paths will cause the analysis engine to pick them up and make them available for completions. Then you could add a:

if False:
from Framework.bundle import *
To the top of your file. That code obviously won't ever execute, but the analysis engine won't know that, and will still make all of those imports available. It's a little ugly but there's currently no other way to make the analysis engine aware of these sort of implicit imports. If you'd like to see a cleaner solution in the future feel free to open a feature request for adding some form of implicit imports, and of course contributions are always welcome :)
Feb 4, 2013 at 1:53 AM
Thanks for the reply. I have just tried this, but I must be doing something wrong. This is the search path I am currently using:
"C:\Program Files (x86)\Plex\Plex Media Server\Resources\Plug-ins\Framework.bundle"

Part of the code for example makes use of the HTTP class that can be found in the following file:
"C:\Program Files (x86)\Plex\Plex Media Server\Resources\Plug-ins\Framework.bundle\Contents\Resources\Platforms\Shared\Libraries\httplib_new.py"

Intellisense does not seem to pick up on this. Yep, I know nothing about Python....