[Bf-committers] Text Editor - Auto Complete

Campbell Barton ideasman42 at gmail.com
Fri Dec 10 02:50:07 CET 2010


On Fri, Dec 10, 2010 at 1:17 AM, Justin Dailey <dail8859 at yahoo.com> wrote:
> Campbell,I see what your saying about the "dictionary" based approach -- suggest variables, functions, ect from the file itself. But what about also using something similar to the console space...thus if you type "bpy." and ask for auto complete it will give the options "app, data, ..." or in other cases give documentation for the function/method. Honestly this helped me out extremely learning scripting in 2.4x, I'm not for sure how others feel about this, but I think this would be a very handy feature to be included in the text editor. (But who am I to argue, :-P )
> Thanks  again,Justin Dailey

The main difference between console and text editor is the console is
a python interpreter with a persistent namespace, and the text editor
isn't.
So the variables being auto-completed don't actually exist as Python
objects. The 'ast' module can be used to get a parse tree but this
still wont know about blender internal data.

As you point out imports can be auto-completed because mostly they are
already loaded, or can be scanned for without executing them.

But for my own use this isn't all that big an advantage, since imports
are normally a few lines at the top compared to the script size.

So if you like to get 2.4x autocomp working its ok to add back, but
I'd also accept dictionary based autocomp which is probably less work.
Either way, dictionary method could be added as a fallback if people
really want or they can just use external editors.

-- 
- Campbell


More information about the Bf-committers mailing list