Skip to content

Instantly share code, notes, and snippets.

@bcye
Last active July 6, 2023 16:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bcye/0748f3d36bc55f46499fe3c8260d62fc to your computer and use it in GitHub Desktop.
Save bcye/0748f3d36bc55f46499fe3c8260d62fc to your computer and use it in GitHub Desktop.
VS Code Snippets

VS Code Snippets by Bruce

How to use a snippet

Open the command palette (Ctrl+Shift+P) and select "Configure User Snippets", from there create a Global one or one scoped to your project and paste the json.

Formatjs

Use imsg or fmsg to autocomplete to Imperative API (intl.formatMessage) or declarative (components) API (<FormattedMessage />) and have some fun.

{
"Imperative Message": {
"scope": "javascript,typescript,javascriptreact,typescriptreact",
"prefix": "imsg",
"body": "intl.formatMessage({ defaultMessage: '$1' })$0"
},
"Message Component": {
"scope": "javascriptreact,typescriptreact",
"prefix": "fmsg",
"body": "<FormattedMessage defaultMessage={'$1'} />$0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment