Download this extension from the VS Gallery or get the nightly build.
A snippet pack to make you more productive working with JavaScript. Based on the Atom snippets.
This extension ships a bunch of useful code snippets for the JavaScript editor. Get an overview from the Code Snippet Manager in Visual Studio located under the Tools top level menu.
Here's the full list of all the snippets:
console.dir(${1:obj});
console.error($end$);
console.info($end$);
console.log($end$);
console.warn($end$);
debugger;
$document$.addEventListener('$event$', function(e) {
$end$
});
$document$.appendChild($elem$);
$document$.removeChild($elem$);
$document$.createElement($elem$);
$document$.createDocumentFragment($elem$);
$document$.classList.add('$class$');
$document$.classList.toggle('$class$');
$document$.classList.remove('$class$');
$document$.getElementById('$id$');
$document$.getElementsByClassName('$class$');
$document$.getElementsByTagName('$tag$');
$document$.getAttribute('$attr$');
$document$.setAttribute('$attr$', $value$);
$document$.removeAttribute('$attr$');
$document$.innerHTML = '$elem$';
$document$.textContent = '$content$';
$document$.querySelector('$selector$');
$document$.querySelectorAll('$selector$');
$myArray$.forEach(function($item$) {
$end$
});
function($arguments$) {
$end$
}
$object$.prototype.$methodName$ = function($arguments$) {
$end$
}
$methodName$.call($context$, $arguments$)
$methodName$.apply($context$, [$arguments$])
$functionName$: function($arguments$) {
$end$
}
JSON.parse($object$);
JSON.stringify($object$);
setInterval(function() {
$end$
}, $delay$);
setTimeout(function() {
$end$
}, $delay$);
'use strict';
alert('$message$');
confirm('$message$');
prompt('$message$');