Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add message and field snippets for proto filetype #343

Merged
merged 5 commits into from
Apr 14, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions UltiSnips/proto.snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,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: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}`!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}`!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