Home Download Buy Blog Forum Support

Documentation about auto_complete

Documentation about auto_complete

Postby bblue on Sun Oct 16, 2011 10:31 pm

Hi all!

In spadgos' package JSDocs there is the following key binding:

Code: Select all
    { "keys": ["@"], "command": "auto_complete", "context":
        [
            { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
            { "key": "preceding_text", "operator": "regex_contains", "operand": "^\\s*(?:\\*|\\/\\*{2})\\s+$", "match_all": true },
            { "key": "selector", "operator" : "equal", "operand" : "comment.block.documentation"}
        ]
    }


As far as I can understand (I'm actually new to ST2 and not a Python expert…) it invokes the "auto_complete" command, passing it some arguments (is it the right term?): selection_empty, preceding_text, selector.

Now:
1. Where is defined the command auto_complete?
2. How may I know its syntax?
3. (a specialised version of question 2) How it uses the its arguments?

Please, help me if you can. I'm getting lost with ST2, for the lack of documentation, but I'd really want to find my way with it.

TIA
--
bblue
bblue
 
Posts: 26
Joined: Mon Oct 10, 2011 10:35 am

Re: Documentation about auto_complete

Postby spadgos on Mon Oct 31, 2011 1:29 pm

Hi bblue,

I'm also pretty new to this whole thing, so I won't pretend to know definitive answers. Anyway, those lines in the "context" block are actually preconditions. That is:

When "@" is pressed, run the command "auto_complete" if
1. there is no text selection
2. the text on this line preceding the cursor matches that regex
3. the current selector is a documentation comment block

I figured out most of what I know from looking at the other packages bundles with ST, and by looking at the (unofficial) documentation on http://sublimetext.info/ I hope that helps!
spadgos
 
Posts: 121
Joined: Thu Oct 06, 2011 12:49 am


Return to Technical Support

Who is online

Users browsing this forum: Yahoo [Bot] and 24 guests