https://github.com/vscodeshift/snippets-extension-skeleton
skeleton for a VSCode extension that provides snippets
https://github.com/vscodeshift/snippets-extension-skeleton
Last synced: about 1 year ago
JSON representation
skeleton for a VSCode extension that provides snippets
- Host: GitHub
- URL: https://github.com/vscodeshift/snippets-extension-skeleton
- Owner: vscodeshift
- License: mit
- Created: 2020-01-20T06:36:00.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T05:19:06.000Z (over 3 years ago)
- Last Synced: 2025-02-10T09:15:15.532Z (over 1 year ago)
- Language: TypeScript
- Size: 3.29 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# snippets-extension-skeleton
[](https://circleci.com/gh/vscodeshift/snippets-extension-skeleton)
[](https://codecov.io/gh/vscodeshift/snippets-extension-skeleton)
[](https://github.com/semantic-release/semantic-release)
[](http://commitizen.github.io/cz-cli/)
[](https://marketplace.visualstudio.com/items?itemName=vscodeshift.snippets-extension-skeleton)
skeleton for a VSCode extension that provides snippets
# How to use this skeleton
Instead of typing up the snippets JSON file manually (because it sucks),
you define each snippet in a file in `src/snippets//.ts`.
The build scripts will then compile these files into the JSON that VSCode
understands and add the `contributes.snippets` entry to `package.json`.
For [example](./src/snippets/javascript/example.ts):
```ts
// optional, defaults to filename without extension
export const prefix = 'example'
export const description = 'An example snippet'
// The build tools will strip off the leading and trailing newlines so that you
// don't have to indent anything.
export const body = `
export default function $1() {
$0
}
`
```
Output:
```
{
"example": {
"prefix": "example",
"description": "An example snippet",
"body": [
"export default function $1() {",
" $0",
"}"
]
}
}
```
# Snippets
## javascript
### `example`: An example snippet
```
export default function $1() {
$0
}
```