Intellisense for the Text Editor

Hi everyone.

This addon provides intellisense basic funcionality for the text editor.

It is in early stage of development and im asking for help here to push this script to get the same funcionality as the console has.

-Added Intellisense Panel at Text Editor properties (Ctrl +F).
-Enable/disable this script from the panel.
-Added operator “test all lines” to send the text’s variables to the console.

-It reads the console environment.
Modules and variables loaded at the console will be avalaible for intellisense at the text editor.

-It only works with the bpy module.
-It doesnt recognize variables.

I dont fully understand how or works to provide intellisense, so if you do please feel free to modify this script or create one of your own and please let us know if you make any progress.


Download and installation.

I’d love to see this functionality in the text editor! The function you’re looking for is called “dir” (try: dir(bpy) in the python console). it could also scan the active line and see if it matches with the imports in the file so it can auto complete lines for all imported modules.

Since we can never know the value or even the type of a given variable in any given part of the code, we can’t know its subclasses either. consider the following:

if unknown_statement: a = bpy.context
else: a = bpy.ops

the “dir” function will give different results depending on what have happened earlier in the execution (what value “unknown_statement” has) and the true value can only be known at runtime. The console can do this since it only (well almost only) operates at runtime.

it could also scan the active line and see if it matches with the imports in the file so it can auto complete lines for all imported modules.
yes it can be a good aproach.
Ill be dealing with variables tomorrow and see how it goes.

As far as i know i think the console intellisense compiles each line so it can know what to show. For the text editor we will need a different approach.

Thanks a lot for that angle.

sorry but variables are impossible in the text editor. i was editing my post when you replied but if you read my edit it shows why

Yes you are right.

I didnt thought about what if an if or a for:
Althoght wouldnt be better if i dont do variables or do variables autocomplete wich in “some cases” arent correct?.

My first thought after reading your post was.

Theres no problem to autocomplete bpy. (that is done), but what if i have:

context = bpy.context

Ok, i can tackle this by:
1.- searching the code and look for the "context = " line closer to the line that im editing.
2.-Store whats behind the " = " (bpy.context in this case)
3.-And if belongs to a module -> perform autocomplete with that result.

As you said that is far from perfect but it can be handy at some cases.
Ill see how it goes.


Hey all.

Ive updated the script. Now it reads the console environment so any variable or module loaded at the console will be avalaible for intellisense at the text editor.

Hope you like that and if you have nay problem pls let me know.

any news for this script MacKraken ? It really looks interesting and very useful, will try it ASAP.

Hi Kilon.
Well, ive made some progress, but have been busy with a new project that im about to publish. Ill release all the updates soon, hope within a week or two.

Are planning to support the bge api too?

Could we help? Do you publish / host the addon on github?

this should be in trunk. i’ve always wanted this function.

hi ndee

Are planning to support the bge api too?

The intellisense should work on any python module that you import.

The progress ive made is:

Ive created an operator that sends lines from the text editor to the console when you press “return”. Then i capture the console and ask for variables when pressing ctrl+return.

It kinda works but when we quit blender the console is destroyed and lose all the intellisense information. Maybe i can improve this further by storing persistent data. Maybe extending bpy.types could do.

Could we help? Do you publish / host the addon on github?

All my scripts are avalaible at my web page. You can get them there.
Of course you can help, if you get further than i did with this, please share your changes.

The one in your signature?
Ok will add a repo on github soon.

Omg that would be awesome!
I’m sick of having to switch between text editior, eclipse and pydev and blender text editor.
I don’t have enough free time to help unfortunatly but thank you for trying to do something! (however I need to be able to restart blender and keep the intelisense working of course :/)

Is added:

Hm why not open intellisense when pressong DOT / . like it does in many IDEs? And ( / [ …?

@Mackraken, why isn’t your addon in contrib / testing?

Id be happy to help get some slightly nicer autocomp setup working (menu is a bit shoddy), and help a bit with the addon.

Hi ideas

glad you are interested in this matter.

The problem isnt the autocomp since im using the existing one and it works well. The thing is read or identify variables types on a script.

The trick im using is sending lines to the console when u press return, and once they are in memory i can ask for them. But when u close blender all that data is gone.

I thought about compile a frame and ask there. Or maybe research how other software like eclipse implements this function.

Ive sent a commit to svn of what ive got so far. Very poor yet but i hope this can be improved somehow.

odd so this is in SVN?, all I can see under ‘Text Editor’ section is ‘PasteAll’ addon.

regarding autocomplete methods - Im not really impressed with any smart python autocomplete.

Suggest to use simple dictionary style autocomplete,
(Autocomplete based on any words you used previous in the document). this is what scite does and IMHO works really well.

Its very common and frustrating when a smart py autocomplete wont work and you have to manually copy/paste.

The only exception where smart autocomplete is nice is with imports:
from blah import …

Hi,to makes script work it’s necessary to substitute the original ??