This repository contains a collection of my personal custom Visual Studio Code snippets designed to improve the productivity of developers. These snippets help you quickly generate common code patterns, allowing you to focus on writing the unique parts of your code.
To install these snippets, follow these steps:
- Clone this repository to your local machine.
- Open Visual Studio Code.
- Go to File > Preferences > User Snippets.
- Click on the desired language (e.g., javascript.json for JavaScript) or create a new global snippets file.
- Copy the contents of the snippet file(s) from this repository and paste them into the appropriate user snippets file in Visual Studio Code.
- Save the file.
The snippets are now installed and ready to use.
To use a snippet, follow these steps:
Open a file in Visual Studio Code with a supported language. Type the snippet's prefix and press Enter or Tab. The snippet will be inserted into your code, and you can navigate between tab stops using Tab and Shift+Tab. Replace the placeholders with the desired values
A list of the available snippets and their descriptions:
- Print to console
- Prefix:
clg
- Description: Logs a value to the console
- Prefix:
- Print error
- Prefix:
cler
- Description: Logs an error to the console
- Prefix:
- Fast arrow
- Prefix:
fa
- Description: Creates an arrow function
- Prefix:
- Fast return arrow
- Prefix:
far
- Description: Creates an arrow function with an immediate return
- Prefix:
- Fast handler
- Prefix:
han
- Description: Creates an event handler arrow function
- Prefix:
- Ternary operator
- Prefix:
ter
- Description: Inserts a ternary operator expression
- Prefix:
- String interpolation
- Prefix:
si
- Description: Inserts a template literal expression
- Prefix:
- Export default component
- Prefix:
exd
- Description: Exports a default component from a file
- Prefix:
- Export default layout component
- Prefix:
exdl
- Description: Exports a default layout component from a file
- Prefix:
- Export default hook component
- Prefix:
exdh
- Description: Exports a default hook component from a file
- Prefix:
- Export default nested component
- Prefix:
exdne
- Description: Exports a default nested component from a file
- Prefix:
- useEffect
- Prefix:
effect
- Description: Inserts a React useEffect hook
- Prefix:
- useState
- Prefix:
state
- Description: Inserts a React useState hook
- Prefix:
- React div with class name
- Prefix:
ddiv
- Description: Inserts a React
div
element with a class name
- Prefix:
- Component: default
- Prefix:
rfd
- Description: Creates a React default functional component
- Prefix:
- Component: arrow
- Prefix:
rfa
- Description: Creates a React arrow functional component
- Prefix:
- Component: arrow, props
- Prefix:
rfap
- Description: Creates a React arrow functional component with props
- Prefix:
- Component: arrow, type, props
- Prefix:
rfatp
- Description: Creates a React arrow functional component with type and props (TypeScript)
- Prefix:
- Get async
- Prefix:
getasync
- Description: Creates an async function to get something with a loading state
- Prefix:
- Fast scss start
- Prefix:
impst
- Description: Imports main styles and adds a container class in SCSS
- Prefix: