From 2596b5381343681566e0d2ff48c8c75376619762 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Mon, 12 Nov 2018 03:22:54 -0500 Subject: [PATCH] Add snippets --- angel_vscode/media/logo.png | Bin 0 -> 2853 bytes angel_vscode/package.json | 88 ++++++++++++++---------- angel_vscode/snippets/angel.json | 113 +++++++++++++++++++++++++++++++ 3 files changed, 166 insertions(+), 35 deletions(-) create mode 100644 angel_vscode/media/logo.png create mode 100644 angel_vscode/snippets/angel.json diff --git a/angel_vscode/media/logo.png b/angel_vscode/media/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..8be3ad791e165bad029dcf6f9c23c6aeb1c66fc9 GIT binary patch literal 2853 zcmaJ@XIN9&77aZCK}sm{R6^)24G0jWB>{;P1JV=}E+LR8DI@_xk)T8cMMQAKL2<-U zP>>>6p9mNklrl2lC`Ay1g7i8geSE=D=lyuT``vrbKKom1?Q-^ylS%g3p{%H@2m*nW zNghN$$?CHHf#oItQhMwg$+C&(7R=ktisB^z94g2)k`+OPkr+TU)sG59CdM{Xw}U`3 zhIId6Ua+?pj>2LffOQOl&tOZ~AkcPaJ{zDMr1D@9)Mz@>5kCE}9uA{NI>Li&y;0t5 z0+mMhNa9d;C;9kOk`7WFBH_+Xu`jIdSR5+M7GZ5gL7~wwEEa*bvBhH1mM{zojX|O$FV+fegR{lrFm|vn4_p$B z6B&i`Bf5WyCD}Q`X*?bqheReMBp?#35iCwL67AsNu&#l@SV<68+(af1;9D`d245A3 zR4#=>XY=SRCTv|1h+xI>9O05o|1N>S{wB-herc1WVMso}Mxqg@^^(2^muBdJBP)9eJ&bD|9&p^ z-_`rVjr@Kt4&UV>CCMPykM_Tg`m0MaKkMeV!If;jjXsqrnRkw4uy>9=^8kSq@<~Kj ze|~RY2tCF>0Geuj``Wc@CtoSw0$(9t^>x*k)>RW^gs=g~74q2ww-Et9yW3ok9X;#T zc*+!h-IwhuTVxJ{Nx!W22u(XiB`TU~n&CU{w()%yjT5t34?b8ej*;p%6h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P8sYX`vIw^+fS3AZb6%ID#KTG{&Jj=Te4q^h z1BIeKpiUug+9Gsq<88qdKCw8>SM;)ShW6)=1dQfWju=bY-R+%g4kO%OZq4f4r69Us zny=JkJuWE6kPE>5rOmn*dS(cA<&!o*bmk$!m9e)uZ!a4LrKf0J<~CS3eO!B7nr?(Z zRm*u@s(I9$tK_fQkhvpMD@81$X|YCbP&Or`TgIa5hwn&tFHEzf%Gw_^>Gs!l*7`ND zC+i0~tMlAZf-8fqL|IOGS}0V{HNPDkW(@yVpX<=ubBwJG$F&~Hr_3qKYYw;~?bB-N zs`PANENO2`+1fsv@uRdn z(7hnN^1R#Ke3QKclMqPT zPfur~nA~o|DbGMbfkIx_TTbqwUuH=b=8mLZ8u7@4fFfJG`DOOhy@#4kMM-(#tD#%w zk8l3Nb}-5}jhousk%(POIvwa7K%RBu<^$(>(H zR%BvjWJdxQRg1?E8+R0NwDa1l;I7O#y}(Gnid!Ygs6;1Ln@Lj{)T^LfZ`R?xvV7gm jx#x-C!eb$k0wom4?$QJ5X&YAe`o)#x=0mK&hadS5nCG_x literal 0 HcmV?d00001 diff --git a/angel_vscode/package.json b/angel_vscode/package.json index 74c6f9c6..858d2c91 100644 --- a/angel_vscode/package.json +++ b/angel_vscode/package.json @@ -1,38 +1,56 @@ { - "name": "angel-dart-vscode", - "displayName": "Angel Dart Support", - "description": "Snippets and IDE support for the Angel server framework within VSCode.", - "version": "0.0.1", - "publisher": "thosakwe", - "engines": { - "vscode": "^1.28.0" - }, - "categories": [ - "Other" - ], - "activationEvents": [ - "onCommand:extension.sayHello" - ], - "main": "./out/extension", - "contributes": { - "commands": [ - { - "command": "extension.sayHello", - "title": "Hello World" - } - ] - }, - "scripts": { - "vscode:prepublish": "npm run compile", - "compile": "tsc -p ./", - "watch": "tsc -watch -p ./", - "postinstall": "node ./node_modules/vscode/bin/install", - "test": "npm run compile && node ./node_modules/vscode/bin/test" - }, - "devDependencies": { - "typescript": "^2.6.1", - "vscode": "^1.1.6", - "@types/node": "^7.0.43", - "@types/mocha": "^2.2.42" + "name": "angel-dart-vscode", + "displayName": "Angel Dart Support", + "description": "Snippets and IDE support for the Angel server framework within VSCode.", + "version": "0.0.1", + "repository": { + "type": "git", + "url": "https://github.com/angel-dart/vscode" + }, + "icon": "media/logo.png", + "publisher": "thosakwe", + "engines": { + "vscode": "^1.28.0" + }, + "categories": [ + "Snippets" + ], + "keywords": [ + "angel", + "angel-dart", + "dart", + "flutter", + "fuchsia" + ], + "snippets": [ + { + "language": "dart", + "path": "./snippets/angel.json" } + ], + "activationEvents": [ + "onCommand:extension.sayHello" + ], + "main": "./out/extension", + "contributes": { + "commands": [ + { + "command": "extension.sayHello", + "title": "Hello World" + } + ] + }, + "scripts": { + "vscode:prepublish": "npm run compile", + "compile": "tsc -p ./", + "watch": "tsc -watch -p ./", + "postinstall": "node ./node_modules/vscode/bin/install", + "test": "npm run compile && node ./node_modules/vscode/bin/test" + }, + "devDependencies": { + "typescript": "^2.6.1", + "vscode": "^1.1.6", + "@types/node": "^7.0.43", + "@types/mocha": "^2.2.42" + } } diff --git a/angel_vscode/snippets/angel.json b/angel_vscode/snippets/angel.json new file mode 100644 index 00000000..c432e595 --- /dev/null +++ b/angel_vscode/snippets/angel.json @@ -0,0 +1,113 @@ +{ + ".source.dart": { + "controller": { + "prefix": "angel:controller", + "description": "Generate an Angel Controller.", + "body": [ + "import 'package:angel_framework/angel_framework.dart';", + "", + "@Expose('/$1')", + "class $1Controller extends Controller {", + " @Expose('/')", + " String hello() {", + " return 'Hello, world';", + " }", + "}" + ] + }, + "websocket_controller": { + "prefix": "angel:websocket_controller", + "description": "Generate an Angel WebSocketController.", + "body": [ + "import 'package:angel_websocket/server.dart';", + "", + "class $1Controller extends WebSocketController {", + " $1Controller(AngelWebSocket ws) : super(ws);", + "", + " @ExposeWs('ping')", + " void hello(WebSocketContext socket) {", + " socket.send('pong', {'message': 'Hello, world!'});", + " }", + "}" + ] + }, + "model": { + "prefix": "angel:model", + "description": "Generate an Angel Model.", + "body": [ + "import 'package:angel_model/angel_model.dart';", + "import 'package:angel_serialize/angel_serialize.dart';", + "part '$2.g.dart';", + "part '$2.serializer.g.dart';", + "", + "@serializable", + "abstract class _$1 extends Model {", + " $3", + "}" + ] + }, + "migration": { + "prefix": "angel:migration", + "description": "Generate an Angel ORM Migration.", + "body": [ + "import 'package:angel_migration.dart/angel_migration.dart';", + "", + "class $1Migration extends Migration {", + " @override", + " void up(Schema schema) {", + " schema.create('$2', (table) {", + " table.serial('id').primaryKey();", + " table.date('created_at');", + " table.date('updated_at');", + " $3", + " });", + " }", + "", + " @override", + " void down(Schema schema) {", + " schema.drop('$2');", + " }", + "}" + ] + }, + "plugin": { + "prefix": "angel:plugin", + "description": "Generate an Angel plugin.", + "body": [ + "import 'package:angel_framework/angel_framework.dart';", + "", + "AngelConfigurer $1() {", + " return (Angel app) async {", + " // Work some magic...", + " $2", + " };", + "}" + ] + }, + "test_driver": { + "prefix": "angel:test", + "description": "Generate an Angel test driver.", + "body": [ + "import 'dart:io';", + "import 'package:$1/$1.dart' as $1;", + "import 'package:angel_framework/angel_framework.dart';", + "import 'package:angel_test/angel_test.dart';", + "import 'package:test/test.dart';", + "", + "main() async {", + " TestClient client;", + "", + " setUp(() async {", + " var app = new Angel();", + " await app.configure($1.configureServer);", + " client = await connectTo(app);", + " });", + "", + " tearDown(() => client.close());", + "", + " // Add your tests here...", + "}" + ] + } + } +}