Re: [Pydev-code] Autocompletion using CPython only
Brought to you by:
fabioz
From: Aleks T. <a...@to...> - 2004-08-11 23:16:04
|
Hi guys, I think I'll have to hand off the coding reins to Dana & Fabio now. I am no longer actively working on pydev, and the stuff you guys have written requires more than a glance to understand fully. Fabio has better understanding of it than I do. Where do we go from here? I'd like for some pydev release in the near future to be stable and useful enough to be called 1.0. Many of the open source projects fail to reach this stage, and users are left with something that almost works. I'd really like to leave a 1.0 behind, something that users can count on. Code completion worries me from the support standpoint. It is a marvel that it works on an untyped language. There are several gotchas that users might experience: python not in path, and issues Fabio discovered. Would you be willing to help users understand these issues better by writing something down, on the website, and/or in the docs. Also Fabio, could you jot down some docs for templates? The website, and the Eclipse docs are in the org.python.pydev.help project. >>Also, please before the final checking try to: >>- remove all the problem warnings >>- remove the System.out.printfs >> > > Done.The only warnings remaining in either of the files I checked in > are a deprecation for "The type IAutoIndentStrategy is deprecated" I > didn't implement that and I am loathe to mod that tonight, lest it > break your or Fabio's code, since I think one of you must have provided > that implementation. Looks like we can use (and extend) > IAutoEditStrategy directly. We do have 12 other warnings, but they look > like something we can fix later. IAutoIndentStategy can't be replaced right now. It is another Eclipse's gotcha. I'd love to pack up and create a release in the next few weeks. Just tell me when you think your features are ready. Cool to see the project taking off without me, Aleks Dana Moore wrote: > I forgot to check in PydevPlugin; sorry. It should compile fine now. > --- Aleks Totic <a...@to...> wrote: > > >>Hi Dana, >>I am one of those that does not have python in his system path. >>Mine is set inside .bashrc. You should use the interpreter set by >>the debugger, or implement an additional completion interpreter >>preference. My choice would be to use the debugger one, since >>that covers 99% case. There is also an interpreter verification >>routine you can use to check if interpreter is there. >> > > > Hmmm, so are you saying that "python" doesn't work from a normal > command line shell? Because if it does, then my scheme works fine. > On my linux system where I dot a .bashrc, this seems to work fine. I > have not tried on Mac OSX, but should be able to as soon as I take > delivery of my Mac. > > >>In my tree, PythonCompletionProcessor fails to compile: >> >>throw new CoreException(PydevPlugin.makeStatus(IStatus.ERROR, >> "Can't find python debug script", null)); >> > > See above comment. Should build clean now. > > >>How will autocompletion work? Will it be triggered automatically >>after every '.', or does user have to launch it? My preference is >> that user needs to act to turn it out. I am not too happy with >>the CPython solution, it is heavyweight, and the "python on path" >>problem cannot be solved nicely. >> > > Right now it's on by default and can't be turned off just like in the > Java IDE, the Semantic Web (SWeDe) IDE, IDLE for Python, JEdit, BOA > Constructor, Komodo,( others??) I _suppose_ we could turn it off, but > will anyone actually want that? > Currently, we trigger on '.' and '(' and it really looks great. > > Actually, wrt the to "python on path" point, if a user does not have > python, autocompletion will just silently not work. Further, if they do > not have python, they may not be that interested in editing Python > anyway. > As far as the weight of this solution, It runs without any perceivable > delay on my laptop, which is a a 1.8 Ghz Centrino (ecept for the built > in 500 msec built in delay) > > Hmmm, Is there actually some preferable design solution to the need to > interpret code in orde to autocomplete a runtime interpreted language? > I implemented a Jython version, and that worked less nicely than we > would have liked. Do you want to scrap this implementation too and > reinstate that one again? > > > >>Looking forward to trying it out, >> > > Yeah, it finally looks production quality :-) > > >>Aleks >> >>PS: I just came back from a family vacation, back to hacking. >> >>Dana Moore wrote: >> >> >>>Hi all >>>I just added autocompletion using a spawned CPython interpreter >> >>only >> >>>(replaces the old jython strategy). >>>The affected files are: >>> >> >>org.python.pydev\src\org\python\pydev\editor\PyEditConfiguration.java >> > org.python.pydev\src\org\python\pydev\editor\PythonCompletionProcessor.java > >>>and pretty much all the python source files. >>>org.python.pydev\PySrc\:: >>>debug.py >>>inspect.py >>>introspect.py >>>jintrospect.py >>>tipper.py >>>Let me know if something is a problem. >>>let me know if yo ulike the autocompletion style >>>It should sutocomplete on the occurence of '.' or '(' in the >> >>workbench >> >>>code >>>If there are any robustness problems. The one which I know aout >>>_potentially_ biting us is that I assume the existence of a Python >>>interpreter somewhere in the user's path, thus I don't attempt to >> >>do >> >>>full discovery of wher ethe python interpreter actually lives, >> >>rather I >> >>>simply exec the string: >>>"python <abs-path-of-org.python.pydev\PySrc>\tipper.py >>><tmp-file-containing-the-editor-content>" >>>If it doesn't exist on the user path, autocmpletion simply won't >> >>work >> >>>I plan next to do a set of CTRL-SPACE completions a la the JDT: >>>so for example, if the user types: iff <CTRL><SPACE> >>>we might emit the text (on user selection): >>>"if condition: >>> action >>>else: >>> action" |