File tree 1 file changed +52
-0
lines changed
1 file changed +52
-0
lines changed Original file line number Diff line number Diff line change
1
+ priority -50
2
+
3
+ global !p
4
+ from vimsnippets import complete
5
+
6
+ FIELD_TYPES = [
7
+ ' double' ,
8
+ ' float' ,
9
+ ' int32' ,
10
+ ' int64' ,
11
+ ' uint32' ,
12
+ ' uint64' ,
13
+ ' sint32' ,
14
+ ' sint64' ,
15
+ ' fixed32' ,
16
+ ' fixed64' ,
17
+ ' sfixed32' ,
18
+ ' sfixed64' ,
19
+ ' bool' ,
20
+ ' string' ,
21
+ ' bytes' ]
22
+ endglobal
23
+
24
+ snippet mess " Proto message" b
25
+ // ${2: TODO(`whoami`): Describe this message. }
26
+ message ${1: Name } {
27
+ $0
28
+
29
+ // Next available id: 1
30
+ }
31
+ endsnippet
32
+
33
+ snippet reqf " Required field" b
34
+ // ${4: TODO(`whoami`): Describe this field. }
35
+ optional ${1: type } `!p snip.rv = complete(t[1 ], FIELD_TYPES ) ` ${2: name } = ${3: 1 } ; // Required
36
+ endsnippet
37
+
38
+ snippet optf " Optional field" b
39
+ // ${4: TODO(`whoami`): Describe this field. }
40
+ optional ${1: type } `!p snip.rv = complete(t[1 ], FIELD_TYPES ) ` ${2: name } = ${3: 1 } ;
41
+ endsnippet
42
+
43
+ snippet repf " Repeated field" b
44
+ // ${4: TODO(`whoami`): Describe this field. }
45
+ repeated ${1: type } `!p snip.rv = complete(t[1 ], FIELD_TYPES ) ` ${2: name } = ${3: 1 } ;
46
+ endsnippet
47
+
48
+ snippet enum " Enumeration" b
49
+ // ${2: TODO(`whoami`): Describe this enum. }
50
+ enum ${1: Name } {
51
+ }
52
+ endsnippet
You can’t perform that action at this time.
0 commit comments