Sublime Forum

Auto-complete questions

#1

howdy folks,

long time user of sublime, first time posting a question. so hello

im currently in the middle of making a auto-complete for a openFrameworks add-on called ofxLua. it allows you to use Lua within openframeworks, its awesome, really nice. only problem is that it does not have any auto complete for when you take it into say sublime to code in. so i have been busy making one HERE
and whilst its ok and does an alright job, im looking to really weed out some problems now rather than later and get some questions answered to help with it.
currently, its just a massive table. as said, it works, but it too much i feel.

what i would like, is rather than copying and typing the changes from the documentation, i would like to see if i can access the openframeworks directory and it auto-changes for me using some lines of code.
so say that to make a circle is this ‘ofCircle’, in ofxLua in sublime its this ‘of.circle’. but so far what i am doing is copying and changing each function like that. it works, but it takes way too much time. how could i instead, read the openframeworks directory and just code in so that when i choose functions, it changes them automatically too the revised ofxLua version of ‘of.whatever’?

another question is using the dot operator. in lua, to use that its actually a ‘:’, but id like to try and get a dot operator going, so that when i want to load an image or whatever i could type in say ‘image:’ and after the ‘:’ has been put in it comes up with the relevent info needed for that object. much like any IDE really, it has this lovely type of auto-complete

just a few questions to ask to get me started :wink:
thanks to anyone who can help

lewis lepton

0 Likes

#2

If you want to have a kind of dynamic auto-completion you need to use plugin in which you define a function on_query_completion : you can have alook at the unofficial doc here.
You can also have a look at what I did in my plugin(certainly not the cleanest implementation, but it works :stuck_out_tongue:).

To be able to have autocompletion working after some special symbol, you need to add it in the “autocomplete_triggers” settings (inside a .sublime-settings file) with somethinge like :

{ "auto_complete_triggers": {"selector": "source.lua - string - comment - constant", "characters": ":"} ] }

0 Likes

#3

oooh thanks ill have a look-see

many thanks

0 Likes

#4

Here’s another reference:
github.com/SublimeText/AAAPacka … #L396-L510
github.com/SublimeText/AAAPacka … ngs#L5-L10

0 Likes

#5

[quote=“Clams”]If you want to have a kind of dynamic auto-completion you need to use plugin in which you define a function on_query_completion : you can have alook at the unofficial doc here.
You can also have a look at what I did in my plugin(certainly not the cleanest implementation, but it works :stuck_out_tongue:).

To be able to have autocompletion working after some special symbol, you need to add it in the “autocomplete_triggers” settings (inside a .sublime-settings file) with somethinge like :

{ "auto_complete_triggers": {"selector": "source.lua - string - comment - constant", "characters": ":"} ] }[/quote]

just to ask a bit further does this have to be done with everything. or can i set it, then just make sure say my arguments or my dot operator functions have the right setup. just to ask. just complete a hacky auto-complete for something and dot operator funcion would be great. just dont knw where to start.

again, thanks for the help

0 Likes

#6

i guess its called smart auto-complete? or im just spouting words :wink:

0 Likes

#7

if you do have a small example that explains this, then i would be grateful. ill also pan through the links you both gave me :wink:

thanks

0 Likes

#8

The topic in the docs, which Clams linked (this one) has a link to a small example: sublime-text-unofficial-document … ns-example

0 Likes

#9

awesome, thanks a bunch. ill be getting on this :wink:

0 Likes