[Addon] Auto Completion in Blenders Text Editor

This is the official thread for the Code Autocomplete addon.

You can buy it in the BlenderMarket but it is also freely available on github.
Buying the addon entitles you to better support when you have questions and helps to ensure that I can continue working on my addons!

BlenderMarket: https://cgcookiemarkets.com/blender/all-products/code-autocomplete/

Source Code: https://github.com/JacquesLucke/code_autocomplete

Documentation: http://code-autocomplete-manual.readthedocs.org/en/latest/index.html

Here are some videos which show different states of development: https://www.youtube.com/watch?v=SOHDpTfdQ6E&index=1&list=PLFSQhJg6cGLKp4eHEMMOu-HxkWj8C-bAK

[I removed the original first post]

This is nice !


I hope I can make it much easier to make custom panels, operators, menus, … without having to remember all those small code snippets which are always the same.

I have this error when activating the Adoon.

Ahh I tested this on another computer and found the reason for this error.

Can you maybe remove “-master” from the name of the folder you copied in the addon directory?
This should help.

I will try to find a way around that

I’ts working without the -master ^^

ok. perfect.
Now it should work without renaming the folder :slight_smile: thanks for the report

Ho la la I don’t know what to say! Amazing I wait for it a long time ago…
Very good Jacques, I applaud with both hands, Congratulations.

Awesome! I saw the video you released yesterday and I’ve been waiting to be able to test it out.

Is this like a continuous mode? Maybe there should be the option to use CTRL spacebar or TAB to mimic the python console or the terminal (linux)?

what do you mean with continuos mode?

I don’t know how I can mimic the console.

At first I will clean the code up now and make it more extendable. Then I plan to implement more of those small code templates and some better word suggestions after words like ‘context’, ‘data’, etc.

The addon has much better suggestions now, but see yourself :slight_smile:

This isn’t in master yet but will be soon. See how much faster you can write your own tools with Auto-Completion! :slight_smile:

This is fantastic! I won’t comment too much, since I’m one of the contest judges, but I would just like to say that this is a great example of improving workflows with add-ons!

Yes, this is really great !

Lapineige has made some great code for the text editor to comment easilly, maybe you can add something like that.

import bpy
from re import search
from bpy.types import Menu

def changeText(self,context):
    bpy.context.space_data.text = bpy.data.texts[bpy.context.scene.tmp_text]
bpy.types.Scene.tmp_text = bpy.props.EnumProperty(items = [(txt.name,txt.name,'','',bpy.data.texts.find(txt.name)) for txt in bpy.data.texts], update=changeText)

class TextEditorPie(Menu):
    # label is displayed at the center of the pie menu.
    bl_label = "Text Editor Pie"
    bl_idname = "text.text_editor_pie"
    def poll(cls, context):
        return context.space_data.type == 'TEXT_EDITOR'
    def draw(self, context):
        layout = self.layout

        pie = layout.menu_pie()
        pie.operator('text.better_indent',icon='FORWARD', text='Indent')
        pie.prop(context.space_data, 'show_word_wrap', text='Wrap')
        pie.operator('text.better_uncomment',icon='VISIBLE_IPO_OFF', text='Uncomment')
        pie.operator('text.better_comment',icon='VISIBLE_IPO_OFF', text='Comment')
        pie.menu(menu='text.text_list_menu', text='Choose Text')
class TextsList(bpy.types.Menu):
    bl_label = "Texts List"
    bl_idname = "text.text_list_menu"   
    def draw(self, context):
        layout = self.layout

class BetterComment(bpy.types.Operator):
    """  """
    bl_idname = "text.better_comment"
    bl_label = "Better Comment"

    def execute(self, context):
        base = context.space_data.text.current_line.body
        if context.space_data.text.current_line.body == base:
            context.space_data.text.current_line.body = '#' + context.space_data.text.current_line.body
        return {'FINISHED'}

class BetterUnComment(bpy.types.Operator):
    """  """
    bl_idname = "text.better_uncomment"
    bl_label = "Better Uncomment"

    def execute(self, context):
        base = context.space_data.text.current_line.body
        if '#' in base:
            if context.space_data.text.current_line.body == base and search(r'[^#]', base).start() > base.index('#'):
                context.space_data.text.current_line.body = base[search(r'[^#]', base).start():]
        return {'FINISHED'}

class BetterIndent(bpy.types.Operator):
    """  """
    bl_idname = "text.better_indent"
    bl_label = "Better Indent"

    def execute(self, context):
        base = context.space_data.text.current_line.body
        if search(r'[^ ]', context.space_data.text.current_line.body).start() == search(r'[^ ]', base).start():
            context.space_data.text.current_line.body = ' '*context.space_data.tab_width + base
        return {'FINISHED'}

def register():

def unregister():

if __name__ == "__main__":


Thanks Jonathan. Its really motivating to hear that from you :slight_smile:

@pitiwazou: thanks for that code. I will see what I can do with that, but my main focus is auto completion atm.

Today I worked on a cool class that allows high level access to Blenders python api directly in Blender.

Here is what is possible so far:

Oh may, that just became even better!

Have you considered doing this as a Sublime Text add-on?

Otherwise it wouldn’t make sense a guess :smiley:

not really. I never worked with Sublime. Also the addon reads the api in Blender on the fly. This isn’t an extra file. So I think it would be harder to implement this in another application
[Edit]ok, exporting all api data shouldn’t be very hard…[/Edit]


This last update is really great and usefull !

This is insanely cool, it even looks more solid than the autocomplete in some IDEs :P.
The text editor really needed some love, great work!

WOuoww yes ! This is really impressive ! Thanks for this :slight_smile: