|
| 1 | +# Const & Props Snippets |
| 2 | + |
| 3 | +[](https://marketplace.visualstudio.com/items?itemName=deinsoftware.const-props-snippets) |
| 4 | +[](https://marketplace.visualstudio.com/items?itemName=deinsoftware.const-props-snippets) |
| 5 | +[](https://marketplace.visualstudio.com/items?itemName=deinsoftware.const-props-snippets) |
| 6 | +[](LICENSE.md) |
| 7 | +[](https://open.vscode.dev/deinsoftware/vscode-const-props-snippets) |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | +The quick and easy way to create and use Const & Props with [VS Code](https://code.visualstudio.com/). |
| 12 | + |
| 13 | +## Menu |
| 14 | + |
| 15 | +- [Installation](#installation) |
| 16 | + - [Quick Launch](#quick-launch) |
| 17 | + - [Extension Manager](#extension-manager) |
| 18 | + - [Marketplace](#marketplace) |
| 19 | +- [Supported Languages](#supported-languages) |
| 20 | +- [Snippets](#snippets) |
| 21 | + - [Variables](#variables) |
| 22 | + - [Destructuring](#destructuring) |
| 23 | + - [Object Elements](#object-elements) |
| 24 | + - [JSON Elements](#json-elements) |
| 25 | + - [React Components](#react-components) |
| 26 | +- [About](#about) |
| 27 | + |
| 28 | +--- |
| 29 | + |
| 30 | +## Installation |
| 31 | + |
| 32 | +### Quick Launch |
| 33 | + |
| 34 | +Open the quick launch with <kbd>ctrl</kbd>+<kbd>shift</kbd>+<kbd>P</kbd> (Win/Linux) or <kbd>cmd</kbd>+<kbd>shift</kbd>+<kbd>P</kbd> (macOS). |
| 35 | + |
| 36 | +Paste the following command and press `Enter`: |
| 37 | + |
| 38 | +```shell |
| 39 | +ext install deinsoftware.const-props-snippets |
| 40 | +``` |
| 41 | + |
| 42 | +### Extension Manager |
| 43 | + |
| 44 | +Open the extension manager with <kbd>ctrl</kbd>+<kbd>shift</kbd>+<kbd>X</kbd> (Win/Linux) or <kbd>cmd</kbd>+<kbd>shift</kbd>+<kbd>X</kbd> (macOS), search for `Const & Props Snippets` and click on `[Install]` button. |
| 45 | + |
| 46 | +### Marketplace |
| 47 | + |
| 48 | +[Const & Props Snippets](https://marketplace.visualstudio.com/items?itemName=deinsoftware.const-props-snippets) |
| 49 | + |
| 50 | +⇧ [Back to menu](#menu) |
| 51 | + |
| 52 | +--- |
| 53 | + |
| 54 | +## Supported Languages |
| 55 | + |
| 56 | +| Language | Extension | |
| 57 | +| ---------------- | --------- | |
| 58 | +| JavaScript | `.js` | |
| 59 | +| TypeScript | `.ts` | |
| 60 | +| JavaScript React | `.jsx` | |
| 61 | +| TypeScript React | `.tsx` | |
| 62 | +| Vue | `.vue` | |
| 63 | +| JSON | `.json` | |
| 64 | +| JSONC | `.jsonc` | |
| 65 | +| JSON5 | `.json5` | |
| 66 | + |
| 67 | +⇧ [Back to menu](#menu) |
| 68 | + |
| 69 | +--- |
| 70 | + |
| 71 | +## Snippets |
| 72 | + |
| 73 | +Below is a list of all available snippets and the triggers of each one. The **→** means the `TAB` key and `█` the final cursor position. |
| 74 | + |
| 75 | +### Variables |
| 76 | + |
| 77 | +| Trigger | Description | Result JS | Result TS | |
| 78 | +| -------: | ---------------------------- | -------------------- | ------------------------------------------------- | |
| 79 | +| `cv→` | const variable | `const name = █` | `const name = █` | |
| 80 | +| `cvt→` | const variable type | | `const name: type = █` | |
| 81 | +| `cvm→` | const variable multiple type | | <code>const name: (type | type) = █</code> | |
| 82 | +| `cs→` | const string | `const name = '█'` | `const name: string = '█'` | |
| 83 | +| `cn→` | const number | `const name = 0█` | `const name: number = 0█` | |
| 84 | +| `cb→` | const boolean | `const name = true█` | `const name: boolean = true█` | |
| 85 | +| `co→` | const object | `const name = {█}` | `const name = {█}` | |
| 86 | +| `coi→` | const object interface | | `const name: Interface = {█}` | |
| 87 | +| `ca→` | const array | `const name = [█]` | `const name = [█]` | |
| 88 | +| `cat→` | const array type | | `const name: type = [█]` | |
| 89 | +| `cam→` | const array multiple type | | <code>const name: (type | type) = [█]</code> | |
| 90 | + |
| 91 | +### Destructuring |
| 92 | + |
| 93 | +| Trigger | Description | Result JS/TS | |
| 94 | +| -------: | ------------------------------- | ------------------------------------- | |
| 95 | +| `cod→` | const object dest | `const {prop, prop} = name█` | |
| 96 | +| `codr→` | const object dest with rest | `const {prop, prop, ...rest} = name█` | |
| 97 | +| `cad→` | const array dest | `const [prop, prop] = name█` | |
| 98 | +| `cadr→` | const array dest with rest | `const [prop, prop, ...rest] = name█` | |
| 99 | +| `pd→` | parameter object dest | `{prop, prop█}` | |
| 100 | +| `pdr→` | parameter object dest with rest | `{prop, prop, ...rest█}` | |
| 101 | + |
| 102 | +### Object Elements |
| 103 | + |
| 104 | +| Trigger | Description | Result JS/TS | |
| 105 | +| -------: | ---------------------------- | ----------------------------------------------------- | |
| 106 | +| `oev→` | obj element variable | `key: value,█` | |
| 107 | +| `oes→` | obj element string | `key: 'value',█` | |
| 108 | +| `oen→` | obj element number | `key: number,█` | |
| 109 | +| `oeb→` | obj element boolean | `key: true,█` | |
| 110 | +| `oeo→` | obj element object | `key: { element },█` | |
| 111 | +| `oeom→` | obj element object multiline | <code>key: {<br/> element, <br/>},█</code> | |
| 112 | +| `oea→` | obj element array | `key: [ value ],█` | |
| 113 | +| `oeam→` | obj element array multiline | <code>key: [<br/> value, <br/>],█</code> | |
| 114 | + |
| 115 | +### JSON Elements |
| 116 | + |
| 117 | +| Trigger | Description | Result JS/TS | |
| 118 | +| -------: | ----------------------------- | ------------------------------------------------------- | |
| 119 | +| `jes→` | json element string | `key: 'value',█` | |
| 120 | +| `jev→` | json element variable | `key: value,█` | |
| 121 | +| `jen→` | json element number | `key: number,█` | |
| 122 | +| `jeb→` | json element boolean | `key: true,█` | |
| 123 | +| `jeo→` | json element object | `key: { element }█` | |
| 124 | +| `jeom→` | json element object multiline | <code>key: {<br/> element , <br/>},█</code> | |
| 125 | +| `jea→` | json element array | `key: [ value ],█` | |
| 126 | +| `jeam→` | json element array multiline | <code>key: [<br/> value , <br/>],█</code> | |
| 127 | + |
| 128 | +> ℹ️ Only available in `.json`, `.jsonc` and `.json5` files |
| 129 | +
|
| 130 | +### React Components |
| 131 | + |
| 132 | +| Trigger | Description | Result JSX/TSX | |
| 133 | +| -------: | ---------------------------- | -------------- | |
| 134 | +| `rp→` | react property | `prop={prop}█` | |
| 135 | +| `rps→` | react property string | `prop='█'` | |
| 136 | +| `rpn→` | react property number | `prop={0}█` | |
| 137 | +| `rpb→` | react property boolean | `prop={true}█` | |
| 138 | +| `rpo→` | react property object | `prop={{█}}` | |
| 139 | +| `rpa→` | react property array | `prop={[█]}` | |
| 140 | + |
| 141 | +> ℹ️ Only available in `jsx` or `tsx` |
| 142 | +
|
| 143 | +⇧ [Back to menu](#menu) |
| 144 | + |
| 145 | +--- |
| 146 | + |
| 147 | +## About |
| 148 | + |
| 149 | +### Built With |
| 150 | + |
| 151 | +- [VS Code](https://code.visualstudio.com/) - Code editing redefined. |
| 152 | +- [Figma](https://www.figma.com/) - The collaborative interface design tool. |
| 153 | + |
| 154 | +### Contributing |
| 155 | + |
| 156 | +Please read [CONTRIBUTING](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us. |
| 157 | + |
| 158 | +### Versioning |
| 159 | + |
| 160 | +We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [Const & Props Snippets](https://github.com/deinsoftware/const-props-snippets/tags) on GitHub. |
| 161 | + |
| 162 | +### Authors |
| 163 | + |
| 164 | +- **Camilo Martinez** [[Equiman](http://stackoverflow.com/story/equiman)] |
| 165 | + |
| 166 | +See also the list of [contributors](https://github.com/deinsoftware/const-props-snippets/contributors) who participated in this project. |
| 167 | + |
| 168 | +### Sponsors |
| 169 | + |
| 170 | +If this project helps you, consider buying me a cup of coffee. |
| 171 | + |
| 172 | +[](https://paypal.me/equiman/3) |
| 173 | +[](https://patreon.com/equiman) |
| 174 | +[](https://www.buymeacoffee.com/equiman) |
| 175 | + |
| 176 | +### License |
| 177 | + |
| 178 | +This project is licensed under the MIT License - see the [LICENSE](LICENSE.md) file for details. |
| 179 | + |
| 180 | +⇧ [Back to menu](#menu) |
0 commit comments