ksprojects / protobuf-jetbrains-plugin

Protobuf Support for JetBrains IDEs

Home Page:https://plugins.jetbrains.com/plugin/8277

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Protobuf Support for JetBrains IDEs

Join the chat at https://gitter.im/protostuff/protobuf-jetbrains-plugin

Protobuf Support Plugin for IntelliJ IDEA & other JetBrains products.

THIS PLUGIN IS NOT SUPPORTED SINCE 2019

PLEASE SWITCH TO https://github.com/jvolkman/intellij-protobuf-editor

Releases

Latest plugin release is compatible with IntelliJ IDEA 2018.2 (older releases are compatible with IDEA 13+). Other JetBrains IDEs of the same or higher version should be supported as well.

Compatibility Matrix:

Plugin Version IDE Version Range
0.11.0 IDEA 2018.2
0.9.0 IDEA 2017.1
0.8.0 IDEA 2016.1
0.6.0 IDEA 13 - IDEA 15

Installation

IntelliJ IDEA should suggest you to install plugin automatically when you open .proto file. You can install plugin manually by opening "Plugins" settings, "Browse repositories..." - search for "Protobuf Support".

Plugin page: https://plugins.jetbrains.com/plugin/8277-protobuf-support

Configuration

The plugin does not require configuration by default, for majority of projects it should work out of the box.

Imports

If you see 'File not found' error mark for the import statement, it means plugin cannot resolve target file within current set of source (or resource) roots.

In order to fix it, you should tell to plugin where is the "sources root" for your proto files.

There are a couple ways of doing that:

  1. Mark directory as a source/resources root (right click on folder in project structure, "Mark forlder as...."):

image

  1. Configure directory as source/resources folder in maven/gradle or other build system (if IDEA has support for that build system).

    For gradle you can do it like this:

    idea {
        module {
            sourceDirs += file("${projectDir}/src/main/proto")
        }
    }

    for maven, you can add as a resource directory:

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    
        <modelVersion>4.0.0</modelVersion>
    
        <groupId>groupId</groupId>
        <artifactId>artifactId</artifactId>
        <version>1.0.0-SNAPSHOT</version>
    
        <dependencies>
          ...
        </dependencies>
    
        <build>
            <resources>
                <resource>
                    <directory>src/main/proto</directory>
                </resource>
            </resources>
        </build>
    </project>
  2. You can go to plugin settings, and add source roots there (this is also useful for external imports):

    image

Roadmap

https://github.com/protostuff/protobuf-jetbrains-plugin/wiki/Roadmap

Build

Run following command in the shell:

./gradlew build

It should be possible to run build on any platform (Linux, Windows, MacOS) where Gradle is supported.

JDK 8 must be installed and available on PATH in order to build plugin.

Run IntelliJ IDEA with enabled plugin (for development)

./gradlew runIdea

Screenshots

image

For the sake of history

image

About

Protobuf Support for JetBrains IDEs

https://plugins.jetbrains.com/plugin/8277

License:Apache License 2.0


Languages

Language:Java 99.8%Language:Shell 0.2%