Atom JavaScript Snippet
⚛ Atom JavaScript Snippet for Visual Studio Code
The extension that provide Atom JavaScript snippets for using in Visual Studio Code.
This snippet is based on atom/language-javascript.
Recommended configurations
To keep snippets to show on the top of suggestions for easy using, use this configuration.
{
"editor.snippetSuggestions": "top"
}
Snippets
[kf
] Object Method
methodName: function (attribute) {
},
[kv
] Object key — key: "value"
key: 'value',
[proto
] Prototype
ClassName.prototype.methodName = function () {
};
[do
] do
do {
} while (true);
[tern
] condition ? true : false
condition ? true : false
[if
] if
if (true) {
}
[ife
] if … else
if (true) {
} else {
}
[else
] else
else {
}
[elseif
] else if
else if (true) {
}
[for
] for
for (var i = 0; i < array.length; i++) {
array[i]
}
[forin
] for in
for (var variable in object) {
if (object.hasOwnProperty(variable)) {
}
}
[forof
] for of
for (variable of iterable) {
}
[fun
] Function
function functionName() {
}
[f
] Anonymous Function
function () {
}
[af
] Arrow Function
() => {
}
[gen
] Generator
function* functionName() {
}
[g
] Anonymous Generator
function* () {
}
[get
] getElementsByClassName
getElementsByClassName('className')
[getn
] getElementsByName
getElementsByName('name')
[gett
] getElementsByTagName
getElementsByTagName('tagName')
[geti
] getElementById
getElementById('id')
[qs
] querySelector
querySelector('query')
[qsa
] querySelectorAll
querySelectorAll('query')
(function() {
'use strict';
}());
[log
] log
console.log();
[warn
] warn
console.warn();
[error
] error
console.error();
[inspect
] inspect
console.log(require('util').inspect(, { depth: null }));
[prom
] new Promise
new Promise(function(resolve, reject) {
});
[interval
] setInterval function
setInterval(function () {
}, 10);
[timeout
] setTimeout function
setTimeout(function () {
}, 10);
[switch
] switch
switch (expression) {
case expression:
break;
default:
}
[case
] case
case expression:
break;
[try
] try
try {
} catch (e) {
} finally {
}
[while
] while
while (true) {
}
[/**
] Start Docblock
/**
*
*/
[req
] CommonJS require
const module = require('module');
[class
] Class
class ClassName {
constructor() {
}
}
[expfun
] export function
exports.functionName = function () {
// body...
};
[expmod
] export module
module.exports = name;
[ret
] return
return ;