With a sublime-completions
file like:
{
"scope": "source.yaml",
"completions": [
{
"trigger": "rule",
"contents": "Rule> $0",
"kind": "type",
"annotation": "OCIO Rule",
"details": "Insert an OCIO Rule"
}
]
}
The trigger
is the text that will be matched and replaced with the completion contents, so long as the word to the left of all of the active cursors in the file is a prefix substring of the trigger (so r
, ru
, rul
and rule
would work, but rub
would not). This also takes fuzzy filtering into account as well, so re
works because the filter has an r
and an e
in it, in that order.
The contents
is the text that gets replaced. That’s not generally placed into the popup panel because it’s arbitrarily big.
The kind
is used to provide a colorized icon/text to the left of the completion in the menu, to provide some additional hints as to what it is.
The annotation
is a piece of text that gets displayed to the right of the completion (aligned on the right edge of the popup), which gives you context hints as to what the completion is or will insert (i.e. this is here because it’s more controlled than just dumping the entire contents
out).
details
provide an extra piece of text along the bottom of the panel, to provide more detailed context, since normally you want the annotation to be a shorter piece of text or the AC panel would get to wide.
So with the above, in a YAML file typing just r
(as the shortest possible prefix substring of the completion), you see:

The prefix matching wants to match the word to the left of the cursor to an autocomplete and show you all of the possible matching completions, so:
- Summoning the AC panel manually will show you all possible completions that match the current situation, which may be more than you expect
- The completions may be displayed in an order that seems random, based on their source, heuristics, or to the settings you have applied, like
auto_complete_use_history
and auto_complete_preserve_order
for example
- As you type the trigger, or part of the trigger, the list filters; so a completion with a trigger of
long_rule_here
could be filtered down to via lr
or lrh
- The completion system wants to replace the trigger
word
with the replacement text; characters like !<
are not considered words and so would not be considered to be part of the trigger text.
If the up and down arrows don’t scroll through the AC panel, you might want to double check if any bindings are blocking it; perhaps a package has overridden a key binding in a way that’s stopping it from working.