JavaScript Snippets for VS Code
This extension contains code snippets for JavaScript in ES6 syntax for VS Code editor.
Insert console.log()
Keyboard Shortcut:
- Down:
Ctrl + Cmd + L
- Up:
Shift + Ctrl + Cmd + L
Output:
console.log('JSS log[ FILENAME] VARIABLE:', VARIABLE) // selection
console.log('JSS log[ FILENAME] :') // without selection
Snippets
Below is a list of all available snippets and the triggers of each one. Remember to use Tab key.
Note
- Excluding VS Code built-in snippets.
- Excluding the final semicolon
; .
- Use single quotes(
'' ) instead of double quotes("" ).
Common
Trigger |
Content |
func |
function name() {} |
af |
() => {} |
iife |
;(() => {})() |
sort |
sort((a, b) => a - b) |
assign |
Object.assign() |
pt/prototype |
Class.prototype.method = function () {} |
rep/retp |
return new Promise(() => {}) |
exp |
export member |
expa |
export * from Module |
expd |
export default member |
expf |
export function name(args) {} |
expaf |
export const name = () => {} |
imp |
import * from Module |
mod |
module.exports = * |
req |
require(Module) |
setim |
setImmediate(() => {}) |
typeof |
typeof source |
instanceof |
instanceof Object |
call |
Object.prototype.toString.call() |
nextt |
nextTick() |
proc |
process |
us |
'use strict' |
dir |
console.dir() |
React
Trigger |
Content |
usest |
const [state, setState] = useState() |
usee |
useEffect(() => {}, []) |
usec |
const value = useContext() |
usecb |
const memoizedCallback = useCallback(() => {}, []) |
usem |
const memoizedValue = useMemo(() => {}, []) |
user |
const refContainer = useRef() |
useih |
useImperativeHandle(ref, createHandle) |
useid |
const id = useId() |
usele |
useLayoutEffect(() => {}, []) |
userd |
const [state, dispatch] = useReducer() |
usedv |
useDebugValue() |
License
MIT
| |