Code Monkey home page Code Monkey logo

protobuf-jetbrains-plugin's Introduction

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

protobuf-jetbrains-plugin's People

Contributors

bhdrk avatar gitter-badger avatar kshchepanovskyi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

protobuf-jetbrains-plugin's Issues

Rename refactoring

Support for rename refactoring:

  • messages
  • enums
  • message fields
  • enum values

Importing proto files from the same folder raises "File not found" error

Great work on the plugin! ๐Ÿ‘

Starting from the last protobuf plugin version (v0.10.0) - there seems to be a false error on importing proto files from the same folder.

See attached image for a screenshot.
proto

protoc runs successfully, and the build and tests run as expected.

Please let me know if there's a specific project configuration that is expected for the import validation to work.

Thanks,
Tomer R.

Some syntax errors are not highlighted

For a given input:

There are two syntax errors on a highlighted line, but they are not marked as errors (missing arg and return types).

Notes:

  1. parseTree created inside of org.antlr.jetbrains.adapter.parser.ANTLRParserAdaptor#parse(com.intellij.psi.tree.IElementType, com.intellij.lang.PsiBuilder) does not contain error nodes for some types of syntax errors.
  2. Error nodes are highlighted using org.antlr.jetbrains.adapter.parser.ANTLRParseTreeToPSIConverter#visitErrorNode, but it does not happen as they do not exist.

Related issue: antlr/antlr4-intellij-adaptor#2

Resolve imports relative to file's location

Origin: #65

Many projects are storing proto files in a locations that are not marked as source/resource root.
As a result, imports are highlighted with error "file does not exist", and all imported types are not resolvable.

Plugin can try to resolve imports relative to source file's location using following rules:

  1. If package is not set, try to look in the same folder where source file is.
  2. If package is set, try to look from parent folder.
  3. Parent folder should be computed as source file's folders, with removed corresponding parts of the package.

For example:

/home/user/project/foo/bar/hello.proto:

package foo.bar;
import "baz/import.proto";

Import should be resolved to /home/user/project/baz/import.proto.

Check for reserved tag values

  1. Check that the tag value is not in [19_000, 19_999]
  2. Check for the biggest and smallest number: [1, 536_870_911]
  3. Check for tag values reserved using keyword reserved

The smallest tag number you can specify is 1, and the largest is 2^29 - 1, or 536,870,911. You also cannot use the numbers 19000 though 19999 (FieldDescriptor::kFirstReservedNumber through FieldDescriptor::kLastReservedNumber), as they are reserved for the Protocol Buffers implementation - the protocol buffer compiler will complain if you use one of these reserved numbers in your .proto. Similarly, you cannot use any previously reserved tags.

For more details, see #23

Resolve option references

Resolve option references:

  1. Standard options - click on option name should open corresponding field in google/protobuf/descriptor.proto of *Options message.
  2. Option default is a special case (it corresponds to the field itself).
  3. Custom options - click on option name should open corresponding field in the file and message where option is defined.

Advanced formatter settings

Formatter settings (added in release 0.3.0) are very basic, only indentation can be configured.
I did not add any additional settings as it was not clear if it is needed to anybody.

If you need any additional formatter settings, please leave comments here.

Unable to get stub builder for io.protostuff.jetbrains.plugin.ProtoFileType

I received this exception report through my plugin's reporter (BashSupport). A Bash plugin's call triggers the update of other files. Proto files are apparently missing a stub builder.

