Sublime Text3 protobuf syntax file(语法文件)
将以下两个文件放置在X:XXX\Sublime Text 3x64\Data\Packages\User目录下,就可以为sublime3添加protobuf文件的语法高亮规则.
文件名:Protobuf.JSON-tmLanguage
文件内容:
1 { 2 "name": "ProtoBuf", 3 "scopeName": "source.proto", 4 "fileTypes": ["proto"], 5 "foldingStartMarker": "{", 6 "foldingStopMarker": "}", 7 "patterns": [ 8 { "match": "\\s+[0-9]*", 9 "name": "constant.numeric.proto", 10 "comment": "Field numbers" 11 }, 12 { "match": "double|float|int32|int64|uint32|uint64|sint32|sint64|long|fixed32|fixed64|sfixed|sfixed64|bool|string|bytes", 13 "name": "storage.type.source.proto", 14 "comment": "Scalar Value types." 15 }, 16 { "match": "optional|required|repeated|default", 17 "name": "storage.modifier.source.proto", 18 "comment": "Field Rules" 19 }, 20 { "match": "^message|^package|^option|^import|^extend|^service", 21 "name": "entity.name.function.proto", 22 "comment": "Message section" 23 }, 24 { "match": "\/\/.*", 25 "name": "comment.line.double-slash.proto", 26 "comment": "Comments" 27 } 28 ], 29 "uuid": "7c5e8e41-b1b7-40e2-a140-9c0c667e1ad7" 30 }
文件名:Protobuf.tmLanguage
文件内容:
1 <?xml version="1.0" encoding="UTF-8"?> 2 <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 3 <plist version="1.0"> 4 <dict> 5 <key>fileTypes</key> 6 <array> 7 <string>proto</string> 8 </array> 9 <key>foldingStartMarker</key> 10 <string>{</string> 11 <key>foldingStopMarker</key> 12 <string>}</string> 13 <key>name</key> 14 <string>ProtoBuf</string> 15 <key>patterns</key> 16 <array> 17 <dict> 18 <key>comment</key> 19 <string>Field numbers</string> 20 <key>match</key> 21 <string>\s+[0-9]*</string> 22 <key>name</key> 23 <string>constant.numeric.proto</string> 24 </dict> 25 <dict> 26 <key>comment</key> 27 <string>Scalar Value types.</string> 28 <key>match</key> 29 <string>double|float|int32|int64|uint32|uint64|sint32|sint64|long|fixed32|fixed64|sfixed|sfixed64|bool|string|bytes</string> 30 <key>name</key> 31 <string>storage.type.source.proto</string> 32 </dict> 33 <dict> 34 <key>comment</key> 35 <string>Field Rules</string> 36 <key>match</key> 37 <string>optional|required|repeated|default</string> 38 <key>name</key> 39 <string>storage.modifier.source.proto</string> 40 </dict> 41 <dict> 42 <key>comment</key> 43 <string>Message section</string> 44 <key>match</key> 45 <string>^message|^package|^option|^import|^extend|^service</string> 46 <key>name</key> 47 <string>entity.name.function.proto</string> 48 </dict> 49 <dict> 50 <key>comment</key> 51 <string>Comments</string> 52 <key>match</key> 53 <string>//.*</string> 54 <key>name</key> 55 <string>comment.line.double-slash.proto</string> 56 </dict> 57 </array> 58 <key>scopeName</key> 59 <string>source.proto</string> 60 <key>uuid</key> 61 <string>7c5e8e41-b1b7-40e2-a140-9c0c667e1ad7</string> 62 </dict> 63 </plist>