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