Sublime Forum

New User New Coder Sublime Text 3 - Why doesn't auto fill work when starting a new project

#1

For the life of me I can not auto complete to work in a new document.

0 Likes

#2

A potential issue you may be running into is that language specific features such as auto completion, snippets and so on are based on the type of file that you’re editing. Your file has no extension, so Sublime considered it plain text (you can see the current file type in the bottom right of the window). Based on the content of the file I’m assuming you wanted it to be HTML, but the following applies to all language types if you use the correct syntax and file extension.

In order to fix that kind of issue you need to give the appropriate extension to your file name, such as Lorenzo Zo! Ferguson.html so that Sublime knows it’s HTML. This is also important if you want some external application to know what type your file is. A web browser won’t treat an extension-less file as HTML, for example.

For a newly created file that hasn’t been saved yet, you can also set the syntax manually to get things going before you save the file:

  • Click the name of the file type (i.e. Plain Text in the bottom right of the window) to open up a menu that lets you select the file type
  • The same menu is available under View > Syntax in the main menu
  • Open the command palette and select e.g. Set Syntax: HTML to pick the HTML language; there is such an entry for each syntax. A shortcut is to enter setsyn: followed by part of the name of the language in order to quickly filter the list.
1 Like

#3

Thank you. I chose the first option. Somewhere I read that sublime text 3 will put in automatically the basic standard text needed for any html document.

I’m going crazy over here. I’ve used Sublime Text 3 before and when I right clicked on the screen, after saving, I could view in browser. For some reason I don’t see that as an option anymore.

0 Likes

#4

Yes, this is one of the things that I mentioned above; there is a snippet named html that does this, but it only triggers if the file is an HTML file. In this example after setting the syntax I typed html and pressed Tab, which expands out to a simple document template:

That option is only presented in the context menu for files with an extension of .html, .HTML, .HTM or .htm. In your example above your file has no extension, so Sublime doesn’t think it’s an HTML file and doesn’t provide the option.

That’s because your browser will assume it’s plain text for not having an extension, so even if it did load in the browser you’d just see the HTML tags and not the proper rendered output.

0 Likes

#5

With Sublime Text plugin Default File Type you can set the default syntax when opening new files. It may save a few keystrokes to set the syntax as @OdatNurd explained. On the other hand, getting used to common commands such as using the Command Palette or Goto Anything helps you to use your editor more efficiently.

0 Likes