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 479
  • Mac 817
  • Linux 128
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 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13
Windows 0 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 2 1 1 0 2 0 0 0 0 1 0 0 1 0 2 0 1 0 0 0 1 1 2 1 0 0 1 2 0
Mac 0 0 2 1 2 0 1 2 0 2 0 3 0 1 2 1 3 1 0 1 0 1 1 1 1 0 0 1 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 1 1
Linux 2 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0 1 0 0 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"
}