RE: [Pydev-code] Autocompletion in PyDev. A first working version
Brought to you by:
fabioz
|
From: Fabio Z. <fa...@in...> - 2004-06-14 18:55:17
|
I added the declaration below to support the Test(object):pass
interp.exec("class object:pass"); //TODO: REMOVE AFTER JYTHON ADDS SUPPORT
TO NEW STYLE CLASSES.
(PythonCompletionProcessor.java)
I'm not sure it is the best thing to do, so, I'm putting it in the list for
discussion...
Fabio
-----Original Message-----
From: pyd...@li...
[mailto:pyd...@li...] On Behalf Of Parhaum
Toofanian
Sent: segunda-feira, 14 de junho de 2004 15:27
To: pyd...@li...
Subject: Re: [Pydev-code] Autocompletion in PyDev. A first working version
I got the same error, but stripped out class definitions (i.e. instead of
'class Test (object):' I just used 'class Test:') and it seems to work
nicely thus far. :) Produced the definitions within the class, as well as
toString and things like __dict__.
I had a couple questions in regards to this and Hyperlinks. Is there a way
the user can specify folders of Python libraries to use (i.e.
c:/python/lib), and will Hyperlinks and AutoCompletion recognize these? I
also had some trouble with this, where foo.py and bar.py are in a folder,
foo with a couple functions, bar with the following code:
import foo
def bar (self):
print "bar"
#foo. <-- error here
getting the error Fabio got before:
Traceback (innermost last):
File "<string>", line 1, in ?
ImportError: no module named foo
I imagine Dana is working on autocompletion, is anyone working on extending
Hyperlinks? I could give that a crack, since it's on my list of features.
- Parhaum
----- Original Message -----
From: "Fabio Zadrozny" <fa...@in...>
To: <pyd...@li...>
Sent: Monday, June 14, 2004 9:08 AM
Subject: RE: [Pydev-code] Autocompletion in PyDev. A first working version
> I also couldn't use it. I got the error below when trying to autocomplete
in
> the following code:
>
> Code:
>
> class Test(object):
>
> def __init__(self):
> self.rara()
>
> def rara(self):
> self.i = 2
> # self. <-- Error on autocomplete here
>
> t = Test()
> #t. <-- Error on autocomplete here
>
>
> Errors:
> Traceback (innermost last):
> File "<string>", line 1, in ?
> NameError: object
>
> Traceback (innermost last):
> File "<string>", line 1, in ?
> NameError: object
>
> Is there something I'm missing to do it work?
>
> []s
>
> Fabio
>
> -----Original Message-----
> From: pyd...@li...
> [mailto:pyd...@li...] On Behalf Of Aleks Totic
> Sent: segunda-feira, 14 de junho de 2004 03:47
> To: pyd...@li...
> Subject: Re: [Pydev-code] Autocompletion in PyDev. A first working version
>
> Very cool. I fixed a few compile errors: jython lib classpath,
> and inclusion of test directory inside CompletionProcessor, and
> checked it in.
>
> Can you tell me what kind of autocompletion smarts can I expect?
> My first couple of tries failed, I'd like to see it in action.
>
> Aleks
>
> Dana Moore wrote:
> > Checked in a first working version of autocomplete.
> > it only autocompletes '.' and not (yet) '(', but it's getting there.
> > If you check out the org.pydev.jython and org.python.pydev.editor you
> > should be able to see it in motion.
> > It works this way:
> > 1. The org.pydev.jython plugin wraps jython.jar and a jythonlib.jar
> > (right now this is about 1.1M; I just picked up the #JYTHON_HOME/LIB on
> > mymachine and jar'ed it. We can probably do a better and more compact
> > one by leaving out some things which just happen to have got swept up
> > from my system.
> > 2. At any rate, within that jar are several Python modules which do
> > code introspection (we probablt need to drop them into a source
> > directory and have a build for the lib itself at some point in time,
> > but first things first.
> > 3. The PythonCompletionProcessor.java grabs the module being edited and
> > comiles the code ahead of the activating partial expression in the
> > buffer:
> > LL 118: interp.exec(theCode);
> > It then pulls up the actiuvating expression
> > LL 119: String xCommand = "theList =
> > jintrospect.getAutoCompleteList(command='"+theActivationToken+"',
> > locals=locals())";
> >
> > and then uses Jython to introspect the code:
> > LL 121 interp.exec(xCommand);
> > creates a PyList from the suggestions:
> > LL 122 PyList theList = (PyList) interp.get("theList");
> > and returns that.
> > LL123 return theList;
> > Which in turn gets turned into autocompletion proposals.
> > What's kind of significant about this is that (I believe) it marks the
> > first time that the Java based Eclipse editor has used a facility of
> > the (non Java) language being edited as leverage.
> >
> > Going forward, I should like to complete the other things that ought to
> > trigger a code introspection (other than the '.' method invocation
> > signifier). Although Parthaum, if you want to give this a go, it should
> > be easy do; the code is basically there in
> > PythonCompletionProcessor.java. Right now, "(" is listed as an
> > autocompleter, but it does the wrong thing.
> >
> > I suppose that doing as well as PyAlaMode is probably good enough for
> > this spiral, but while we're going down this path, it would be nice to
> > have a decent set of CTRL-SPACE expanders/completers as well. For
> > example, if you type in 'sysout'CTRL-SPACE in the java development
> > envt, it substitutes "System.out.println()". and even more
> > sophistication for the phrase "for" which calls up the various
> > potential expansions:
> > for - iterate over array
> > for - iterate over array with temporary variable
> > for - iterate over collection
> >
> > So what other nice expansions can we think of which are Python
> > specific? Maybe an exoander for the venerable expression:
> > if __name__ == '__main__': for one thing, maybe an expander that helps
> > with generators and co-routines for another.
> >
> > After completing this I should like to take a look at a "New Python
> > Project" Wizard, unless someone else prefers to cover that.
> >
> > It would be nice to have a sort of a Package Nanny that creates an
> > __init__.py for a package too. Ah, the fun never stops.
> >
> > I am starting to fell comfortable that we will soon be in a place wher
> > this might be my prefered editor, especially for enterprise Python
> > coding.
> >
> > So let me know if any of you have trouble with the bits I have done
> > thus far.
> > Happy coding all!
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by the new InstallShield X.
> >From Windows to Linux, servers to mobile, InstallShield X is the
> one installation-authoring solution that does it all. Learn more and
> evaluate today! http://www.installshield.com/Dev2Dev/0504
> _______________________________________________
> Pydev-code mailing list
> Pyd...@li...
> https://lists.sourceforge.net/lists/listinfo/pydev-code
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by the new InstallShield X.
> From Windows to Linux, servers to mobile, InstallShield X is the
> one installation-authoring solution that does it all. Learn more and
> evaluate today! http://www.installshield.com/Dev2Dev/0504
> _______________________________________________
> Pydev-code mailing list
> Pyd...@li...
> https://lists.sourceforge.net/lists/listinfo/pydev-code
>
-------------------------------------------------------
This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
_______________________________________________
Pydev-code mailing list
Pyd...@li...
https://lists.sourceforge.net/lists/listinfo/pydev-code
|