Skip to content

Commit

Permalink
update vscode snippets for typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
mlabieniec committed Aug 4, 2018
1 parent ed79e21 commit f8c7f93
Show file tree
Hide file tree
Showing 25 changed files with 506 additions and 491 deletions.
12 changes: 8 additions & 4 deletions vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# Change Log

## 0.1
## 0.0.1
- Initial release

## 0.2
## 0.0.2
- Documentation updates

## 0.3
- Add icon
## 0.0.3
- Add icon

## 0.0.4
- Add TypeScript support
- Update Readme
9 changes: 3 additions & 6 deletions vscode/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@

<img src="https://s3.amazonaws.com/aws-mobile-hub-images/aws-amplify-logo.png" alt="AWS Amplify" width="550" >

Code snippets and completion for the [AWS Amplify](https://aws.github.io/aws-amplify) API.

Code snippets and completion for the [AWS Amplify](https://aws-amplify.github.io/amplify-js) API.

## Installation

Go to the Extension Marketplace in VS Code and search for AWS Amplify API. Click install on the extension with title "AWS Amplify API".

## Usage

In a JavaScript or JSX file*, start typing an AWS Amplify API command that has a corresponding snippet and choose the appropriate snippet by either clicking it or pressing "enter" or "tab" when the correct snippet is highlighted in the dropdown menu. You can scroll between snippets using the up and down arrow keys.
In a JavaScript, TypeScript, or JSX file, start typing an AWS Amplify API command that has a corresponding snippet and choose the appropriate snippet by either clicking it or pressing "enter" or "tab" when the correct snippet is highlighted in the dropdown menu. You can scroll between snippets using the up and down arrow keys.

The snippets options that pop up are based on the prefix that you type. For the complete set of prefix/snippet pairings for AWS Amplify, see the documentation:

Expand All @@ -23,6 +22,4 @@ For code blocks that are not the first after a heading, prefixes are numbered in
Selected code segments from the documentation guides, broken down by documentation page:
https://github.com/aws-amplify/amplify-js/wiki/VS-Code-Snippet-Extension#selected-code-block-snippet-documentation

Single word snippets (snippets that complete single words when clicked): https://github.com/aws-amplify/amplify-js/wiki/VS-Code-Snippet-Extension#single-word-snippet-documentation

*The snippets also have limited TypeScript functionality.
Single word snippets (snippets that complete single words when clicked): https://github.com/aws-amplify/amplify-js/wiki/VS-Code-Snippet-Extension#single-word-snippet-documentation
Binary file added vscode/images/logo-text.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "aws-amplify-vscode",
"displayName": "AWS Amplify API",
"description": "AWS Amplify API code snippets",
"version": "0.0.3",
"version": "0.0.4",
"publisher": "aws-amplify",
"icon": "images/logo.png",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion vscode/snippet_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
snippets.write(' "Amplify ' + title.title() + ' ' + header + snippet_number + '": {\n')
snippets.write(' "prefix": "Amplify ' + header + snippet_number + '",\n')
if language == 'js':
snippets.write(' "scope": "javascript,javascriptreact",\n')
snippets.write(' "scope": "javascript,javascriptreact,typescript",\n')
else:
snippets.write(' "scope": "' + language + '",\n')
snippets.write(' "body": [\n')
Expand Down
4 changes: 2 additions & 2 deletions vscode/snippets/I18n.code-snippets
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"setLanguage": {
"prefix": "setLanguage",
"scope": "javascript,javascriptreact",
"scope": "javascript,javascriptreact,typescript",
"body": [
"setLanguage"
]
},
"I18n Custom Dictionary": {
"prefix": "I18n Custom Dictionary",
"scope": "javascript,javascriptreact",
"scope": "javascript,javascriptreact,typescript",
"body": [
"const dict = {",
"\t${1:'fr'}: {",
Expand Down
24 changes: 12 additions & 12 deletions vscode/snippets/analytics.code-snippets
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"Amplify Analytics Configuration": {
"prefix": "Analytics.configure",
"scope": "javascript,javascriptreact",
"scope": "javascript,javascriptreact,typescript",
"body": [
"Analytics.configure({",
"\t// OPTIONAL - disable Analytics if true",
Expand Down Expand Up @@ -43,7 +43,7 @@
},
"Analytics Custom Tracking Event": {
"prefix": "Analytics.record",
"scope": "javascript,javascriptreact",
"scope": "javascript,javascriptreact,typescript",
"body": [
"Analytics.record({",
"\tname: ${1:'albumVisit'},",
Expand All @@ -54,21 +54,21 @@
},
"Analytics.disable": {
"prefix": "Analytics.disable",
"scope": "javascript,javascriptreact",
"scope": "javascript,javascriptreact,typescript",
"body": [
"Analytics.disable"
]
},
"Analytics.enable": {
"prefix": "Analytics.enable",
"scope": "javascript,javascriptreact",
"scope": "javascript,javascriptreact,typescript",
"body": [
"Analytics.enable"
]
},
"Analytics Authentication Event": {
"prefix": "Analytics.record",
"scope": "javascript,javascriptreact",
"scope": "javascript,javascriptreact,typescript",
"body": [
"Analytics.record({",
"\tname: ${1:'_userauth.event'}",
Expand All @@ -77,7 +77,7 @@
},
"Analytics Update User Attributes": {
"prefix": "Analytics.updateEndpoint",
"scope": "javascript,javascriptreact",
"scope": "javascript,javascriptreact,typescript",
"body": [
"Analytics.updateEndpoint({",
"\t// Customized userId",
Expand All @@ -97,7 +97,7 @@
},
"AWSKinesis": {
"prefix": "AWSKinesis",
"scope": "javascript,javascriptreact",
"scope": "javascript,javascriptreact,typescript",
"body": [
"AWSKinesis: {",
"\t// OPTIONAL - Amazon Kinesis service region",
Expand All @@ -115,7 +115,7 @@
},
"Kinesis Record": {
"prefix": "Analytics.record",
"scope": "javascript,javascriptreact",
"scope": "javascript,javascriptreact,typescript",
"body": [
"Analytics.record({",
"\tdata: {",
Expand All @@ -129,7 +129,7 @@
},
"AnalyticsProvider": {
"prefix": "AnalyticsProvider",
"scope": "javascript,javascriptreact",
"scope": "javascript,javascriptreact,typescript",
"body": [
"AnalyticsProvider {",
"\t// category and provider name",
Expand All @@ -149,21 +149,21 @@
},
"addPluggable": {
"prefix": "addPluggable",
"scope": "javascript,javascriptreact",
"scope": "javascript,javascriptreact,typescript",
"body": [
"addPluggable"
]
},
"getPluggable": {
"prefix": "getPluggable",
"scope": "javascript,javascriptreact",
"scope": "javascript,javascriptreact,typescript",
"body": [
"getPluggable"
]
},
"removePluggable": {
"prefix": "removePluggable",
"scope": "javascript,javascriptreact",
"scope": "javascript,javascriptreact,typescript",
"body": [
"removePluggable"
]
Expand Down
28 changes: 14 additions & 14 deletions vscode/snippets/angular.code-snippets
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"Angular/Ionic amplify-photo-picker": {
"prefix": "<amplify-photo-picker",
"scope": "javascript,javascriptreact",
"scope": "javascript,javascriptreact,typescript",
"body": [
"<amplify-photo-picker",
"\t(picked)=\"onImagePicked(\\$event)\"",
Expand All @@ -11,7 +11,7 @@
},
"Angluar onImagePicked": {
"prefix": "onImagePicked",
"scope": "javascript,javascriptreact",
"scope": "javascript,javascriptreact,typescript",
"body": [
"onImagePicked( file ) {\n",
"\tlet key = ${1:`pics/}${file.name}`;\n",
Expand All @@ -26,84 +26,84 @@
},
"AmplifyAngularModule": {
"prefix": "AmplifyAngularModule",
"scope": "javascript,javascriptreact",
"scope": "javascript,javascriptreact,typescript",
"body": [
"AmplifyAngularModule"
]
},
"NgModule": {
"prefix": "NgModule",
"scope": "javascript,javascriptreact",
"scope": "javascript,javascriptreact,typescript",
"body": [
"NgModule"
]
},
"AmplifyService": {
"prefix": "AmplifyService",
"scope": "javascript,javascriptreact",
"scope": "javascript,javascriptreact,typescript",
"body": [
"AmplifyService"
]
},
"navCtrl": {
"prefix": "navCtrl",
"scope": "javascript,javascriptreact",
"scope": "javascript,javascriptreact,typescript",
"body": [
"navCtrl"
]
},
"NavController": {
"prefix": "NavController",
"scope": "javascript,javascriptreact",
"scope": "javascript,javascriptreact,typescript",
"body": [
"NavController"
]
},
"amplifyService": {
"prefix": "amplifyService",
"scope": "javascript,javascriptreact",
"scope": "javascript,javascriptreact,typescript",
"body": [
"amplifyService"
]
},
"modalCtrl": {
"prefix": "modalCtrl",
"scope": "javascript,javascriptreact",
"scope": "javascript,javascriptreact,typescript",
"body": [
"modalCtrl"
]
},
"ModalController": {
"prefix": "ModalController",
"scope": "javascript,javascriptreact",
"scope": "javascript,javascriptreact,typescript",
"body": [
"ModalController"
]
},
"selector": {
"prefix": "selector",
"scope": "javascript,javascriptreact",
"scope": "javascript,javascriptreact,typescript",
"body": [
"selector"
]
},
"templateUrl": {
"prefix": "templateUrl",
"scope": "javascript,javascriptreact",
"scope": "javascript,javascriptreact,typescript",
"body": [
"templateUrl"
]
},
"styleUrls": {
"prefix": "styleUrls",
"scope": "javascript,javascriptreact",
"scope": "javascript,javascriptreact,typescript",
"body": [
"styleUrls"
]
},
"onAlbumImageSelected": {
"prefix": "onAlbumImageSelected",
"scope": "javascript,javascriptreact",
"scope": "javascript,javascriptreact,typescript",
"body": [
"onAlbumImageSelected"
]
Expand Down
Loading

0 comments on commit f8c7f93

Please sign in to comment.