Sublime Forum

Suggestion for creating snippets

#1

I like the snippets feature, very handy for cutting through boilerplate code. I had a hard time getting my first snippet to work, though, because I created it it came up in a tab called “untitled”. It took me a long time to figure out that it should be saved as “newSnippet.sublime-snippet”.

May I suggest that either:

  • the tab be called “untitled.sublime-snippet” or "new
    OR
  • the sample snippet have a comment about the required file extension.

Thanks for the great editor.

0 Likes

#2

When you use the Tools > Developer > New Snippet... menu item to create a new snippet, although the tab is initially titled as untitled, when you try to save it should either apply the correct extension automatically on save (if you’re on Windows) or set the default filename to already have the sublime-snippet extension on it (MacOS/Linux).

Is that not working for you? What OS are you on?

1 Like

#3

I’m on Mac. I didn’t get the extension, but I have upgraded several times. I checked again just now with Build 3143, and got a Save As… dialog with no extension. I saved it and the file appeared in Packages/User with no extension.

0 Likes

#4

Hmm interesting… on my Mac using the same build it prompts me with the filename untitled.sublime-snippet (though offhand I don’t recall what happens if you remove the extension there).

Possibly some difference in versions of MacOS and now it handles the save dialog? I’m running an older version here, 10.10.

0 Likes

#5

I’m using 10.12.5

0 Likes