Loading...
(function(){<br />
let canvas = document.createElement('canvas'),<br />
ctx = canvas.getContext('2d'),<br />
w = canvas.width = innerWidth,<br />
h = canvas.height = innerHeight,<br />
particles = [],<br />
properties = {<br />
bgColor : 'rgba(17, 17, 19, 1)',<br />
particleColor : 'rgba(255, 40, 40, 1)',<br />
particleRadius : 3,<br />
particleCount : 60,<br />
particleMaxVelocity : 0.5,<br />
lineLength : 150,<br />
particleLife : 6,<br />
};<br />
<br />
document.querySelector('body').appendChild(canvas);<br />
<br />
window.onresize = function() {<br />
w = canvas.width = innerWidth;<br />
h = canvas.height = innerHeight;<br />
}<br />
<br />
class Particle {<br />
constructor() {<br />
this.x = Math.random()*w;<br />Loading...
All keyboard shortcuts mentioned below are for Windows.
You can add custom snippets without installing any extensions.
Go to:
File → Preferences (Code → Preferences on macOS) → Configure User Snippets
Then create a new snippet file or edit an existing one.
Snippet files use the JSON format and can contain an unlimited number of snippets.
Example: React useReducer Snippet
1{2 "my React.useReducer snippet": {3 "prefix": "rsr",4 "isFileTemplate": true,5 "body": [6 "const initialState = {",7 " //$1",8 "}",9 "",10 "function reducer(state = initialState, action) {",11 " switch (action.type) {",12 " default:",13 " return state",14 " }",15 "}",16 "",17 "function MyComponent() {",18 " const [state, dispatch] = React.useReducer(reducer, initialState)",19 " ",20 " return <div />",21 "}"22 ]23 }24}
Where:
You can also add a description field to provide additional information about the snippet.

In the example:
1{2 "For Loop": {3 "prefix": ["for", "for-const"],4 "body": ["for (const ${2:element} of ${1:array}) {", "\t$0", "}"],5 "description": "A for loop."6 },7}
There are three placeholders: ${1:array}, ${2:element}, and $0. You can switch between them using the Tab key. The text after : is the default value.
The filling order goes in ascending order starting from 1. $0 is optional and always comes last.
You can learn more about this in the User Snippets documentation.
Documentation: https://prettier.io/
You can quickly format your code using the VS Code Prettier extension.
To configure the extension settings, go to the plugin page and open its settings.
Shortcut: Shift + Alt + F.
If you need to combine code lines into a single line.
Windows — you need to configure it.
Go to File → Preferences → Keyboard Shortcuts and enter editor.action.join in the search bar. The Join Lines command should appear.
Ctrl + Shift + [
Ctrl + Shift + ]
Ctrl + [
Ctrl + ]
All the listed options can be combined with each other.
element name + dot + class name + Enter
Example: div.container
element name + dot + Enter
Example: div.
element name + > + child element name
Example: div>p
element + * + number of elements
Example: p*2
Shift + Alt + Up Arrow
Shift + Option + Down Arrow
Ctrl + D
To select multiple occurrences of the same word, press this shortcut as many times as needed to select the required number of words.
Open the search field using Ctrl + G and enter the line number.
Ctrl + Shift + O
Ctrl + Backspace
Ctrl + Shift + Right Arrow / Left Arrow
Ctrl + X
Ctrl + Alt + Up Arrow
Ctrl + Alt + Down Arrow
F2
Ctrl + Shift + P, F1
Ctrl + P