Skip to content

Commit 0370652

Browse files
committed
Merge pull request honza#343 from dbarnett/proto
Proto: Added snippets for Googles protobufs.
2 parents 4b9f18c + cf39d41 commit 0370652

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

Diff for: UltiSnips/proto.snippets

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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

0 commit comments

Comments
 (0)