-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Thrift: Add enum snippet and accompanying enum field macro
git-svn-id: http://svn.textmate.org/trunk/Bundles/Thrift.tmbundle@10084 dfb7d73b-c2ec-0310-8fea-fb051d288c6d
- Loading branch information
Showing
6 changed files
with
148 additions
and
5 deletions.
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>beforeRunningCommand</key> | ||
<string>nop</string> | ||
<key>command</key> | ||
<string>#!/usr/bin/env ruby | ||
if ENV['TM_CURRENT_LINE'] =~ /^\s*[\w.]+\s*=\s*(\d+)\s*[,;]?\s*$/ | ||
idx = $1.to_i + 1 | ||
else | ||
idx = 1 | ||
end | ||
if ENV['TM_CURRENT_LINE'] =~ /^\s+/ | ||
indent = '' | ||
else | ||
indent = "\t" | ||
end | ||
puts | ||
print "#{indent}${1:FIELD} = ${2:#{idx}},$0" | ||
</string> | ||
<key>fallbackInput</key> | ||
<string>line</string> | ||
<key>input</key> | ||
<string>none</string> | ||
<key>name</key> | ||
<string>enum field</string> | ||
<key>output</key> | ||
<string>insertAsSnippet</string> | ||
<key>scope</key> | ||
<string>meta.enum.thrift</string> | ||
<key>uuid</key> | ||
<string>841E598E-C872-4A98-A4D5-F13272F51B6F</string> | ||
</dict> | ||
</plist> |
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
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 |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>commands</key> | ||
<array> | ||
<dict> | ||
<key>command</key> | ||
<string>moveToEndOfParagraph:</string> | ||
</dict> | ||
<dict> | ||
<key>argument</key> | ||
<dict> | ||
<key>beforeRunningCommand</key> | ||
<string>nop</string> | ||
<key>command</key> | ||
<string>#!/usr/bin/env ruby | ||
|
||
if ENV['TM_CURRENT_LINE'] =~ /^\s*[\w.]+\s*=\s*(\d+)\s*[,;]?\s*$/ | ||
idx = $1.to_i + 1 | ||
else | ||
idx = 1 | ||
end | ||
|
||
if ENV['TM_CURRENT_LINE'] =~ /^\s+/ | ||
indent = '' | ||
else | ||
indent = "\t" | ||
end | ||
|
||
puts | ||
print "#{indent}${1:FIELD} = ${2:#{idx}},$0" | ||
</string> | ||
<key>fallbackInput</key> | ||
<string>line</string> | ||
<key>input</key> | ||
<string>none</string> | ||
<key>keyEquivalent</key> | ||
<string></string> | ||
<key>name</key> | ||
<string>enum field</string> | ||
<key>output</key> | ||
<string>insertAsSnippet</string> | ||
<key>scope</key> | ||
<string>meta.enum.thrift</string> | ||
<key>uuid</key> | ||
<string>841E598E-C872-4A98-A4D5-F13272F51B6F</string> | ||
</dict> | ||
<key>command</key> | ||
<string>executeCommandWithOptions:</string> | ||
</dict> | ||
</array> | ||
<key>keyEquivalent</key> | ||
<string></string> | ||
<key>name</key> | ||
<string>enum field</string> | ||
<key>scope</key> | ||
<string>meta.enum.thrift</string> | ||
<key>uuid</key> | ||
<string>C334A09A-D090-4EC1-AD14-23FB9AF4D287</string> | ||
</dict> | ||
</plist> |
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
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>content</key> | ||
<string>enum ${1:Name} { | ||
${2:FIELD} = ${3:1},$0 | ||
}</string> | ||
<key>name</key> | ||
<string>enum</string> | ||
<key>scope</key> | ||
<string>source.thrift -meta</string> | ||
<key>tabTrigger</key> | ||
<string>enu</string> | ||
<key>uuid</key> | ||
<string>C1341136-77B4-433A-A17D-C0ECE06A3402</string> | ||
</dict> | ||
</plist> |
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