├── .vscode └── launch.json ├── CHANGELOG.md ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE.md ├── LICENSE.md ├── PULL_REQUEST_TEMPLATE.md ├── README.md ├── code_of_conduct ├── LICENSE └── README.md ├── images ├── angular-shield.png ├── install-extension.gif └── use-extension.gif ├── package-lock.json ├── package.json └── snippets ├── javascript.json └── typescript.json /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that compiles the extension and then opens it inside a new window 2 | { 3 | "version": "0.1.0", 4 | "configurations": [ 5 | { 6 | "name": "Launch Extension", 7 | "type": "extensionHost", 8 | "request": "launch", 9 | "runtimeExecutable": "${execPath}", 10 | "args": [ 11 | "--extensionDevelopmentPath=${workspaceRoot}" 12 | ], 13 | "stopOnEntry": false 14 | }, 15 | { 16 | "name": "Launch Tests", 17 | "type": "extensionHost", 18 | "request": "launch", 19 | "runtimeExecutable": "${execPath}", 20 | "args": [ 21 | "--extensionDevelopmentPath=${workspaceRoot}", 22 | "--extensionTestsPath=${workspaceRoot}/out/test" 23 | ], 24 | "stopOnEntry": false 25 | } 26 | ] 27 | } -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## Angular 1 Snippets Changelog 2 | 3 | 4 | 5 | # 0.2.1 (2019-05-04) 6 | 7 | - Added "extensionKind": "ui"` to support remote development features in VS Code 8 | 9 | 10 | 11 | # 0.2.0 (2017-05-29) 12 | 13 | - Fixed all JavaScript and TypeScript snippets to use positional placeholders 14 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to vscode-angular1-snippets 2 | 3 | We would love for you to contribute and help make it even better 4 | than it is today! As a contributor, here are the guidelines we would like you 5 | to follow: 6 | 7 | -[Code of Conduct](#coc) 8 | 9 | - [Issues and Bugs](#issue) 10 | - [Feature Requests](#feature) 11 | - [Submission Guidelines](#submit) 12 | 13 | ## Code of Conduct 14 | 15 | Help us keep this project open and inclusive.Please read and follow our [Code of Conduct](code_of_conduct /). 16 | 17 | ## Found an Issue? 18 | 19 | If you find a bug in the source code or a mistake in the documentation, you can help us by 20 | [submitting an issue](#submit - issue) to our [GitHub Repository](https://github.com/johnpapa/vscode-angular1-snippets). Even better, you can 21 | [submit a Pull Request](#submit-pr) with a fix. 22 | 23 | ## Want a Feature? 24 | 25 | You can _ request _ a new feature by [submitting an issue](#submit - issue) to our [GitHub 26 | Repository][github].If you would like to _ implement _ a new feature, please submit an issue with 27 | a proposal for your work first, to be sure that we can use it. 28 | 29 | - **Small Features** can be crafted and directly [submitted as a Pull Request](#submit - pr). 30 | 31 | ## Submission Guidelines 32 | 33 | ### Submitting an Issue 34 | 35 | Before you submit an issue, search the archive, maybe your question was already answered. 36 | 37 | If your issue appears to be a bug, and hasn't been reported, open a new issue. 38 | Help us to maximize the effort we can spend fixing issues and adding new 39 | features, by not reporting duplicate issues.Providing the following information will increase the 40 | chances of your issue being dealt with quickly: 41 | 42 | - **Overview of the Issue** - if an error is being thrown a non- minified stack trace helps 43 | - **Version ** - what version is affected (e.g. 0.1.2) 44 | - **Motivation for or Use Case** - explain what are you trying to do and why the current behavior is a bug for you 45 | - **Browsers and Operating System** - is this a problem with all browsers? 46 | - **Reproduce the Error** - provide a live example [Runnable][runnable]) or a unambiguous set of steps 47 | - **Related Issues** - has a similar issue been reported before? 48 | - **Suggest a Fix** - if you can't fix the bug yourself, perhaps you can point to what might be 49 | causing the problem (line of code or commit) 50 | 51 | You can file new issues by providing the above information [here](https://github.com/johnpapa/vscode-angular1-snippets/issues/new). 52 | 53 | ### Submitting a Pull Request (PR) 54 | 55 | Before you submit your Pull Request (PR) consider the following guidelines: 56 | 57 | - Search[GitHub](https://github.com/johnpapa/vscode-angular1-snippets/pulls) for an open or closed PR 58 | that relates to your submission.You don't want to duplicate effort. 59 | 60 | - Make your changes in a new git fork: 61 | 62 | - Commit your changes using a descriptive commit message 63 | - Push your fork to GitHub: 64 | - In GitHub, send a pull request 65 | 66 | - If we suggest changes then: 67 | - Make the required updates. 68 | - Rebase your fork and force push to your GitHub repository (this will update your Pull Request): 69 | 70 | ```shell 71 | git rebase master -i 72 | git push -f 73 | ``` 74 | 75 | That's it! Thank you for your contribution! 76 | -------------------------------------------------------------------------------- /ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | > ## Please provide us with the following information: 2 | 3 | ### OS and Version? 4 | 5 | > Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?) 6 | 7 | ### Versions 8 | 9 | > 10 | 11 | ### Repro steps 12 | 13 | > 14 | 15 | ### The log given by the failure. 16 | 17 | > 18 | 19 | ### Mention any other details that might be useful. 20 | 21 | > --- 22 | > 23 | > Thanks! We'll be in touch soon. 24 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2019 JohnPapa.net, LLC 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Purpose 2 | 3 | - ... 4 | 5 | ## What 6 | 7 | - ... 8 | 9 | ## How to Test 10 | 11 | - ... 12 | 13 | ## What to Check 14 | 15 | Verify that the following are valid 16 | 17 | - ... 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Angular 1 JavaScript and TypeScript Snippets for VS Code 2 | 3 | This extension for Visual Studio Code adds snippets for Angular 1 for JavaScript and TypeScript. 4 | 5 | ![Use Extension](images/use-extension.gif) 6 | 7 | ## Usage 8 | 9 | Type part of a snippet, press `enter`, and the snippet unfolds. 10 | 11 | JavaScript Snippets 12 | 13 | ```javascript 14 | ng1component; // creates an Angular component 15 | ng1controller; // creates an Angular controller 16 | ng1directive; // creates an Angular directive 17 | ng1factory; // creates an Angular factory 18 | ng1module; // creates an Angular module 19 | ng1service; // creates an Angular service 20 | ng1filter; // creates an Angular filter 21 | ``` 22 | 23 | TypeScript Snippets 24 | 25 | ```typescript 26 | ng1controller; // creates an Angular controller 27 | ng1service; // creates an Angular service 28 | ng1module; // creates an Angular module 29 | ``` 30 | 31 | Alternatively, press `Ctrl`+`Space` (Windows, Linux) or `Cmd`+`Space` (OSX) to activate snippets from within the editor. 32 | 33 | ## Installation 34 | 35 | 1. Install Visual Studio Code 0.10.1 or higher 36 | 2. Launch Code 37 | 3. From the command palette `Ctrl`-`Shift`-`P` (Windows, Linux) or `Cmd`-`Shift`-`P` (OSX) 38 | 4. Select `Install Extension` 39 | 5. Choose the extension 40 | 6. Reload Visual Studio Code 41 | 42 | ![Install Extension](images/install-extension.gif) 43 | -------------------------------------------------------------------------------- /code_of_conduct/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Coraline Ada Ehmke 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /code_of_conduct/README.md: -------------------------------------------------------------------------------- 1 | # Contributor Code of Conduct 2 | 3 | As contributors and maintainers of the Angular project, we pledge to respect everyone who contributes by posting issues, updating documentation, submitting pull requests, providing feedback in comments, and any other activities. 4 | 5 | Communication through any channels (GitHub, IRC, mailing lists, Google+, Twitter, etc.) must be constructive and never resort to personal attacks, trolling, public or private harrassment, insults, or other unprofessional conduct. 6 | 7 | We promise to extend courtesy and respect to everyone involved in this project regardless of gender, gender identity, sexual orientation, disability, age, race, ethnicity, religion, or level of experience. We expect anyone contributing to the Angular project to do the same. 8 | 9 | If any member of the community violates this code of conduct, the maintainers of the Angular project may take action, removing issues, comments, and PRs or blocking accounts as deemed appropriate. 10 | 11 | ## Credits 12 | 13 | Based on the [Contributor Covenant](https://github.com/Bantik/contributor_covenant) by [Coraline Ada Ehmke (Bantik)](https://github.com/Bantik). 14 | 15 | If you have suggestions to improve this code of conduct, please submit an issue or PR. -------------------------------------------------------------------------------- /images/angular-shield.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnpapa/vscode-angular1-snippets/f6d62364534ddb6fcd3dfea9d1944dd50df2f4d5/images/angular-shield.png -------------------------------------------------------------------------------- /images/install-extension.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnpapa/vscode-angular1-snippets/f6d62364534ddb6fcd3dfea9d1944dd50df2f4d5/images/install-extension.gif -------------------------------------------------------------------------------- /images/use-extension.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnpapa/vscode-angular1-snippets/f6d62364534ddb6fcd3dfea9d1944dd50df2f4d5/images/use-extension.gif -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Angular1", 3 | "version": "0.2.0", 4 | "lockfileVersion": 1 5 | } 6 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Angular1", 3 | "publisher": "johnpapa", 4 | "displayName": "Angular 1 JavaScript and TypeScript Snippets", 5 | "description": "Angular 1 JavaScript and TypeScript snippets", 6 | "icon": "images/angular-shield.png", 7 | "galleryBanner": { 8 | "color": "#0273D4", 9 | "theme": "dark" 10 | }, 11 | "license": "SEE LICENSE IN LICENSE.md", 12 | "repository": { 13 | "type": "git", 14 | "url": "https://github.com/johnpapa/vscode-angular1-snippets.git" 15 | }, 16 | "version": "0.2.1", 17 | "engines": { 18 | "vscode": "0.10.x" 19 | }, 20 | "scripts": { 21 | "package": "npx vsce package", 22 | "publish": "npx vsce publish" 23 | }, 24 | "extensionKind": "ui", 25 | "categories": [ 26 | "Snippets" 27 | ], 28 | "contributes": { 29 | "snippets": [ 30 | { 31 | "language": "javascript", 32 | "path": "./snippets/javascript.json" 33 | }, 34 | { 35 | "language": "typescript", 36 | "path": "./snippets/typescript.json" 37 | } 38 | ] 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /snippets/javascript.json: -------------------------------------------------------------------------------- 1 | { 2 | "Angular Controller": { 3 | "prefix": "ng1controller", 4 | "body": [ 5 | "(function() {", 6 | "\t'use strict';", 7 | "", 8 | "\tangular", 9 | "\t\t.module('${1:Module}')", 10 | "\t\t.controller('${2:Controller}Controller', ${2:Controller}Controller);", 11 | "", 12 | "\t${2:Controller}Controller.\\$inject = ['${3:dependency1}'];", 13 | "\tfunction ${2:Controller}Controller(${3:dependency1}) {", 14 | "\t\tvar vm = this;", 15 | "\t\t$0", 16 | "", 17 | "\t\tactivate();", 18 | "", 19 | "\t\t////////////////", 20 | "", 21 | "\t\tfunction activate() { }", 22 | "\t}", 23 | "})();" 24 | ], 25 | "description": "Angular 1 controller" 26 | }, 27 | "Angular Service": { 28 | "prefix": "ng1service", 29 | "body": [ 30 | "(function() {", 31 | "\t'use strict';", 32 | "", 33 | "\tangular", 34 | "\t\t.module('${1:Module}')", 35 | "\t\t.service('${2:Service}', ${2:Service});", 36 | "", 37 | "\t${2:Service}.\\$inject = ['${3:dependency1}'];", 38 | "\tfunction ${2:Service}(${3:dependency1}) {", 39 | "\t\tthis.${4:exposedFn} = ${4:exposedFn};", 40 | "\t\t$0", 41 | "\t\t////////////////", 42 | "", 43 | "\t\tfunction ${4:exposedFn}() { }", 44 | "\t\t}", 45 | "})();" 46 | ], 47 | "description": "Angular 1 service" 48 | }, 49 | "Angular Factory": { 50 | "prefix": "ng1factory", 51 | "body": [ 52 | "(function() {", 53 | "\t'use strict';", 54 | "", 55 | "\tangular", 56 | "\t\t.module('${1:Module}')", 57 | "\t\t.factory('${2:Service}', ${2:Service});", 58 | "", 59 | "\t${2:Service}.\\$inject = ['${3:dependency1}'];", 60 | "\tfunction ${2:Service}(${3:dependency1}) {", 61 | "\t\tvar service = {", 62 | "\t\t\t${4:exposedFn}:${4:exposedFn}", 63 | "\t\t};", 64 | "\t\t$0", 65 | "\t\treturn service;", 66 | "", 67 | "\t\t////////////////", 68 | "\t\tfunction ${4:exposedFn}() { }", 69 | "\t}", 70 | "})();" 71 | ], 72 | "description": "Angular 1 factory" 73 | }, 74 | "Angular Component": { 75 | "prefix": "ng1component", 76 | "body": [ 77 | "(function() {", 78 | "\t'use strict';", 79 | "", 80 | "\t// Usage:", 81 | "\t// ", 82 | "\t// Creates:", 83 | "\t// ", 84 | "", 85 | "\tangular", 86 | "\t\t.module('${1:Module}')", 87 | "\t\t.component('${2:Component}', {", 88 | "\t\t\ttemplate:'${3:htmlTemplate}',", 89 | "\t\t\t//templateUrl: '${4:templateUrl}',", 90 | "\t\t\tcontroller: ${5:Controller}Controller,", 91 | "\t\t\tcontrollerAs: '\\$ctrl',", 92 | "\t\t\tbindings: {", 93 | "\t\t\t\t${6:Binding}: '=',", 94 | "\t\t\t},", 95 | "\t\t});", 96 | "", 97 | "\t${5:Controller}Controller.\\$inject = ['${7:dependency1}'];", 98 | "\tfunction ${5:Controller}Controller(${7:dependency1}) {", 99 | "\t\tvar \\$ctrl = this;", 100 | "\t\t$0", 101 | "", 102 | "\t\t////////////////", 103 | "", 104 | "\t\t\\$ctrl.\\$onInit = function() { };", 105 | "\t\t\\$ctrl.\\$onChanges = function(changesObj) { };", 106 | "\t\t\\$ctrl.\\$onDestroy = function() { };", 107 | "\t}", 108 | "})();" 109 | ], 110 | "description": "Angular 1 component (1.5+ only)" 111 | }, 112 | "Angular Directive": { 113 | "prefix": "ng1directive", 114 | "body": [ 115 | "(function() {", 116 | "\t'use strict';", 117 | "", 118 | "\tangular", 119 | "\t\t.module('${1:Module}')", 120 | "\t\t.directive('${2:Directive}', ${2:Directive});", 121 | "", 122 | "\t${2:Directive}.\\$inject = ['${3:dependency1}'];", 123 | "\tfunction ${2:Directive}(${3:dependency1}) {", 124 | "\t\t// Usage:", 125 | "\t\t//", 126 | "\t\t// Creates:", 127 | "\t\t//", 128 | "\t\tvar directive = {", 129 | "\t\t bindToController: true,", 130 | "\t\t controller: ${4:Controller}Controller,", 131 | "\t\t controllerAs: '${5:vm}',", 132 | "\t\t link: link,", 133 | "\t\t restrict: 'A',", 134 | "\t\t scope: {", 135 | "\t\t }", 136 | "\t\t};", 137 | "\t\treturn directive;", 138 | "\t\t", 139 | "\t\tfunction link(scope, element, attrs) {", 140 | "\t\t}", 141 | "\t}", 142 | "\t/* @ngInject */", 143 | "\tfunction ${4:Controller}Controller () {", 144 | "\t\t$0", 145 | "\t}", 146 | "})();" 147 | ], 148 | "description": "Angular 1 directive" 149 | }, 150 | "Angular Filter": { 151 | "prefix": "ng1filter", 152 | "body": [ 153 | "(function() {", 154 | "\t'use strict';", 155 | "", 156 | "\tangular", 157 | "\t\t.module('${1:Module}')", 158 | "\t\t.filter('${2:Filter}', ${2:Filter});", 159 | "", 160 | "\tfunction ${2:Filter}() {", 161 | "\t\treturn ${2:Filter}Filter;", 162 | "", 163 | "\t\t////////////////", 164 | "", 165 | "\t\tfunction ${2:Filter}Filter(${3:Params}) {", 166 | "\t\t\treturn ${3:Params};", 167 | "\t\t}", 168 | "\t}", 169 | "})();" 170 | ], 171 | "description": "Angular 1 filter" 172 | }, 173 | "Angular Module": { 174 | "prefix": "ng1module", 175 | "body": [ 176 | "(function() {", 177 | "\t'use strict';", 178 | "", 179 | "\tangular.module('${1:module}', [", 180 | "\t\t$0", 181 | "\t]);", 182 | "})();" 183 | ], 184 | "description": "Angular 1 module" 185 | } 186 | } 187 | -------------------------------------------------------------------------------- /snippets/typescript.json: -------------------------------------------------------------------------------- 1 | { 2 | "Angular Controller": { 3 | "prefix": "ng1controller", 4 | "body": [ 5 | "namespace ${1:module} {", 6 | "\t'use strict';", 7 | "", 8 | "\texport class ${2:Controller}Controller {", 9 | "\t\tstatic \\$inject: Array = ['${3:dependency1}'];", 10 | "\t\tconstructor(private ${3:dependency1}: ${4:dependency1Type}) {}", 11 | "", 12 | "\t}", 13 | "", 14 | "\tangular", 15 | "\t\t.module('${5:Module}')", 16 | "\t\t.controller('${2:Controller}Controller', ${2:Controller}Controller);", 17 | "}" 18 | ] 19 | }, 20 | "Angular Service": { 21 | "prefix": "ng1service", 22 | "body": [ 23 | "namespace ${1:module} {", 24 | "\t'use strict';", 25 | "", 26 | "\texport interface I${2:Service} {", 27 | "\t}", 28 | "\texport class ${2:Service} implements I${2:Service} {", 29 | "\t\tstatic \\$inject: Array = ['${3:dependency1}'];", 30 | "\t\tconstructor(private ${3:dependency1}: ${4:dependency1Type}) {}", 31 | "", 32 | "\t}", 33 | "", 34 | "\tangular", 35 | "\t\t.module('${5:Module}')", 36 | "\t\t.service('${2:Service}', ${2:Service});", 37 | "}" 38 | ] 39 | }, 40 | "Angular Module": { 41 | "prefix": "ng1module", 42 | "body": [ 43 | "namespace ${1:module} {", 44 | "\t'use strict';", 45 | "", 46 | "\tangular.module('${2:Module}', [", 47 | "\t\t$0", 48 | "\t]);", 49 | "}" 50 | ] 51 | } 52 | } 53 | --------------------------------------------------------------------------------