ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Pretty Protobuf

by hanfezh ST4

Plugin to prettify Protobuf message debug string for Sublime Text 4

Details

Installs

  • Total 1K
  • Win 487
  • Mac 827
  • Linux 129
May 20 May 19 May 18 May 17 May 16 May 15 May 14 May 13 May 12 May 11 May 10 May 9 May 8 May 7 May 6 May 5 May 4 May 3 May 2 May 1 Apr 30 Apr 29 Apr 28 Apr 27 Apr 26 Apr 25 Apr 24 Apr 23 Apr 22 Apr 21 Apr 20 Apr 19 Apr 18 Apr 17 Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5
Windows 0 0 0 0 1 1 1 1 0 0 0 1 0 1 0 0 0 0 0 0 0 2 0 0 0 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 2 1 1 0 2 0
Mac 0 0 0 0 0 2 1 1 0 0 0 1 0 2 0 0 2 0 1 0 1 0 0 1 0 0 2 1 2 0 1 2 0 2 0 3 0 1 2 1 3 1 0 1 0 1
Linux 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

Pretty Protobuf

It is a plugin for Sublime Text 4, used to prettify the debug string of Protobuf messages.

Use Python Lex-Yacc to parse the debug string.

Installation

Install “Pretty Protobuf” via Package Control.

Or manually, take macOS as an example:

# Go to the packages directory of Sublime Text
# Sublime Text -> Preferences -> Browse Packages...
cd $HOME/Library/Application\ Support/Sublime\ Text/Packages
git clone https://github.com/hanfezh/pretty-protobuf.git Pretty\ Protobuf

Usage

To prettify proto's debug string, select message's debug string and run command “Pretty Protobuf: Format Message Debug String” through Command Palette Command+Shift+P (macOS). If no selection, the entire file is used by default.

To map a key combination like Ctrl+Shift+J to the Minify command, you can add a setting like this to your .sublime-keymap file (eg: Packages/User/Default (OSX).sublime-keymap):

[
    {
        "keys": [
            "ctrl+shift+j"
        ],
        "command": "pretty_debug_string"
    }
]

Demo of Pretty Protobuf Debug String

To prettify Protobuf, execute command “Pretty Protobuf: Format Protobuf”:

Configuration

Default settings for prettifying message debug string:

  • indent: 4 spaces
  • sort_keys: false, set true to sort keys
  • use_entire_file_if_no_selection: true
  • clang_format_path: clang-format, change to canonical path, such as /usr/local/bin/clang-format
{
    "indent": 4,
    "sort_keys": false,
    "use_entire_file_if_no_selection": true,
    "clang_format_path": "clang-format"
}