unable to get stub builder for io.protostuff.jetbrains.plugin.ProtoFileType@6b05e369, path = /home/... stubBindingRoot = ProtoPsiFileRoot, languages = [PROTO], fileTypes = [PROTO], files = [ProtoPsiFileRoot], roots = []
java.lang.Throwable
        at com.intellij.openapi.diagnostic.Logger.error(Logger.java:132)
        at com.intellij.psi.stubs.StubProcessingHelperBase.processStubsInFile(StubProcessingHelperBase.java:81)
        at com.intellij.psi.stubs.StubProcessingHelperBase.processStubsInFile(StubProcessingHelperBase.java:52)
        at com.intellij.psi.stubs.StubIndexImpl$2.process(StubIndexImpl.java:330)
        at com.intellij.psi.stubs.StubIndexImpl$StubIdListContainerAction.perform(StubIndexImpl.java:614)
        at com.intellij.psi.stubs.StubIndexImpl$StubIdListContainerAction.perform(StubIndexImpl.java:602)
        at com.intellij.util.indexing.ValueContainer.forEach(ValueContainer.java:62)
        at com.intellij.psi.stubs.StubIndexImpl.a(StubIndexImpl.java:356)
        at com.intellij.psi.stubs.StubIndexImpl.processElements(StubIndexImpl.java:322)
        at com.intellij.psi.stubs.StubIndex.getElements(StubIndex.java:145)
        at com.intellij.psi.stubs.StubIndex.getElements(StubIndex.java:134)
        at com.ansorgit.plugins.bash.lang.psi.FileInclusionManager.findIncluders(FileInclusionManager.java:135)
        at com.ansorgit.plugins.bash.lang.psi.impl.command.SmartFunctionReference.resolveInner(SmartFunctionReference.java:69)
        at com.intellij.psi.impl.source.resolve.reference.impl.CachingReference$MyResolver.resolve(CachingReference.java:63)
        at com.intellij.psi.impl.source.resolve.reference.impl.CachingReference$MyResolver.resolve(CachingReference.java:58)
        at com.intellij.psi.impl.source.resolve.ResolveCache.resolve(ResolveCache.java:140)
        at com.intellij.psi.impl.source.resolve.ResolveCache.resolveWithCaching(ResolveCache.java:205)
        at com.intellij.psi.impl.source.resolve.reference.impl.CachingReference.resolve(CachingReference.java:33)
        at com.ansorgit.plugins.bash.lang.psi.impl.command.AbstractBashCommand.isFunctionCall(AbstractBashCommand.java:103)
        at com.ansorgit.plugins.bash.editor.annotator.BashAnnotator.annotateCommand(BashAnnotator.java:196)
        at com.ansorgit.plugins.bash.editor.annotator.BashAnnotator.annotate(BashAnnotator.java:76)
        at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.a(DefaultHighlightVisitor.java:139)
        at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.visit(DefaultHighlightVisitor.java:102)
       ...

Highlighting of groups

optional, repeated keywords are not highlighted if thay are applied to groups:

syntax = "proto2";

package protostuff_unittest;

message A {
    optional int32 x = 1;

    optional group Group = 2 {

        optional int32 y = 1;

        repeated group NestedRepeatedGroup = 2 {
            optional int32 w = 1;
            optional int32 z = 2;
        }

        optional NestedMessage n = 3;

        message NestedMessage {
            repeated string s = 1;
        }
    }
}

Sample:

Allow protobuf compilation

It would be great if the protobufs could be compiled through IntelliJ with a source output that is configurable. I saw a response to someone's comment on this page saying that this most likely won't be implemented and to use protoc with your build tool.

While I understand using protoc for protobuf compiling, it makes using IntelliJ less convenient. I can either compile all of my source code with my own [custom] build tool outside of IntelliJ, or I can use IntelliJ for compilation while developing. Compiling everything through IntelliJ makes development much easier and more seamless. Of course, the plugin could simply call protoc behind the scenes, much like other protobuf plugins do.

Exception is logged when trying to autocomplete import statement

Note: imported folder might not exist, probably it is a root cause of this issue. In any case exceptions should be caught and not logged.

2017-02-14 23:09:17,780 [ 376618]  ERROR - tion.CodeCompletionHandlerBase - Manipulator for this element is not defined: FileReferenceNode(fileReference); class io.protostuff.jetbrains.plugin.psi.FileReferenceNode 
com.intellij.util.IncorrectOperationException: Manipulator for this element is not defined: FileReferenceNode(fileReference); class io.protostuff.jetbrains.plugin.psi.FileReferenceNode
	at com.intellij.psi.impl.source.resolve.reference.impl.CachingReference.getManipulator(CachingReference.java:53)
	at com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReference.rename(FileReference.java:522)
	at com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReference.bindToElement(FileReference.java:497)
	at com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReference.bindToElement(FileReference.java:515)
	at com.intellij.codeInsight.completion.FilePathCompletionContributor$FilePathLookupItem.handleInsert(FilePathCompletionContributor.java:309)
	at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.a(CodeCompletionHandlerBase.java:670)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:934)
	at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.a(CodeCompletionHandlerBase.java:660)
	at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.access$200(CodeCompletionHandlerBase.java:69)
	at com.intellij.codeInsight.completion.CodeCompletionHandlerBase$2.perform(CodeCompletionHandlerBase.java:596)
	at com.intellij.openapi.editor.impl.CaretModelImpl.a(CaretModelImpl.java:355)
	at com.intellij.openapi.editor.impl.CaretModelImpl.doWithCaretMerging(CaretModelImpl.java:444)
	at com.intellij.openapi.editor.impl.CaretModelImpl.runForEachCaret(CaretModelImpl.java:347)
	at com.intellij.openapi.editor.impl.CaretModelImpl.runForEachCaret(CaretModelImpl.java:338)
	at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.a(CodeCompletionHandlerBase.java:584)
	at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.lookupItemSelected(CodeCompletionHandlerBase.java:554)
	at com.intellij.codeInsight.completion.CompletionProgressIndicator.itemSelected(CompletionProgressIndicator.java:175)
	at com.intellij.codeInsight.completion.CompletionLookupArranger.itemSelected(CompletionLookupArranger.java:173)
	at com.intellij.codeInsight.lookup.impl.LookupImpl.fireItemSelected(LookupImpl.java:821)
	at com.intellij.codeInsight.lookup.impl.LookupImpl.finishLookup(LookupImpl.java:510)
	at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.a(CodeCompletionHandlerBase.java:426)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.a(CoreCommandProcessor.java:149)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:109)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:99)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:85)
	at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.completionFinished(CodeCompletionHandlerBase.java:424)
	at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.a(CodeCompletionHandlerBase.java:319)
	at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.a(CodeCompletionHandlerBase.java:496)
	at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.invokeCompletion(CodeCompletionHandlerBase.java:187)
	at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.invokeCompletion(CodeCompletionHandlerBase.java:111)
	at com.intellij.codeInsight.completion.actions.BaseCodeCompletionAction.invokeCompletion(BaseCodeCompletionAction.java:49)
	at com.intellij.codeInsight.completion.actions.CodeCompletionAction.actionPerformed(CodeCompletionAction.java:32)
	at com.intellij.openapi.actionSystem.ex.ActionUtil$1.run(ActionUtil.java:199)
	at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:215)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$1.performAction(IdeKeyEventDispatcher.java:587)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.a(IdeKeyEventDispatcher.java:634)
	at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:204)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:633)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.f(IdeKeyEventDispatcher.java:477)
	at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:211)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:657)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:391)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
2017-02-14 23:09:17,780 [ 376618]  ERROR - tion.CodeCompletionHandlerBase - WebStorm 2016.3.3  Build #WS-163.12024.17 
2017-02-14 23:09:17,780 [ 376618]  ERROR - tion.CodeCompletionHandlerBase - JDK: 1.8.0_112-release 
2017-02-14 23:09:17,780 [ 376618]  ERROR - tion.CodeCompletionHandlerBase - VM: OpenJDK 64-Bit Server VM 
2017-02-14 23:09:17,780 [ 376618]  ERROR - tion.CodeCompletionHandlerBase - Vendor: JetBrains s.r.o 
2017-02-14 23:09:17,780 [ 376618]  ERROR - tion.CodeCompletionHandlerBase - OS: Linux 
2017-02-14 23:09:17,780 [ 376618]  ERROR - tion.CodeCompletionHandlerBase - Last Action: CodeCompletion 

