Hi all,
It’s my first day using Sublime. After simple test, I could not find this function: for a newly created document, BEFORE saving, Sublime seems to be not able to remember variables I’ve inputed, thus can not autocomplete.
Am I wrong? Any plugin to fix this?
Untitled document, variables autocompletion?
Did you set the language of the document? Without saving, it defaults to plain text.
A new document without any syntax set defaults to plain text (check the bottom right corner of the window). Autocomplete still works in that kind of file (after a fashion), but it may not operate the way you expect:
Here it’s autocompleting between simple
and sample
when I press Tab, but you don’t get the popup that you might expect.
To get that kind of thing, you need to have a syntax set for the file first:
Notice that after I set the syntax to TypeScript, the same Tab keypress shows you the possible completions. Here I’m also getting snippets for TypeScript that happen to start with s
.
You don’t have to save the file to set a syntax. Here I used the Command Palette (Shift+Ctrl+P on Win/Linux and Shift+⌘+P on Mac) but you can also do this via the menu by picking a syntax from View > Syntax
as well.
Arguably saving the file is easier if you happen to be working with text you actually want to persist, though.
Thanks for fast reponse, guys.
“TAB” is good enough for me.
And, setting random syntax trick is wonderful, too.
~cheers