Skip to main content

All vscode Snippets

caution

To use a Snippet, press Ctrl + Space, type the first (or any other) letters of the required snippet prefix and select the appropriate command from the pop-up context menu.

Snippets List

Snippet PrefixUsageDescriptionResult
1Anchor-from-ClipboardarcAnchor to a link from the clipboard (Copy link > activate snippet)habr.com
2Anchor-from-Clipboard2arc2see 1 + add highlighted text between <a> tagsquiz
3Anchor-from-Clipboard3arc3see 1 -> <a>link: highlighted text</a>habr.com: quiz
3Anchor-from-Clipboard4arc4see 1 -> <a>highlighted text (link)</a>quiz (habr.com)
4Tabs-from-Clipboardtabstype two keywords with one space between them: JSX React > cut this text > activate snippetsee here or React Complete Guide: 3.12 Working with Props
5import ReactPrint first import lineimport React from 'react'
6full React componentAutomatically names a React component with a file namePrint the entire blank of a React componentsee Full React Component below
7Comment blockseInsert depending on language comment blocksee Comment Block below
8Print to consoleconsole"console.log('$1');" + next line "$2"
9Print ReactDOM containercontainer
10Import ReactImport Reactimport React from 'react'
11functional React componentfunc React component
11functional React component2func React component2
13classes cssclasses cssclassName={classes.$1}$0
14axios importaxios importimport axios from 'axios'
15classes importclasses importimport classes from './$1.module.css'$0
16prettier_ignorepri<!-- prettier-ignore -->
17prettier_ignore commentprc<!-- prettier-ignore-start --> $SELECTED_TEXT <!-- prettier-ignore-end -->
18Auto FrontmatterDocusaurus-id
19Clickable imageSelect Header (words only), press Ctrl + Space, select 'Clickable image' in the menu without entering any text-> clickable md image will be belowwith [![](.png)](.png) pattern
20Insert Code Blockcode_shellAdd md code block with shell type```shell ```

Keyboard Shortcuts

Some snippets (with shortcuts) are located on the keyboard shortcuts page.

Snippets Results

full React component

Snippet with three tabstops using the filename.

import React from 'react'

const userOutput = () => {return ()}

export default userOutput
  • Automatically names a React component with a file name
  • Print the entire blank of a React component
  • 3 tabs stops:
    • 1: if you want to rename a component
    • 2: if you want to remove the return keyword
    • 3: if you want to add JSX code

Comment block

Snippet with 2 vars. Source: stackoverflow.com: VS-Code Variables In Custom Snippet

<!-- First start -->
Second
<!--First end -->

Working with Snippets

Using a Snippet

For example, to activate Anchor-from-Clipboard snippet, you type arc, press Ctrl + Space and choose Anchor-from-Clipboard from context menu (for this snippet to work correctly, you first need to copy the embed link).

How to Make a Snippet

Anchor from Clipboard

Source