-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
76a4d7e
Add message and field snippets for proto filetype
dbarnett 280f775
Merge branch 'master' of https://github.com/honza/vim-snippets into p…
dbarnett e3c6399
Add type completions
dbarnett 3f3b2d5
Add tabstop for message body
dbarnett cf39d41
rm unnecessary empty lines
dbarnett File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add type completions
- Loading branch information
commit e3c6399f8c4406105ce2d70641b111f99c16e5a1
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'] | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unnecessary empty line. |
||
endglobal | ||
|
||
snippet mess "Proto message" b | ||
// ${2:TODO(`whoami`): Describe this message.} | ||
message ${1:Name} { | ||
|
@@ -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 | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unnecessary empty line