2014-04-18 08:58:02 -04:00
|
|
|
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.}
|
2017-08-03 11:21:37 -04:00
|
|
|
optional $1`!p snip.rv = complete(t[1], FIELD_TYPES)` ${2:name} = ${3:1}; // Required
|
2014-04-18 08:58:02 -04:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet optf "Optional field" b
|
|
|
|
// ${4:TODO(`whoami`): Describe this field.}
|
2017-08-03 11:21:37 -04:00
|
|
|
optional $1`!p snip.rv = complete(t[1], FIELD_TYPES)` ${2:name} = ${3:1};
|
2014-04-18 08:58:02 -04:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet repf "Repeated field" b
|
|
|
|
// ${4:TODO(`whoami`): Describe this field.}
|
2017-08-03 11:21:37 -04:00
|
|
|
repeated $1`!p snip.rv = complete(t[1], FIELD_TYPES)` ${2:name} = ${3:1};
|
2014-04-18 08:58:02 -04:00
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet enum "Enumeration" b
|
|
|
|
// ${2:TODO(`whoami`): Describe this enum.}
|
|
|
|
enum ${1:Name} {
|
|
|
|
}
|
|
|
|
endsnippet
|