Skip to content

Instantly share code, notes, and snippets.

@IlanFrumer
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save IlanFrumer/9358414 to your computer and use it in GitHub Desktop.

Select an option

Save IlanFrumer/9358414 to your computer and use it in GitHub Desktop.

Revisions

  1. IlanFrumer revised this gist Mar 5, 2014. 2 changed files with 76 additions and 30 deletions.
    76 changes: 76 additions & 0 deletions proto.tmLanguage.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,76 @@
    {
    "fileTypes": [
    "proto"
    ],
    "keyEquivalent": "^~P",
    "name": "Protocol Buffers",
    "patterns": [
    {
    "match": "\\b(default|enum|extend|extensions|message|option|package|rpc|returns|service)\\b",
    "name": "keyword.operator.proto"
    },
    {
    "begin": "//",
    "end": "$",
    "name": "comment.line.double-slash.proto"
    },
    {
    "begin": "\"",
    "end": "\"",
    "name": "string.quoted.double.proto"
    },
    {
    "match": "\\b(bool|bytes|double|fixed32|fixed64|float|int32|int64|sfixed32|sfixed64|sint32|sint64|string|uint32|uint64)\\b",
    "name": "storage.type.proto"
    },
    {
    "captures": {
    "1": {
    "name": "keyword.operator.proto"
    },
    "2": {
    "name": "storage.type.proto"
    }
    },
    "match": "\\b(repeated|required|optional)\\s+(\\w+)\\b"
    },
    {
    "match": "^(import)\\s",
    "name": "keyword.control.import.proto"
    },
    {
    "match": "\\b((([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)(L|l|F|f)?\\b",
    "name": "constant.numeric.proto"
    },
    {
    "captures": {
    "1": {
    "name": "entity.name.function.proto"
    }
    },
    "match": "\\b([a-zA-Z0-9_\\.]*?)\\("
    },
    {
    "begin": "/\\*",
    "captures": {
    "0": {
    "name": "punctuation.definition.comment.proto"
    }
    },
    "end": "\\*/",
    "name": "comment.block.proto"
    },
    {
    "begin": "//",
    "beginCaptures": {
    "0": {
    "name": "punctuation.definition.comment.proto"
    }
    },
    "end": "$\\n?",
    "name": "comment.line.double-slash.proto"
    }
    ],
    "scopeName": "source.proto",
    "uuid": "D6B0BFD2-F416-4E91-8C53-CD71EA3EE951"
    }
    30 changes: 0 additions & 30 deletions sample.proto
    Original file line number Diff line number Diff line change
    @@ -1,30 +0,0 @@
    // See README.txt for information and build instructions.

    package tutorial;

    option java_package = "com.example.tutorial";
    option java_outer_classname = "AddressBookProtos";

    message Person {
    required string name = 1;
    required int32 id = 2; // Unique ID number for this person.
    optional string email = 3;

    enum PhoneType {
    MOBILE = 0;
    HOME = 1;
    WORK = 2;
    }

    message PhoneNumber {
    required string number = 1;
    optional PhoneType type = 2 [default = HOME];
    }

    repeated PhoneNumber phone = 4;
    }

    // Our address book file is just one of these.
    message AddressBook {
    repeated Person person = 1;
    }
  2. IlanFrumer revised this gist Mar 5, 2014. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions proto.tmLanguage
    Original file line number Diff line number Diff line change
    @@ -38,7 +38,7 @@
    <key>match</key>
    <string>\b(bool|bytes|double|fixed32|fixed64|float|int32|int64|sfixed32|sfixed64|sint32|sint64|string|uint32|uint64)\b</string>
    <key>name</key>
    <string>storage.type.field.proto</string>
    <string>storage.type.proto</string>
    </dict>

    <dict>
    @@ -52,7 +52,7 @@
    <key>2</key>
    <dict>
    <key>name</key>
    <string>storage.type.field.proto</string>
    <string>storage.type.proto</string>
    </dict>
    </dict>
    <key>match</key>
  3. IlanFrumer revised this gist Mar 5, 2014. 1 changed file with 118 additions and 118 deletions.
    236 changes: 118 additions & 118 deletions proto.tmLanguage
    Original file line number Diff line number Diff line change
    @@ -2,123 +2,123 @@
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>fileTypes</key>
    <array>
    <string>proto</string>
    </array>
    <key>keyEquivalent</key>
    <string>^~P</string>
    <key>name</key>
    <string>Protocol Buffers</string>
    <key>patterns</key>
    <array>
    <dict>
    <key>match</key>
    <string>\b(default|enum|extend|extensions|message|option|package|rpc|returns|service)\b</string>
    <key>name</key>
    <string>keyword.operator.proto</string>
    </dict>
    <dict>
    <key>begin</key>
    <string>//</string>
    <key>end</key>
    <string>$</string>
    <key>name</key>
    <string>comment.line.double-slash.proto</string>
    </dict>
    <dict>
    <key>begin</key>
    <string>"</string>
    <key>end</key>
    <string>"</string>
    <key>name</key>
    <string>string.quoted.double.proto</string>
    </dict>
    <dict>
    <key>match</key>
    <string>\b(bool|bytes|double|fixed32|fixed64|float|int32|int64|sfixed32|sfixed64|sint32|sint64|string|uint32|uint64)\b</string>
    <key>name</key>
    <string>keyword.operator.proto</string>
    </dict>
    <key>fileTypes</key>
    <array>
    <string>proto</string>
    </array>
    <key>keyEquivalent</key>
    <string>^~P</string>
    <key>name</key>
    <string>Protocol Buffers</string>
    <key>patterns</key>
    <array>
    <dict>
    <key>match</key>
    <string>\b(default|enum|extend|extensions|message|option|package|rpc|returns|service)\b</string>
    <key>name</key>
    <string>keyword.operator.proto</string>
    </dict>
    <dict>
    <key>begin</key>
    <string>//</string>
    <key>end</key>
    <string>$</string>
    <key>name</key>
    <string>comment.line.double-slash.proto</string>
    </dict>
    <dict>
    <key>begin</key>
    <string>"</string>
    <key>end</key>
    <string>"</string>
    <key>name</key>
    <string>string.quoted.double.proto</string>
    </dict>
    <dict>
    <key>match</key>
    <string>\b(bool|bytes|double|fixed32|fixed64|float|int32|int64|sfixed32|sfixed64|sint32|sint64|string|uint32|uint64)\b</string>
    <key>name</key>
    <string>storage.type.field.proto</string>
    </dict>

    <dict>
    <key>captures</key>
    <dict>
    <key>1</key>
    <dict>
    <key>name</key>
    <string>keyword.operator.proto</string>
    </dict>
    <key>2</key>
    <dict>
    <key>name</key>
    <string>entity.name.function.proto</string>
    </dict>
    </dict>
    <key>match</key>
    <string>\b(repeated|required|optional)\s+(\w+)\b</string>
    </dict>

    <dict>
    <key>match</key>
    <string>^(import)\s</string>
    <key>name</key>
    <string>keyword.control.import.proto</string>
    </dict>
    <dict>
    <key>match</key>
    <string>\b((([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)(L|l|F|f)?\b</string>
    <key>name</key>
    <string>constant.numeric.proto</string>
    </dict>
    <dict>
    <key>captures</key>
    <dict>
    <key>1</key>
    <dict>
    <key>name</key>
    <string>entity.name.function.proto</string>
    </dict>
    </dict>
    <key>match</key>
    <string>\b([a-zA-Z0-9_\.]*?)\(</string>
    </dict>
    <dict>
    <key>begin</key>
    <string>/\*</string>
    <key>captures</key>
    <dict>
    <key>0</key>
    <dict>
    <key>name</key>
    <string>punctuation.definition.comment.proto</string>
    </dict>
    </dict>
    <key>end</key>
    <string>\*/</string>
    <key>name</key>
    <string>comment.block.proto</string>
    </dict>
    <dict>
    <key>begin</key>
    <string>//</string>
    <key>beginCaptures</key>
    <dict>
    <key>0</key>
    <dict>
    <key>name</key>
    <string>punctuation.definition.comment.proto</string>
    </dict>
    </dict>
    <key>end</key>
    <string>$\n?</string>
    <key>name</key>
    <string>comment.line.double-slash.proto</string>
    </dict>
    </array>
    <key>scopeName</key>
    <string>source.proto</string>
    <key>uuid</key>
    <string>D6B0BFD2-F416-4E91-8C53-CD71EA3EE951</string>
    <dict>
    <key>captures</key>
    <dict>
    <key>1</key>
    <dict>
    <key>name</key>
    <string>keyword.operator.proto</string>
    </dict>
    <key>2</key>
    <dict>
    <key>name</key>
    <string>storage.type.field.proto</string>
    </dict>
    </dict>
    <key>match</key>
    <string>\b(repeated|required|optional)\s+(\w+)\b</string>
    </dict>
    <dict>
    <key>match</key>
    <string>^(import)\s</string>
    <key>name</key>
    <string>keyword.control.import.proto</string>
    </dict>
    <dict>
    <key>match</key>
    <string>\b((([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)(L|l|F|f)?\b</string>
    <key>name</key>
    <string>constant.numeric.proto</string>
    </dict>
    <dict>
    <key>captures</key>
    <dict>
    <key>1</key>
    <dict>
    <key>name</key>
    <string>entity.name.function.proto</string>
    </dict>
    </dict>
    <key>match</key>
    <string>\b([a-zA-Z0-9_\.]*?)\(</string>
    </dict>
    <dict>
    <key>begin</key>
    <string>/\*</string>
    <key>captures</key>
    <dict>
    <key>0</key>
    <dict>
    <key>name</key>
    <string>punctuation.definition.comment.proto</string>
    </dict>
    </dict>
    <key>end</key>
    <string>\*/</string>
    <key>name</key>
    <string>comment.block.proto</string>
    </dict>
    <dict>
    <key>begin</key>
    <string>//</string>
    <key>beginCaptures</key>
    <dict>
    <key>0</key>
    <dict>
    <key>name</key>
    <string>punctuation.definition.comment.proto</string>
    </dict>
    </dict>
    <key>end</key>
    <string>$\n?</string>
    <key>name</key>
    <string>comment.line.double-slash.proto</string>
    </dict>
    </array>
    <key>scopeName</key>
    <string>source.proto</string>
    <key>uuid</key>
    <string>D6B0BFD2-F416-4E91-8C53-CD71EA3EE951</string>
    </dict>
    </plist>
    </plist>
  4. @romange romange revised this gist Mar 4, 2014. 1 changed file with 30 additions and 0 deletions.
    30 changes: 30 additions & 0 deletions sample.proto
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    // See README.txt for information and build instructions.

    package tutorial;

    option java_package = "com.example.tutorial";
    option java_outer_classname = "AddressBookProtos";

    message Person {
    required string name = 1;
    required int32 id = 2; // Unique ID number for this person.
    optional string email = 3;

    enum PhoneType {
    MOBILE = 0;
    HOME = 1;
    WORK = 2;
    }

    message PhoneNumber {
    required string number = 1;
    optional PhoneType type = 2 [default = HOME];
    }

    repeated PhoneNumber phone = 4;
    }

    // Our address book file is just one of these.
    message AddressBook {
    repeated Person person = 1;
    }
  5. @romange romange created this gist Mar 4, 2014.
    124 changes: 124 additions & 0 deletions proto.tmLanguage
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,124 @@
    <?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>fileTypes</key>
    <array>
    <string>proto</string>
    </array>
    <key>keyEquivalent</key>
    <string>^~P</string>
    <key>name</key>
    <string>Protocol Buffers</string>
    <key>patterns</key>
    <array>
    <dict>
    <key>match</key>
    <string>\b(default|enum|extend|extensions|message|option|package|rpc|returns|service)\b</string>
    <key>name</key>
    <string>keyword.operator.proto</string>
    </dict>
    <dict>
    <key>begin</key>
    <string>//</string>
    <key>end</key>
    <string>$</string>
    <key>name</key>
    <string>comment.line.double-slash.proto</string>
    </dict>
    <dict>
    <key>begin</key>
    <string>"</string>
    <key>end</key>
    <string>"</string>
    <key>name</key>
    <string>string.quoted.double.proto</string>
    </dict>
    <dict>
    <key>match</key>
    <string>\b(bool|bytes|double|fixed32|fixed64|float|int32|int64|sfixed32|sfixed64|sint32|sint64|string|uint32|uint64)\b</string>
    <key>name</key>
    <string>keyword.operator.proto</string>
    </dict>

    <dict>
    <key>captures</key>
    <dict>
    <key>1</key>
    <dict>
    <key>name</key>
    <string>keyword.operator.proto</string>
    </dict>
    <key>2</key>
    <dict>
    <key>name</key>
    <string>entity.name.function.proto</string>
    </dict>
    </dict>
    <key>match</key>
    <string>\b(repeated|required|optional)\s+(\w+)\b</string>
    </dict>

    <dict>
    <key>match</key>
    <string>^(import)\s</string>
    <key>name</key>
    <string>keyword.control.import.proto</string>
    </dict>
    <dict>
    <key>match</key>
    <string>\b((([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)(L|l|F|f)?\b</string>
    <key>name</key>
    <string>constant.numeric.proto</string>
    </dict>
    <dict>
    <key>captures</key>
    <dict>
    <key>1</key>
    <dict>
    <key>name</key>
    <string>entity.name.function.proto</string>
    </dict>
    </dict>
    <key>match</key>
    <string>\b([a-zA-Z0-9_\.]*?)\(</string>
    </dict>
    <dict>
    <key>begin</key>
    <string>/\*</string>
    <key>captures</key>
    <dict>
    <key>0</key>
    <dict>
    <key>name</key>
    <string>punctuation.definition.comment.proto</string>
    </dict>
    </dict>
    <key>end</key>
    <string>\*/</string>
    <key>name</key>
    <string>comment.block.proto</string>
    </dict>
    <dict>
    <key>begin</key>
    <string>//</string>
    <key>beginCaptures</key>
    <dict>
    <key>0</key>
    <dict>
    <key>name</key>
    <string>punctuation.definition.comment.proto</string>
    </dict>
    </dict>
    <key>end</key>
    <string>$\n?</string>
    <key>name</key>
    <string>comment.line.double-slash.proto</string>
    </dict>
    </array>
    <key>scopeName</key>
    <string>source.proto</string>
    <key>uuid</key>
    <string>D6B0BFD2-F416-4E91-8C53-CD71EA3EE951</string>
    </dict>
    </plist>