This project has moved and is read-only. For the latest updates, please go here.

auto completion for COM objects in LEPR - Ironpython

Jun 12, 2011 at 11:26 PM


i am trying to get the feature present in the "old" python win editor.
Once the reference to a COM object was obtained, the auto completion worked.
If I do the equivalent in interactive VS window, all I get is MemberwiseClone and __doc__.
Is there a way to get it enabled/configured in VS or perhaps I have to call something extra?

I also tried the same in plain ipy.exe. Once -X:tabCompletion is provided the methods of the COM objects are available.

pythonwin way:
from win32com import client

ironpython way (VS console and ipy):
from System.Runtime.InteropServices import Marshal

Jun 15, 2011 at 12:19 AM

Do you want this in the normal IDE or in the REPL window?  If it's just the repl window you can get this via enabling Tools->Options->Python Tools->Interactive Windows->Completion Mode->"Always evaluate expressions" and we should give you completions off of live numbers (this is similar to -X:TabCompletion). 

If it's in the editor window we are tracking this via this feature request:  Please vote for it but unfortunately I don't think we'll be doing it for 1.0 at this point. 

Jun 15, 2011 at 1:49 PM

thanks! It made a difference but ...

> Do you want this in the normal IDE or in the REPL window?

My focus is interactive: REPL, ipython or pythonwin.

I did more testing and here are the results:

1) ironpython within REPL it shows more but does not include any of the COM object methods/properties.

2) cpython with ipython, the same result as above

3) cpython with ipython after makepy run over the obeject in question, partial COM object information is available (some of the methods/properties but not all)

4) cpython with pythonwin (with or without makepy info), all COM object information is available


I suspect the pythonwin interactive mode (kind of REPL) is very intelligent about the COM objects.

I can always prototype/test interactively with pythonwin and paste results into the VS.



Jun 15, 2011 at 5:17 PM

Cool - glad that helps.  My guess is that the solutions that aren't working don't provide information via dir() about what members are on them.  Instead they probably respond to __getattr__/__getattribute__ requests and provide the members at runtime.  pythonwin probably wraps the COM objects in something which has all of the members available.  IronPython could probably improve it's COM interop to support this - not sure about normal CPython.