Completions come from a few places:
- Words that exist in the buffer already
-
sublime-completions files that have predefined lists of trigger words and what they expand to
- plugins that respond to the
on_query_completions event to inject completions (which can theoretically come from anywhere)
In addition there are snippets, but that’s more of a heavyweight thing for injecting full snippets of source code; they’re pretty functionally similar to sublime-completions but a completions file can have many completions in it while sublime-snippet file is a on-off. Typically you would use a sublime-snippet to inject something like a for loop body while you’d use a sublime-completions to provide lists of common functions.
In any case, generally speaking auto-completion popups are usually only sourced from the buffer unless you’ve done something like installed a completions package (or created a file of them yourself) or installed a plugin that does it for you.
The most robust way to do this from a user perspective is the plugin route because it has the power to do complex operations behind the scenes like examine your code to know that bob is a class of a particular type and thus has particular methods, whereas without a plugin completions are provided based on scope and not context.