From e8563a5e6f431fb953ad738262b5150b8349582d Mon Sep 17 00:00:00 2001 From: NeonXP Date: Sun, 6 Aug 2023 01:23:45 +0300 Subject: fix if err... code action --- snippets/snippets.json | 32 ++++++-------------------------- 1 file changed, 6 insertions(+), 26 deletions(-) (limited to 'snippets/snippets.json') diff --git a/snippets/snippets.json b/snippets/snippets.json index 456a661..91f898d 100644 --- a/snippets/snippets.json +++ b/snippets/snippets.json @@ -1,5 +1,5 @@ { - "Package line": { + "package line": { "body": [ "package ${TM_DIRECTORY/.+\\/(.+)$/${1:/downcase}/}", "", @@ -8,27 +8,7 @@ "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": { + "structure constructor": { "body": [ "// New$1 returns new $1.", "func New${1:type}(${2}) *$1 {", @@ -39,9 +19,9 @@ "description": "constructor for structure type", "prefix": "construct" }, - "Variable declaration": { - "body": "var $1 $2 = $3", - "description": "variable with type and value", - "prefix": "var" + "if err := ...; err != nil": { + "prefix": "iferr", + "body": "if err := ${1}; err != nil {\n\t${2:return ${3:nil, }${4:err}}\n}", + "description": "Snippet for if err := ...; err != nil" } } -- cgit v1.2.3