This extension provides a collection of ES6-style code snippets for JavaScript, usable in the VS Code editor (works with both JavaScript and TypeScript).
Note
All snippets include the trailing semicolon ;. If you prefer snippets without semicolons, there’s a fork by @jmsv available here.
Sponsors
Request and run code reviews inside your IDE. Review any code (including uncommitted work), use jump-to-definition, preferred keybindings, and other IDE tools. Try it free
Installation
Open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P), type Extensions, then search for JavaScript (ES6) code snippets and install it. You can also view installed snippets from the Extensions view.
Supported file types
JavaScript (.js)
TypeScript (.ts)
JavaScript React (.jsx)
TypeScript React (.tsx)
HTML (.html)
Vue (.vue)
Snippets
Below are the available snippets and their triggers. ⇥ denotes the TAB key.
Import and export
Trigger
Content
imp→
import entire module — import fs from 'fs';
imn→
import module for side effects — import 'animate.css'
imd→
import named members — import { rename } from 'fs';
ime→
import everything as alias — import * as localAlias from 'fs';
ima→
import named member as alias — import { rename as localRename } from 'fs';
rqr→
require package — require('');
req→
require into const — const packageName = require('packageName');
mde→
module.exports default — module.exports = {};
env→
export named variable — export const nameVariable = localVariable;
enf→
export named function — export const log = (parameter) => { console.log(parameter); };
edf→
export default function — export default function fileName(parameter) { console.log(parameter); };
ecl→
export default class — export default class Calculator { };
ece→
export default class extending another — export default class Calculator extends BaseClass { };