proto2/proto3 syntax validation

It seems syntax keyword is not used for validation process. when I use it and set it to "proto3", I can still use label optional or required without raising any validation error. In the same way, when I put it to "proto2" empty label is allowed.

It would be great to have it to quickly see what is wrong when we convert proto2 files to proto3 !

NullPointerException in ProtobufSettingsConfigurable.isModified()

https://sentry.io/ks-projects/protobuf-support/issues/313088285/

NullPointerException: None
    at io.protostuff.jetbrains.plugin.settings.ProtobufSettingsConfigurable.isModified(ProtobufSettingsConfigurable.java:42)
    at com.intellij.openapi.options.ex.ConfigurableWrapper.isModified(ConfigurableWrapper.java:169)
    at com.intellij.openapi.options.newEditor.SettingsEditor.checkModifiedInternal(SettingsEditor.java:385)
    at com.intellij.openapi.options.newEditor.SettingsEditor.checkModifiedForItem(SettingsEditor.java:379)
    at com.intellij.openapi.options.newEditor.SettingsEditor.checkModified(SettingsEditor.java:367)
...
(78 additional frame(s) were not displayed)

null

ClassCastException: com.intellij.psi.impl.source.PsiPlainTextFileImpl cannot be cast to io.protostuff.jetbrains.plugi...

https://sentry.io/ks-projects/protobuf-support/issues/314607883/

ClassCastException: com.intellij.psi.impl.source.PsiPlainTextFileImpl cannot be cast to io.protostuff.jetbrains.plugin.psi.ProtoPsiFileRoot
    at io.protostuff.jetbrains.plugin.GoToClassContributor.getProtoTypes(GoToClassContributor.java:93)
    at io.protostuff.jetbrains.plugin.GoToClassContributor.findUserTypes(GoToClassContributor.java:74)
    at io.protostuff.jetbrains.plugin.GoToClassContributor.getNames(GoToClassContributor.java:56)
    at com.intellij.ide.util.gotoByName.ContributorsBasedGotoByModel$1.processInReadAction(ContributorsBasedGotoByModel.java:98)
    at com.intellij.ide.util.gotoByName.ContributorsBasedGotoByModel$1.processInReadAction(ContributorsBasedGotoByModel.java:82)
...
(51 additional frame(s) were not displayed)

com.intellij.psi.impl.source.PsiPlainTextFileImpl cannot be cast to io.protostuff.jetbrains.plugin.psi.ProtoPsiFileRoot

Rename language

Rename language from Protobuf to proto.

This way IDEA detects language in markdown.

image

Support for proto file renames

Rename refactoring for proto files:

  • When one renames proto file, all related import statements should be updated.
  • When one renames folder where proto files are located, , all related import statements should be updated.
  • When one presses Ctrl+F6 and renames proto file from import statement (in-place), file should be renamed.

This should also fix #32

RuntimeException: Test exception.

https://sentry.io/ks-projects/protobuf-support/issues/304380930/

RuntimeException: Test exception.
    at io.protostuff.jetbrains.plugin.errorreporting.TriggerExceptionAction.actionPerformed(TriggerExceptionAction.java:14)
    at com.intellij.openapi.actionSystem.ex.ActionUtil$1.run(ActionUtil.java:215)
    at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:232)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.lambda$actionPerformed$0(ActionMenuItem.java:309)
    at com.intellij.openapi.wm.impl.FocusManagerImpl.runOnOwnContext(FocusManagerImpl.java:929)
...
(46 additional frame(s) were not displayed)

Test exception.

IncorrectOperationException: Could not detect qualified name in given context: io.protostuff.jetbrains.plugin.psi.GroupNode

https://sentry.io/ks-projects/protobuf-support/issues/309680919/

Fails for following input:

syntax = "proto2";

package protostuff_unittest;

