Skip to content

Commit

Permalink
Add type completions
Browse files Browse the repository at this point in the history
  • Loading branch information
dbarnett committed Apr 13, 2014
1 parent 280f775 commit e3c6399
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions UltiSnips/proto.snippets
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
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} {
Expand All @@ -10,17 +33,17 @@ endsnippet

snippet reqf "Required field" b
// ${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

snippet optf "Optional field" b
// ${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

snippet repf "Repeated field" b
// ${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

snippet enum "Enumeration" b
Expand Down

0 comments on commit e3c6399

Please sign in to comment.