Add snippets

This commit is contained in:
Tobe O 2018-11-12 03:22:54 -05:00
parent 3d54ba83b9
commit 2596b53813
3 changed files with 166 additions and 35 deletions

BIN
angel_vscode/media/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View file

@ -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"
}
}

View file

@ -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...",
"}"
]
}
}
}