Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork1
VS Code Const & Props snippets for JS and TS
License
deinsoftware/vscode-const-props-snippets
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
The quick and easy way to create and use Const & Props withVS Code.
We alsorecommend installing his complement extensionsArrow Function Snippets andDebug
Open the quick launch withctrl+shift+P (Win/Linux) orcmd+shift+P (macOS).
Paste the following command and pressEnter
:
ext install deinsoftware.const-props-snippets
Open the extension manager withctrl+shift+X (Win/Linux) orcmd+shift+X (macOS), search forConst & Props Snippets
and click on[Install]
button.
Language | Extension |
---|---|
JavaScript | .js |
TypeScript | .ts |
JavaScript React | .jsx |
TypeScript React | .tsx |
Vue | .vue |
JSON | .json |
JSONC | .jsonc |
JSON5 | .json5 |
Below is a list of all available snippets and the triggers of each one. The░
means theTAB
jump position and█
the final cursor position.
Trigger | Description | Result JS | Result TS |
---|---|---|---|
cv→ | const variable | const ░name = █ | const ░name = █ |
cvt→ | const variable type | const ░name: ░type = █ | |
cvm→ | const variable multiple type | const ░name: (░type | ░type) = █ | |
cs→ | const string | const ░name = '░'█ | const ░name: string = '░'█ |
ctl→ | const template literals | const ░name = `░${░expression}░`█ | const ░name: string = `░${░expression}░`█ |
cn→ | const number | const ░name = ░0█ | const ░name: number = ░0█ |
cb→ | const boolean | const ░name = ░true█ | const ░name: boolean = ░true█ |
co→ | const object | const ░name = {░}█ | const ░name = {░}█ |
co→ | const object freeze | const ░name = Object.freeze({░})█ | const ░name = Object.freeze({░})█ |
coi→ | const object interface | const ░name: Interface = {░}█ | |
ca→ | const array | const ░name = [░]█ | const ░name = [░]█ |
cat→ | const array type | const ░name: type = [░]█ | |
cam→ | const array multiple type | const ░name: (░type | ░type) = [░]█ | |
cp→ | const promise | const ░name = new Promise((resolve, reject) => { | const ░name = new Promise((resolve, reject) => { |
Trigger | Description | Result JS/TS |
---|---|---|
cod→ | const object dest | const {░prop, ░prop} = ░name█ |
cods→ | const object dest safe | const {░prop, ░prop} = ░name || {}█ |
codr→ | const object dest with rest | const {░prop, ░prop, ...rest} = ░name█ |
cad→ | const array dest | const [░prop, ░prop] = ░name█ |
cads→ | const array dest safe | const [░prop, ░prop] = ░name || []█ |
cadr→ | const array dest with rest | const [░prop, ░prop, ...rest] = ░name█ |
pd→ | parameter object dest | {░prop, ░prop}█ |
pdr→ | parameter object dest with rest | {░prop, ░prop, ...rest}█ |
Trigger | Description | Result JS/TS |
---|---|---|
oev→ | obj element variable | ░key: ░value,█ |
oes→ | obj element string | ░key: '░value',█ |
oen→ | obj element number | ░key: ░number,█ |
oeb→ | obj element boolean | ░key: ░true,█ |
oeo→ | obj element object | ░key: { ░element },█ |
oeom→ | obj element object multiline | ░key: { |
oea→ | obj element array | ░key: [ ░value ],█ |
oeam→ | obj element array multiline | ░key: [ |
Trigger | Description | Result JS/TS |
---|---|---|
jes→ | json element string | ░key: '░value',█ |
jev→ | json element variable | ░key: ░value,█ |
jen→ | json element number | ░key: ░number,█ |
jeb→ | json element boolean | ░key: ░true,█ |
jeo→ | json element object | ░key: { ░element },█ |
jeom→ | json element object multiline | ░key: { |
jea→ | json element array | ░key: [ ░value ],█ |
jeam→ | json element array multiline | ░key: [ |
ℹ️ Only available in
.json
,.jsonc
and.json5
files
Trigger | Description | Result JSX/TSX |
---|---|---|
rhe→ | react handle event | const handle░Event = (event) => { |
rhen→ | react handle event as number | const handle░Event = (event) => { |
rhed→ | react handle event as date | const handle░Event = (event) => { |
Trigger | Description | Result JSX/TSX |
---|---|---|
rp→ | react property | ░prop={░prop}█ |
rps→ | react property string | ░prop='░'█ |
rpn→ | react property number | ░prop={░0}█ |
rpb→ | react property boolean | ░prop={░true}█ |
rpo→ | react property object | ░prop={{░}}█ |
rpa→ | react property array | ░prop={[░]}█ |
rpcn→ | react property className | className='░'█ |
rpocl→ | react property onClick | onClick={░handleClick}█ |
rpoch→ | react property onChange | onChange={░handleChange}█ |
ℹ️ Only available in
jsx
ortsx
Creating properties on a React component withrp
,rpn
andrpb
Remember to complement the snippets with these keyboard shortcuts that can be used without needing to move the cursor to the start or to the end.
Action | Win/Linux | macOS |
---|---|---|
Insert line above | ctrl+shift+enter | cmd+shift+enter |
Insert line below | ctrl+enter | cmd+enter |
Theeditor.snippetSuggestions
setting in vscodesettings.json
will show snippets on top of the suggestion list.
"editor.snippetSuggestions":"top"
- VS Code - Code editing redefined.
- Figma - The collaborative interface design tool.
- SWPM - One Package Manager to command them all.
Please readCONTRIBUTING for details on our code of conduct, and the process for submitting pull requests to us.
We useSemVer for versioning. For the versions available, see theConst & Props Snippets on GitHub.
- Camilo Martinez [Equiman]
See also the list ofcontributors who participated in this project.
If this project helps you, consider buying me a cup of coffee.
This project is licensed under the MIT License - see theLICENSE file for details.
About
VS Code Const & Props snippets for JS and TS
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.