How to customize Sublime Text default Auto-complete

I use Sublime text 3 everyday, especially the JavaScript autocomplete feature.

For the if-statement, the default completion popup has an unnecessary semicolon at the end.

if (true) {};

Using JSHint, it gives me an error for most of the code I written.

It is counterproductive to manually delete it everytime.

Here is a solution for this problem:

  1. Go to Preferences Browse Packages to open the Sublime Text Folder.
  2. Find the folder called JavaScript (if it doesn’t exist, create one).
  3. In the folder, open if.sublime-snippet (if it doesn’t exist, create one)
  4. Delete the semi-colon so your snippet now looks like this:
<snippet> <content><![CDATA[if (${1:true}) {${0:$TM_SELECTED_TEXT}}]]></content> <tabTrigger>if</tabTrigger> <scope>source.js</scope> <description>if</description> </snippet>

Originally published at victorleungtw.com on November 25, 2014.

By Victor Leung

Experience in software development, consulting services and technical product management. Understanding of business and technology with an MBA in Finance and a Master degree in Computer Science. AWS Certified Solution Architect with experience in building products from scratch and serving as a charismatic leader.

Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.