message A {
    optional int32 x = 1;

    optional group Group = 2 {

        optional int32 y = 1;

        repeated group NestedRepeatedGroup = 2 {
            optional int32 w = 1;
            optional int32 z = 2;
        }

        optional NestedMessage n = 3;

        message NestedMessage {
            repeated string s = 1;
        }
    }
}

Exception:

IncorrectOperationException: Could not detect qualified name in given context: io.protostuff.jetbrains.plugin.psi.GroupNode
    at io.protostuff.jetbrains.plugin.psi.DataType.getQualifiedName(DataType.java:44)
    at io.protostuff.jetbrains.plugin.psi.MessageNode.getNamespace(MessageNode.java:51)
    at io.protostuff.jetbrains.plugin.reference.TypeReferenceProviderImpl.createScopeLookupList(TypeReferenceProviderImpl.java:112)
    at io.protostuff.jetbrains.plugin.reference.TypeReferenceProviderImpl.resolveInScope(TypeReferenceProviderImpl.java:84)
    at io.protostuff.jetbrains.plugin.reference.TypeReferenceProviderImpl.getReferencesByElement(TypeReferenceProviderImpl.java:37)
...
(24 additional frame(s) were not displayed)

Could not detect qualified name in given context: io.protostuff.jetbrains.plugin.psi.GroupNode

Compatibility with IntelliJ IDEA 13

Running Intellij Ultimate Idea 14.1.5 and i get this incompatibility error:

Plugin 'Protobuf Support' is incompatible with this installation

I would really like to use this awesome plugin. Is it not compatible with Intellij 14 ?

Detect other protobuf plugins

If there are two plugins for same language enabled, IDE might become unstable.
We should detect if there are other protobuf plugins enabled, provide an option to disable them and restart IDE.

Message could be collapsible

IntelliJ provides a way of collapsing methods so that a develop can view only whats needed if a file is big.
This could be very useful feature in this plugin also so that developers can collapse messages for instance.

Here is an image that shows how it looks for methods in IntelliJ for Java. The darker button can be clicked and the method will be collapsed.
collapse

Name validation for rename refactoring

http://www.jetbrains.org/intellij/sdk/docs/reference_guide/custom_language_support/rename_refactoring.html

Another interface related to the Rename refactoring is NamesValidator. This interface allows a plugin to check if the name entered by the user in the Rename dialog is a valid identifier (and not a keyword) according to the custom language rules. If an implementation of this interface is not provided by the plugin, Java rules for validating identifiers are used. Implementations of NamesValidator are registered in the com.intellij.lang.namesValidator extension point.

IncorrectOperationException: Could not detect qualified name in given context: com.intellij.psi.impl.source.tree.PsiErrorEleme...

https://sentry.io/ks-projects/protobuf-support/issues/309485610/

TODO: Sample where this error occurs is needed.

IncorrectOperationException: Could not detect qualified name in given context: com.intellij.psi.impl.source.tree.PsiErrorElementImpl
    at io.protostuff.jetbrains.plugin.psi.DataType.getQualifiedName(DataType.java:44)
    at io.protostuff.jetbrains.plugin.psi.MessageNode.getNamespace(MessageNode.java:51)
    at io.protostuff.jetbrains.plugin.reference.TypeReferenceProviderImpl.createScopeLookupList(TypeReferenceProviderImpl.java:112)
    at io.protostuff.jetbrains.plugin.reference.TypeReferenceProviderImpl.resolveInScope(TypeReferenceProviderImpl.java:84)
    at io.protostuff.jetbrains.plugin.reference.TypeReferenceProviderImpl.getReferencesByElement(TypeReferenceProviderImpl.java:37)
...
(32 additional frame(s) were not displayed)

In file: file://D:/Go/src/Server/pb/Person.proto: Could not detect qualified name in given context: com.intellij.psi.impl.source.tree.PsiErrorElementImpl

Support for oneof custom options

Sample:

syntax = "proto2";

package protostuff_unittest;

