Sublime Forum

Documentation about auto_complete

#1

Hi all!

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

    { "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

0 Likes

#2

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 sublimetext.info/ I hope that helps!

0 Likes