You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To install a Visual Studio Extension you can run Command Pallete using the command Cmd + Shift + P or Ctrl + Shift + P, type Install Extensions and finally give an Enter, done this search by Daniel Toro and you will find the Daniel Toro Snippets extension.
Search command
You can search through snippets with Snippet Search command which can be run with cmd + Shift + p or just use cmd + shift + r (ctrl + alt + r for Windows & Linux) keybinding.
Supported languages (file extensions)
JavaScript (.js)
JavaScript React (.jsx)
TypeScript (.ts)
TypeScript React (.tsx)
Snippets info
Next below a list with of all available Snippets and triggers for each one. Or → means key tab.
TypeScript has own components and own snippets. Use search or just type ts before every component snippet.
I.E. tsrcc
Basics ES7
Imports
Trigger
Content
Description
imp →
import moduleName from 'module'
Import a module named
imn →
import 'module'
Import a module
imd →
import { destructuredModule } from 'module'
Import destructured module
ime →
import * as alias from 'module'
Import all as an alias
ima →
import { originalName as aliasName} from 'module'
Import destructured modules as an alias
Exports
Trigger
Content
Description
exp →
export default moduleName
Export default a module
exd →
export { destructuredModule } from 'module'
Export a module by destructuring
exa →
export { originalName as aliasName} from 'module'
Export module by destructuring as an alias
enf →
export const functionName = (params) => { }
Export named function in ES7 syntax
edf →
export default (params) => { }
Export default function in ES7 syntax
Basic Methods
Trigger
Method
Description
met →
methodName = (params) => { }
Creates a method inside a class in ES7 syntax
fre →
arrayName.forEach(element => { }
Creates a forEach statement in ES7 syntax
fof →
for(let itemName of objectName { }
Iterating over property names of iterable objects
fin →
for(let itemName in objectName { }
Iterating over property values of iterable objects
anfn →
(params) => { }
Creates an anonymous function in ES7 syntax
nfn →
const functionName = (params) => { }
Creates a named function in ES7 syntax
dob →
const {propName} = objectToDescruct
Creates and assigns a local variable using object destructing
dar →
const [propName] = arrayToDescruct
Creates and assigns a local variable using array destructing
sti →
setInterval(() => { }, intervalTime
Executes the given function at specified intervals in ES7 syntax
sto →
setTimeout(() => { }, delayTime
Executes the given function after the specified delay in ES7 syntax
prom →
return new Promise((resolve, reject) => { }
Creates and returns a new Promise in the standard ES7 syntax
cp →
const { } = this.props
Creates and assigns a local variable using props destructing
cs →
const { } = this.state
Creates and assigns a local variable using state destructing
pge →
get {propertyName}() { }
Creates a getter property inside a class in ES7 syntax
pse →
set {propertyName}(value) { }
Creates a setter property inside a class in ES7 syntax
Basics Typescript
Trigger
Method
Description
expint →
export interface interfaceName { }
Creates an interface on Typescript
exptp →
export type typeName = { }
Creates a type on Typescript
Console
Trigger
Method
Description
cas →
console.assert(expression,object)
If the specified expression is false, the message is written to the console along with a stack trace
ccl →
console.clear()
Clears the console
cco →
console.count(label)
Writes the the number of times that count() has been invoked at the same line and with the same label
cdi →
console.dir
Prints a JavaScript representation of the specified object
cer →
console.error(object)
Displays a message in the console and also includes a stack trace from where the method was called
cgr →
console.group(label)
Groups and indents all following output by an additional level, until console.groupEnd() is called
cge →
console.groupEnd()
Closes out the corresponding console.group()
ctr →
console.trace(object)
Prints a stack trace from the point where the method was called
ctm →
console.time("timeId")
Console time wrapper
cte →
console.timeEnd("timeId")
Console time end wrapper
cwa →
console.warn
Displays a message in the console but also displays a yellow warning icon along with the logged message
cin →
console.info
Displays a message in the console but also displays a blue information icon along with the logged message
clg →
console.log(object)
Displays a message in the console
clo →
console.log(object)
Logs property with name
clb →
console.log('------- Start object -------')
Displays a message in the console inside a block
console.log(object)
console.log('------- End object -------')
React
Basics
Trigger
Method
imr →
import React from 'react'
imrd →
import ReactDOM from 'react-dom'
imrc →
import React, { Component } from 'react'
imrcp →
import React, { Component } from 'react' & import PropTypes from 'prop-types'
imrpc →
import React, { PureComponent } from 'react'
imrpcp →
import React, { PureComponent } from 'react' & import PropTypes from 'prop-types'
imrm →
import React, { memo } from 'react'
imrmp →
import React, { memo } from 'react' & import PropTypes from 'prop-types'
imrs →
import React, { useState } from 'react'
imrse →
import React, { useState, useEffect } from 'react'
impt →
import PropTypes from 'prop-types'
imrr →
import { BrowserRouter as Router, Route, NavLink} from 'react-router-dom'
imbr →
import { BrowserRouter as Router} from 'react-router-dom'
imbrc →
import { Route, Switch, NavLink, Link } from react-router-dom'