Compatible with: IntelliJ IDEA PhpStorm WebStorm PyCharm RubyMine AppCode CLion GoLand DataGrip Rider MPS Android Studio
Dec 13, 2018
1 074
generate code from .proto files

Recent change notes

Sorry for all these quick changes just set the configuration window to update the quick language combo box instead of always defaulting to Python. Tested on PyCharm and IDEA hoping there won't be any more updates for a while. Eventually I want to add an option to generate all protobufs on build action (or run action for PyCharm,) I may never get around to that one to be honest.

General usage instructions

This plugin is to simplify development with Google's Protocol Buffers. You must have protoc installed to use this plugin. If configured it should work on any OS but is only tested on Linux. There is a Tools menu entry added "Configure GenProtobuf". It saves the location of protoc globally as well as a default "Quick" language (Every time you change the Quick Language it will save a global Quick language to use and a Project Quick Language, if a project Quick language is defined it will have precedence, so if you are always using the same language you can set it once and Quick will always work, or you can set by project, it will be remembered and the last language you set will be used when none is set). It saves a path to store code generated in the various languages supported by protoc by project. You can type paths in yourself using absolute or relative paths or click Browse to choose a directory using a file chooser control. Paths set are passed directly to protoc with no other validation. You may also enable or disable the various languages using checkboxes. Note that protoc itself only supports certain languages when your proto files use proto3 language. Once setup you can use the additional option Generate all Protobufs under Tools. It will run protoc with the paths you specified for every file ending in ".proto" in your project. Note that relative paths will be relative to where your .proto file is not to the root of the project (use absolute paths if you want to use a constant directory.) Two options have also been added to the right click menu for the project explorer. "quick gen protobuf here" will run protoc to generate code for the selected file or files, all code will be placed in the same directory as the selected files and will be generated only in the "Quick" language set under Configure GenProtobuf. "quick gen protobuf rules" will generate code for the selected file or files but will follow the rules configured in Configure GenProtobuf ie the languages and output paths. Notes: the right click commands don't give output so if they fail (like if you haven't specified any output languages or the file is corrupt,) you'll get no feedback. protoc output is displayed for Generate all Protobufs under tools. The plugin will stubbornly refuse to process any files that don't have a "proto" file extension.