├── .vscodeignore ├── doc └── img │ ├── doc.gif │ ├── field.gif │ ├── contract.gif │ └── controller.gif ├── .gitignore ├── CHANGELOG.md ├── package.json ├── README.md ├── vsc-extension-quickstart.md └── snippets └── snippets.json /.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | .gitignore 4 | vsc-extension-quickstart.md 5 | -------------------------------------------------------------------------------- /doc/img/doc.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taccisum/swagger-doc-snippets/HEAD/doc/img/doc.gif -------------------------------------------------------------------------------- /doc/img/field.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taccisum/swagger-doc-snippets/HEAD/doc/img/field.gif -------------------------------------------------------------------------------- /doc/img/contract.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taccisum/swagger-doc-snippets/HEAD/doc/img/contract.gif -------------------------------------------------------------------------------- /doc/img/controller.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/taccisum/swagger-doc-snippets/HEAD/doc/img/controller.gif -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | logs/ 2 | npm-debug.log 3 | yarn-error.log 4 | node_modules/ 5 | package-lock.json 6 | yarn.lock 7 | coverage/ 8 | .idea/ 9 | run/ 10 | .DS_Store 11 | *.sw* 12 | *.un~ 13 | typings/ 14 | .nyc_output/ 15 | 16 | .vscode/ 17 | *.vsix 18 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to the "swagger-doc-snippets" extension will be documented in this file. 4 | 5 | Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. 6 | 7 | ## [Unreleased] 8 | 9 | - Initial release -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "swagger-doc-snippets", 3 | "publisher": "taccisum", 4 | "displayName": "swagger-doc snippets", 5 | "description": "code snippets for swagger-doc", 6 | "version": "0.1.0", 7 | "engines": { 8 | "vscode": "^1.35.0" 9 | }, 10 | "categories": [ 11 | "Snippets" 12 | ], 13 | "contributes": { 14 | "snippets": [ 15 | { 16 | "language": "javascript", 17 | "path": "./snippets/snippets.json" 18 | }, 19 | { 20 | "language": "typescript", 21 | "path": "./snippets/snippets.json" 22 | } 23 | ] 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # swagger-doc-snippets 2 | 3 | this extension is code snippets for [swagger-doc](https://github.com/Ysj291823/egg-swagger-doc#readme). 4 | 5 | ## Supported Snippets 6 | 7 | ### swagger doc 8 | 9 | 10 | 11 | ### swagger controller 12 | 13 | 14 | 15 | ### swagger contract 16 | 17 | 18 | 19 | ### swagger contract field 20 | 21 | 22 | 23 | ## Known Issues 24 | 25 | Nothing now. 26 | 27 | ## Release Notes 28 | 29 | ### v0.1.0 30 | 31 | - 支持.ts 32 | 33 | ### v0.0.1 34 | 35 | - 支持.js 36 | -------------------------------------------------------------------------------- /vsc-extension-quickstart.md: -------------------------------------------------------------------------------- 1 | # Welcome to your VS Code Extension 2 | 3 | ## What's in the folder 4 | 5 | * This folder contains all of the files necessary for your extension. 6 | * `package.json` - this is the manifest file that defines the location of the snippet file and specifies the language of the snippets. 7 | * `snippets/snippets.json` - the file containing all snippets. 8 | 9 | ## Get up and running straight away 10 | 11 | * Press `F5` to open a new window with your extension loaded. 12 | * Create a new file with a file name suffix matching your language. 13 | * Verify that your snippets are proposed on intellisense. 14 | 15 | ## Make changes 16 | 17 | * You can relaunch the extension from the debug toolbar after making changes to the files listed above. 18 | * You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes. 19 | 20 | ## Install your extension 21 | 22 | * To start using your extension with Visual Studio Code copy it into the `/.vscode/extensions` folder and restart Code. 23 | * To share your extension with the world, read on https://code.visualstudio.com/docs about publishing an extension. 24 | -------------------------------------------------------------------------------- /snippets/snippets.json: -------------------------------------------------------------------------------- 1 | { 2 | "Swagger_Annotation": { 3 | "prefix": "swagger doc", 4 | "body": [ 5 | "/**", 6 | "* @summary $1", 7 | "* @description $2", 8 | "* @router ${3|get,post,put,delete,patch,head|} /${4}", 9 | "* @request ${5|query,body,path,header,formData|} ${6|integer,string,boolean,number|} ${7:field_name} ${9:desc}", 10 | "* @response ${10|200,201,202,203,204,205,206|} ${11|integer,string,boolean,number|} ${12:desc}", 11 | "*/" 12 | ], 13 | "description": "swagger doc" 14 | }, 15 | "Swagger_Controller": { 16 | "prefix": "swagger controller", 17 | "body": [ 18 | "/**", 19 | "* @controller $1", 20 | "*/" 21 | ], 22 | "description": "swagger controller" 23 | }, 24 | "Swagger_Contract": { 25 | "prefix": "swagger contract", 26 | "body": [ 27 | "module.exports = {", 28 | " ${1:model}: {", 29 | " ${2:field}: { type: '${3|integer,string,boolean,number|}', required: ${4|true,false|}, example: '${5:ex}' },$0", 30 | " }", 31 | "};" 32 | ], 33 | "description": "swagger contract" 34 | }, 35 | "Swagger_Contract_Field": { 36 | "prefix": "swagger contract field", 37 | "body": [ 38 | "${1:field}: { type: '${2|integer,string,boolean,number|}', required: ${3|true,false|}, example: '${4:ex}' },$0" 39 | ], 40 | "description": "swagger contract field" 41 | } 42 | } 43 | --------------------------------------------------------------------------------