Add type completions
This commit is contained in:
parent
280f775ab3
commit
e3c6399f8c
@ -1,5 +1,28 @@
|
|||||||
priority -50
|
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
|
snippet mess "Proto message" b
|
||||||
// ${2:TODO(`whoami`): Describe this message.}
|
// ${2:TODO(`whoami`): Describe this message.}
|
||||||
message ${1:Name} {
|
message ${1:Name} {
|
||||||
@ -10,17 +33,17 @@ endsnippet
|
|||||||
|
|
||||||
snippet reqf "Required field" b
|
snippet reqf "Required field" b
|
||||||
// ${4:TODO(`whoami`): Describe this field.}
|
// ${4:TODO(`whoami`): Describe this field.}
|
||||||
optional ${1:type} ${2:name} = ${3:1}; // Required
|
optional ${1:type}`!p snip.rv = complete(t[1], FIELD_TYPES)` ${2:name} = ${3:1}; // Required
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet optf "Optional field" b
|
snippet optf "Optional field" b
|
||||||
// ${4:TODO(`whoami`): Describe this field.}
|
// ${4:TODO(`whoami`): Describe this field.}
|
||||||
optional ${1:type} ${2:name} = ${3:1};
|
optional ${1:type}`!p snip.rv = complete(t[1], FIELD_TYPES)` ${2:name} = ${3:1};
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet repf "Repeated field" b
|
snippet repf "Repeated field" b
|
||||||
// ${4:TODO(`whoami`): Describe this field.}
|
// ${4:TODO(`whoami`): Describe this field.}
|
||||||
repeated ${1:type} ${2:name} = ${3:1};
|
repeated ${1:type}`!p snip.rv = complete(t[1], FIELD_TYPES)` ${2:name} = ${3:1};
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
snippet enum "Enumeration" b
|
snippet enum "Enumeration" b
|
||||||
|
Loading…
x
Reference in New Issue
Block a user