Sublime Forum

Unusable Javascript Object Literal Auto Complete

#1

When entering Javascript object literals, I want to align the keys, colons and values like so:

key          :          value
key1         :          value

When using Sublime 2 (even with auto_complete set to false), I can enter the key and the colon, but then when I tab, ST2 removes the tab and replaces it with:

key          key: "value",

Is there any way to disable this. It creates so much work that I have to switch to another editor to enter the object literals.

0 Likes

#2

This behavior is caused by a standard snippet:

\Sublime Text 2\Packages\JavaScript\Object-key-key-value.sublime-snippet

when you hit TAB after the colon, ST2 trigger this snippet.

Your solutions:

  • After the colon press shift+TAB to insert a literal TAB and not trigger the snippet.
  • Use the snippet: just type colon and TAB without the “key” and complete the snippet.
  • I don’t think there’s a way to disable a snippet, you have to delete the file but remember that next ST2 update will probably create it back.
0 Likes

#3

Thanks for the answer. I’ll play with it.

0 Likes

#4

I finally disabled this by changing the snippet file extension.

0 Likes