import "google/protobuf/descriptor.proto";

extend google.protobuf.OneofOptions {
    optional int32 foo = 50003;
}

message SampleMessage {
    oneof test_oneof {
        option (foo) = -99;
        string name = 4;
    }
}

BUILD FAILED

./gradlew build
Cannot find PsiViewer:3.28.93

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring root project 'protobuf-jetbrains-plugin'.

Cannot find plugin PsiViewer:3.28.93 at http://plugins.jetbrains.com

./gradlew build --debug
13:27:45.063 [INFO] [org.jetbrains.intellij.IntelliJPlugin] Configuring IntelliJ plugin PsiViewer:3.28.93
13:27:45.063 [INFO] [org.jetbrains.intellij.IntelliJPlugin] Downloading PsiViewer:3.28.93 from http://plugins.jetbrains.com
13:27:45.064 [INFO] [plugin-repository-rest-client] Downloading PsiViewer:3.28.93
13:27:45.065 [DEBUG] [plugin-repository-rest-client] ---> HTTP GET http://plugins.jetbrains.com/plugin/download?pluginId=PsiViewer&version=3.28.93
13:27:45.489 [DEBUG] [sun.net.www.protocol.http.HttpURLConnection] sun.net.www.MessageHeader@1e09f1dc5 pairs: {GET /plugin/download?pluginId=PsiViewer&version=3.28.93 HTTP/1.1: null}{User-Agent: Java/1.8.0_111}{Host: plugins.jetbrains.com}{Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2}{Connection: keep-alive}
13:27:45.766 [DEBUG] [sun.net.www.protocol.http.HttpURLConnection] sun.net.www.MessageHeader@5acc28f10 pairs: {null: HTTP/1.1 302}{Server: nginx}{Date: Wed, 19 Apr 2017 05:27:45 GMT}{Content-Length: 0}{Connection: keep-alive}{Set-Cookie: ccc=duqe5b;Max-Age=157680000;Expires=Mon, 18-Apr-2022 05:27:45 GMT}{Location: http://plugins.jetbrains.com/files/227/31087/PsiViewer.jar}{X-Frame-Options: DENY}{X-Content-Type-Options: nosniff}{X-XSS-Protection: 1; mode=block;}
13:27:45.767 [DEBUG] [plugin-repository-rest-client] <--- HTTP 302 http://plugins.jetbrains.com/plugin/download?pluginId=PsiViewer&version=3.28.93 (702ms)
13:27:45.768 [DEBUG] [sun.net.www.protocol.http.HttpURLConnection] sun.net.www.MessageHeader@4ca13e215 pairs: {GET /files/227/31087/PsiViewer.jar HTTP/1.1: null}{User-Agent: Java/1.8.0_111}{Host: plugins.jetbrains.com}{Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2}{Connection: keep-alive}
13:27:46.005 [DEBUG] [sun.net.www.protocol.http.HttpURLConnection] sun.net.www.MessageHeader@97e219810 pairs: {null: HTTP/1.1 302 Moved Temporarily}{Server: nginx}{Date: Wed, 19 Apr 2017 05:27:45 GMT}{Content-Type: text/html}{Content-Length: 154}{Connection: keep-alive}{Location: http://jetbrains-plugins.s3.amazonaws.com/227/31087/PsiViewer.jar}{X-Frame-Options: DENY}{X-Content-Type-Options: nosniff}{X-XSS-Protection: 1; mode=block;}
13:27:46.006 [DEBUG] [sun.net.www.protocol.http.HttpURLConnection] Redirected from http://plugins.jetbrains.com/files/227/31087/PsiViewer.jar to http://jetbrains-plugins.s3.amazonaws.com/227/31087/PsiViewer.jar
13:27:46.333 [DEBUG] [sun.net.www.protocol.http.HttpURLConnection] sun.net.www.MessageHeader@4ca13e215 pairs: {GET /227/31087/PsiViewer.jar HTTP/1.1: null}{User-Agent: Java/1.8.0_111}{Host: jetbrains-plugins.s3.amazonaws.com}{Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2}{Connection: keep-alive}
13:27:46.637 [DEBUG] [sun.net.www.protocol.http.HttpURLConnection] sun.net.www.MessageHeader@58a8a67a11 pairs: {null: HTTP/1.1 200 OK}{x-amz-id-2: 4o9lTFfbuh0euV18jM1dZoxRlsiFArCrd9kj38JIe4gUpEPqi70BLxWIgp5Qqxr3/k9ppnQrUSE=}{x-amz-request-id: CDBDBDC9F3AFD558}{Date: Wed, 19 Apr 2017 05:27:47 GMT}{Last-Modified: Wed, 12 Apr 2017 21:39:47 GMT}{ETag: "c7dc518b90e85b31794fd1c56bc0e981"}{x-amz-version-id: QIwSSKe7USVv2IZc5tCwRT0.3cw2XYk4}{Accept-Ranges: bytes}{Content-Type: application/x-java-archive}{Content-Length: 94353}{Server: AmazonS3}
13:27:46.637 [ERROR] [plugin-repository-rest-client] Cannot find PsiViewer:3.28.93
13:27:46.638 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
13:27:46.638 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
13:27:46.639 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
13:27:46.639 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
13:27:46.639 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] A problem occurred configuring root project 'protobuf-jetbrains-plugin'.
13:27:46.639 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Cannot find plugin PsiViewer:3.28.93 at http://plugins.jetbrains.com

but i can get the plugin from chrome after i type the website[http://plugins.jetbrains.com/plugin/download?pluginId=PsiViewer&version=3.28.93]

Search for usages for custom options

Handle Alt+F7 - search for usages command when cursor is on custom option, normal option or on a field (applicable for *Options messages in google/protobuf/descriptor.proto or extension fields).

No syntax highlighting under IDEA 2017.2

I've tried to install the plug-in v0.10.1 after IDEA's prompt. It did install, but there's no syntax highlighting and other features.

The plugin does appear under Plugins in Preferences. Removing and installing back did not help. I've also tried to install v0.9.0 from disk. But the result is the same.

I used to have custom type for .proto files. But I double check-ed: it's now removed. There are no other plugins for .proto files.

My environment:

  • macOS Sierra (v10.12.5)
  • IntelliJ IDEA 2017.2

Please assist.

Code completion support

Dear IntelliJ/Webstorm/Gogland experts, I am new to these IDE(s). I am working on some research module with gRPC, Go and NodeJS. I have chosen Idea for its maturity in terms of development. But, I have been beating my head to get the code suggestion working for the protobuf-plugin and protobuf code. I have used the Google Protobuf-dt plugin in eclipse and the code suggestion is working fine with that plugin in eclipse but, not with the Idea protobuf-plugin 0.8.0. Can anyone help or suggest on this feature please. Lots of thanks in advance.

Best regards ..

Trailing comments formatting issue

Trailing comments should not be moved to new line:

option cc_generic_services = true; // auto-added
option java_generic_services = true; // auto-added
option py_generic_services = true; // auto-added

=>

option cc_generic_services = true;
// auto-added
option java_generic_services = true;
// auto-added
option py_generic_services = true;
// auto-added

Unable to open protobuf file

I'm using the latest release protobuf plugin and pycharm CE:

The error in the eventlog is:
1:12:17 PM NoClassDefFoundError: com/intellij/psi/impl/source/resolve/reference/impl/providers/FilePathReferenceProvider

import doesn't work?

after upgrading, import syntax doesn't work. current version 0.10.0, previous version unknown.

ProtobufSettings requested as a service, but it is a component

Warning from IntelliJ IDEA logs:

2016-10-13 10:15:39,656 [ 149961]   WARN - napi.components.ServiceManager - io.protostuff.jetbrains.plugin.settings.ProtobufSettings requested as a service, but it is a component - convert it to a service or change call to project.getComponent() 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.