From 3d94211018aa28c32605e001e62b3dbe7f9305f3 Mon Sep 17 00:00:00 2001 From: Alexander Kiryukhin Date: Fri, 19 Mar 2021 02:22:55 +0300 Subject: v0.0.1 --- snippets.json | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 snippets.json (limited to 'snippets.json') diff --git a/snippets.json b/snippets.json new file mode 100644 index 0000000..294d806 --- /dev/null +++ b/snippets.json @@ -0,0 +1,65 @@ +{ + "Interface declaration": { + "body": [ + "type $1 interface {", + "\t$0", + "}" + ], + "description": "go interface type", + "prefix": "tyi" + }, + "Package line": { + "body": [ + "package ${TM_DIRECTORY/.+\\/(.+)$/${1:/downcase}/}", + "", + "$0" + ], + "description": "package header", + "prefix": "pkg" + }, + "Stack from array": { + "body": [ + "type ${1:name} []${2:type}", + "", + "func (s *$1) Push(item $2) {", + "\t*s = append(*s, item)", + "}", + "", + "func (s *$1) Pop() (item $2) {", + "\tif len(*s) == 0 {", + "\t\treturn", + "\t}", + "", + "\t*s, item = (*s)[:len(*s)-1], (*s)[len(*s)-1]", + "\treturn item", + "}" + ], + "description": "stack from array type", + "prefix": "stack" + }, + "Structure constructor": { + "body": [ + "// New instance of $1 type.", + "func New${1:type}(${2}) *$1 {", + "\t$3", + "\treturn &$1{$4}", + "}" + ], + "description": "constructor for structure type", + "prefix": "construct" + }, + "Structure declaration": { + "body": [ + "type $1 struct {", + "\t$0", + "}" + ], + "description": "strucutre type", + "prefix": "tys" + }, + "Variable declaration": { + "body": "var $1 $2 = $3", + "description": "variable with type and value", + "prefix": "var" + } +} -- cgit v1.2.3