Sublime Forum

Completion setup


I’m programming in Rust on a Linux system.

It would be nice to have a quick way to have Sublime enter text that gets repeated, thus saving me the time to type it every time I need to use it. I pulled up the Sublime manual and read through the section on Completion, but can’t seem to get it to work. No surprise, there, lol. I used the examples to create a .sublime-completions file, but then didn’t know where to save it. Finally put it in the .../.config/sublimetext/local folder and a couple other wild-guess locations. Of course, then I didn’t know how to activate it so the text would get inserted.

Any chance someone could talk me through this? Thanks.

Here’s the text I put in the .sublime-completions file:

    "scope": "elmstart",
    "completions": [

This is just (mostly) copied out of the manual and is not the text I’m needing. I’m assuming that the “elmstart” is somehow key to getting the completion to work. Am I right?



All files that can be used to customize Sublime need to be inside of a package in order to work. For users that are augmenting their own Sublime (as opposed to creating something specifically to share with others), the location you want is your User package.

You can get then by choosing Browse Packages from the Preferences menu or the Command Palette . Regardless of the OS in use or how you installed Sublime, that will make the Packages folder open in the system file browser. Inside, go inside of the User folder; that’s the folder to put things in.

That said, your file will probably not do what you want in as much as the scope you have there is not valid.

scope in Sublime (visible also in snippets, build systems, etc) tells Sublime in what type of file that the thing should take effect, with the valid items being provided by the syntax definitions that you have installed.

So, what you want to do is open up a file of the sort where you would like the completions to apply, and then choose Tools > Developer > Show Scope Name from the menu (or press the key you’ll see there.

The result is a popup that looks like this:

The Scope section at the top shows you the full and complete scope assigned to the character where the cursor is currently sitting (in this case, inside of the text Hono.

A full discussion of what scopes are and how they work can be found in this video, but in a nutshell it provides full information on the file content and structure at the point where the cursor is.

For cases like completions like you have here, what you want would be just the first line; in this example that is source.js and using it would mean that the completions are only available within JavaScript source files, but not in other places.



@OdatNurd That helped, but I still can’t get it to work. Here’s the text of the snippet I’m trying to get working:

"Struct Somestruct;

impl Sandbox for Somestruct {
    Type Message:

    fn new() -> Self {

    fn title(&self) -> String {

    fn update( &mut self, message: Self::Message) {

    fn view(&self) -> iced::Element<'_, Self::Message> {

I saved it as ~/.config/sublime-text/Packages/User/elmstart.sublime-completions

Still not showing up when I choose the Tools/Snippets menu. Sorry about being so slow to catch on to this, but if I can get it working it will save me a lot of time. Any more ideas? Thanks.



That’s not a sublime-completion file (an example of one would be the example in your first post, which has a list of words to offer for autocomplete).

This is a snippet; it belongs in a sublime-snippet file. Also, the structure is not 100% correct in that without the CDATA portion on the snippet content, Sublime will ignore the snippet.

If you want something like this, use Tools > Developer > New Snippet... from the menu, and then customize the content of that with the scope, tab trigger and comment. When you try to Save, Sublime will automatically try to put it in the right place (but double check that it make a sublime-snippet file; some OS’s ignore the hint).