aboutsummaryrefslogtreecommitdiff
path: root/vim/bundle/vim-snippets/UltiSnips/proto.snippets
blob: 923be5786d4a16ac7217e0aa72b4a13ad0926307 (plain)
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
priority -50

global !p
from vimsnippets import complete

FIELD_TYPES = [
	'double',
	'float',
	'int32',
	'int64',
	'uint32',
	'uint64',
	'sint32',
	'sint64',
	'fixed32',
	'fixed64',
	'sfixed32',
	'sfixed64',
	'bool',
	'string',
	'bytes']
endglobal

snippet mess "Proto message" b
// ${2:TODO(`whoami`): Describe this message.}
message ${1:Name} {
	$0

	// Next available id: 1
}
endsnippet

snippet reqf "Required field" b
// ${4:TODO(`whoami`): Describe this field.}
optional ${1}`!p snip.rv = complete(t[1], FIELD_TYPES)` ${2:name} = ${3:1};  // Required
endsnippet

snippet optf "Optional field" b
// ${4:TODO(`whoami`): Describe this field.}
optional ${1}`!p snip.rv = complete(t[1], FIELD_TYPES)` ${2:name} = ${3:1};
endsnippet

snippet repf "Repeated field" b
// ${4:TODO(`whoami`): Describe this field.}
repeated ${1}`!p snip.rv = complete(t[1], FIELD_TYPES)` ${2:name} = ${3:1};
endsnippet

snippet enum "Enumeration" b
// ${2:TODO(`whoami`): Describe this enum.}
enum ${1:Name} {
}
endsnippet