-
Notifications
You must be signed in to change notification settings - Fork 3
/
goa.snippets
89 lines (73 loc) · 1.7 KB
/
goa.snippets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
global !p
from snippets import *
from snippets.go import *
import px
def is_inside_section(snip, *names):
return px.whitespaces.match_higher_indent(
snip.buffer, snip.cursor, '|'.join(names)+'\('
)
endglobal
snippet r "declare resource" b
Resource("$1", func() {
$0
})
endsnippet
context "is_inside_section(snip, 'API')"
snippet t "declare trait" b
Trait("$1", func() {
$0
})
endsnippet
context "is_inside_section(snip, 'Resource')"
snippet a "declare action" b
Action("$1", func() {
$0
})
endsnippet
context "is_inside_section(snip, 'Action', 'MediaType')"
snippet d "declare description" b
Description("$1")
endsnippet
context "is_inside_section(snip, 'MediaType')"
snippet a "declare attributes" b
Attributes(func () {
$1
})
endsnippet
context "is_inside_section(snip, 'Action')"
snippet r "declare routing" b
Routing(${1:GET}("$2"))
endsnippet
context "is_inside_section(snip, 'Action')"
snippet p "declare params" b
Params(func() {
$0
})
endsnippet
priority 100
context "is_inside_section(snip, 'Action')"
snippet e "declare response" b
Response($1)
endsnippet
context "is_inside_section(snip, 'Action')"
snippet eo "declare response ok" b
Response(OK)
endsnippet
context "is_inside_section(snip, 'Action')"
snippet en "declare response notfound" b
Response(NotFound)
endsnippet
context "is_inside_section(snip, 'Params')"
snippet p "declare one param" b
Param("$1", ${2:Type}, "${3:Description}")
endsnippet
context "is_inside_section(snip, 'Attributes?', 'Type')"
snippet a "declare one attribute" b
Attribute("$1", ${2:Type}, "${3:Description}")
endsnippet
context "is_inside_section(snip, 'MediaType')"
snippet v "declare view" b
View("${1:default}", func() {
$0
})
endsnippet