Coder Social home page Coder Social logo

jvolkman / intellij-protobuf-editor Goto Github PK

View Code? Open in Web Editor NEW
123.0 7.0 15.0 1.73 MB

Protocol Buffers for IntelliJ-based IDEs

License: Apache License 2.0

Python 1.47% Java 91.42% PureBasic 0.40% Lex 0.89% Shell 0.03% Starlark 5.66% HTML 0.13%
protobuf protobuf3 protocol-buffers protobuf-files intellij grpc

intellij-protobuf-editor's Introduction

Note: this plugin has moved to JetBrains

This plugin has been adopted by JetBrains and now lives primarly at https://github.com/JetBrains/intellij-plugins/tree/master/protobuf. Future releases will be bundled with certain versions of JetBrains' tools. As such, this repository likely won't see new updates. Issue tracking and other stuff is still in a bit of a transition phase.

Protocol Buffers support for IntelliJ

Run Tests Join the chat at https://gitter.im/intellij-protobuf-editor/community

IntelliJ plugin for editing Google Protocol Buffers. Features include:

  • Support for proto2 and proto3
  • Syntax highlighting
  • Code completion
  • Semantic analysis
  • References and navigation
  • Quick documentation
  • Editor enhancements (completion, brace matching, etc.)
  • Navigating between protobuf files and some other languages (Java, Go, Python)
  • Full support for text format, both standalone and in custom options

Editor

This is a fork of google/intellij-protocol-buffer-editor which was released unsupported.

Installation

Install from the JetBrains plugin repository, or:

Building and Testing

This project uses Bazel.

To build protobuf-editor.jar:

bazel build //plugin

To run tests:

bazel test //...

Path Settings

By default, the collection of project source roots is used as the protobuf search path, and the protobuf descriptor and well-known type files are provided by the plugin JAR. These paths can be customized in the editor's language settings:

Settings

To customize:

  • Uncheck Configure automatically
  • Add paths that include protobuf files
    • The Prefix column can be used to specify an import prefix for the path. So, for example, if the path is src/protos and the prefix is foo/bar, the file at src/protos/mine.proto would be imported as foo/bar/mine.proto.
  • Organize the paths in the proper resolution order. Files found in paths at the top of the list take precedence.

Text Format

Protobuf Text Format is most commonly used to specify long-form option values in .proto files. For example, as seen in the GRPC ecosystem:

GRPC example

This plugin also supports standalone text format files with a .textproto or .pb. extension. Text formant by default does not provide a way to associate a file with its schema (a message in a .proto file). But the plugin supports the following comments in a text proto file:

# proto-file: path/to/file.proto
# proto-message: SomeMessage
# proto-import: path/to/file_with_extensions.proto
# proto-import: path/to/another_file_with_extensions.proto

foo: bar

Filenames are relative to configured roots (see Settings). The proto-message name is scoped relatively to the package declared in the proto-file file. proto-message follows the same resolution rules as type names in .proto files.

intellij-protobuf-editor's People

Contributors

gitter-badger avatar jvolkman 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

intellij-protobuf-editor's Issues

plugin debug need

is there any way to debug plugin like gradle runIde?

i'm trying to add erlang language relsove logic, if there has any way to debug, will helps a lot

error occurs when starting GoLand after Protocol Buffer Editor is installed

OS: macOS 11.2.1
GoLand Version: GoLand 2021.1 Build #GO-211.6693.119

After I installed Protocol Buffer Editor and clicked Apply, GoLand seems stuck. When I tried to restart GoLand, it cannot open a project normally. So I look into log.txt.

2021-04-12 12:04:51.669 goland[2145:39568] allVms required 1.8*,1.8+
2021-04-12 12:04:51.671 goland[2145:39571] Current Directory: /Applications/GoLand.app/Contents/MacOS
2021-04-12 12:04:51.671 goland[2145:39571] Value of GOLAND_VM_OPTIONS is (null)
2021-04-12 12:04:51.671 goland[2145:39571] Processing VMOptions file at /Users/xuyifan/Library/Application Support/JetBrains/GoLand2021.1/goland.vmoptions
2021-04-12 12:04:51.671 goland[2145:39571] Done
Dynamic Code Evolution 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
2021-04-12 12:04:54,992 [   2937]  ERROR - Types.impl.FileTypeManagerImpl - Trying to override already registered file type 'protobuf' [Plugin: idea.plugin.protoeditor] 
com.intellij.diagnostic.PluginException: Trying to override already registered file type 'protobuf' [Plugin: idea.plugin.protoeditor]
	at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.loadFileTypeBeans(FileTypeManagerImpl.java:342)
	at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.initStandardFileTypes(FileTypeManagerImpl.java:233)
	at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.<init>(FileTypeManagerImpl.java:178)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
	at com.intellij.serviceContainer.ConstructorInjectionKt.instantiateUsingPicoContainer(constructorInjection.kt:47)
	at com.intellij.serviceContainer.ComponentManagerImpl.instantiateClassWithConstructorInjection(ComponentManagerImpl.kt:771)
	at com.intellij.serviceContainer.ServiceComponentAdapter.createAndInitialize(ServiceComponentAdapter.kt:49)
	at com.intellij.serviceContainer.ServiceComponentAdapter.doCreateInstance(ServiceComponentAdapter.kt:37)
	at com.intellij.serviceContainer.BaseComponentAdapter.getInstanceUncached(BaseComponentAdapter.kt:110)
	at com.intellij.serviceContainer.BaseComponentAdapter.getInstance(BaseComponentAdapter.kt:64)
	at com.intellij.serviceContainer.BaseComponentAdapter.getInstance$default(BaseComponentAdapter.kt:57)
	at com.intellij.serviceContainer.ComponentManagerImpl$preloadServices$future$1.run(ComponentManagerImpl.kt:906)
	at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1736)
	at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:216)
	at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:27)
	at com.intellij.util.concurrency.BoundedTaskExecutor$1.execute(BoundedTaskExecutor.java:195)
	at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:187)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
	at java.base/java.lang.Thread.run(Thread.java:834)
2021-04-12 12:04:55,000 [   2945]  ERROR - Types.impl.FileTypeManagerImpl - GoLand 2021.1  Build #GO-211.6693.119 
2021-04-12 12:04:55,003 [   2948]  ERROR - Types.impl.FileTypeManagerImpl - JDK: 11.0.10; VM: Dynamic Code Evolution 64-Bit Server VM; Vendor: JetBrains s.r.o. 
2021-04-12 12:04:55,004 [   2949]  ERROR - Types.impl.FileTypeManagerImpl - OS: Mac OS X 
2021-04-12 12:04:55,005 [   2950]  ERROR - Types.impl.FileTypeManagerImpl - Plugin to blame: Protocol Buffer Editor version: 2.3.1 
2021-04-12 12:04:55,005 [   2950]  ERROR - Types.impl.FileTypeManagerImpl - Trying to override already registered file type 'prototext' [Plugin: idea.plugin.protoeditor] 
com.intellij.diagnostic.PluginException: Trying to override already registered file type 'prototext' [Plugin: idea.plugin.protoeditor]
	at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.loadFileTypeBeans(FileTypeManagerImpl.java:342)
	at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.initStandardFileTypes(FileTypeManagerImpl.java:233)
	at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.<init>(FileTypeManagerImpl.java:178)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
	at com.intellij.serviceContainer.ConstructorInjectionKt.instantiateUsingPicoContainer(constructorInjection.kt:47)
	at com.intellij.serviceContainer.ComponentManagerImpl.instantiateClassWithConstructorInjection(ComponentManagerImpl.kt:771)
	at com.intellij.serviceContainer.ServiceComponentAdapter.createAndInitialize(ServiceComponentAdapter.kt:49)
	at com.intellij.serviceContainer.ServiceComponentAdapter.doCreateInstance(ServiceComponentAdapter.kt:37)
	at com.intellij.serviceContainer.BaseComponentAdapter.getInstanceUncached(BaseComponentAdapter.kt:110)
	at com.intellij.serviceContainer.BaseComponentAdapter.getInstance(BaseComponentAdapter.kt:64)
	at com.intellij.serviceContainer.BaseComponentAdapter.getInstance$default(BaseComponentAdapter.kt:57)
	at com.intellij.serviceContainer.ComponentManagerImpl$preloadServices$future$1.run(ComponentManagerImpl.kt:906)
	at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1736)
	at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:216)
	at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:27)
	at com.intellij.util.concurrency.BoundedTaskExecutor$1.execute(BoundedTaskExecutor.java:195)
	at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:187)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
	at java.base/java.lang.Thread.run(Thread.java:834)

It seems that I registered file type 'protobuf' twice by mistake. I think this is a bug because registering file type 'protobuf' twice should be forbidden rather than makes IDE crash but I have no idea whether the bug belongs to GoLand or the plugin. Can you give some help? thanks a lot.

IntelliJ Idea 2021.1 Exception Loop during Startup

OS: Windows 10
IntelliJ Version: 2021.1, Build #IU-211.6693.111, Built April 6, 2021

Looks like the plugin is keeping IntelliJ Idea 2021.1 from starting up, throwing an exception.
Disabling / removing the plugin allows the program to start correctly (sans the plugin).

Note: Handy command line switch for loading the program sans plugins is "idea64 disableNonBundledPlugins"

Guess this what I get for updating my IDE!

Stacktrace:
2021-04-07 20:30:57,077 [ 6593] ERROR - .indexing.IndexDataInitializer - OS: Windows 10
2021-04-07 20:30:57,085 [ 6601] ERROR - .indexing.IndexDataInitializer - Plugin to blame: Protocol Buffer Editor version: 2.3.1
2021-04-07 20:30:57,086 [ 6602] ERROR - .indexing.IndexDataInitializer - Last Action:
2021-04-07 20:30:57,083 [ 6599] ERROR - .indexing.IndexDataInitializer - Index is not created for Stubs
java.lang.IllegalStateException: Index is not created for Stubs
at com.intellij.util.indexing.FileBasedIndexImpl.getIndex(FileBasedIndexImpl.java:1212)
at com.intellij.psi.stubs.StubIndexImpl.getStubUpdatingIndex(StubIndexImpl.java:747)
at com.intellij.psi.stubs.StubIndexImpl.registerIndexer(StubIndexImpl.java:203)
at com.intellij.psi.stubs.StubIndexImpl$StubIndexInitialization.lambda$prepareTasks$1(StubIndexImpl.java:734)
at com.intellij.util.indexing.IndexDataInitializer.executeTask(IndexDataInitializer.kt:75)
at com.intellij.util.indexing.IndexDataInitializer.access$executeTask(IndexDataInitializer.kt:15)
at com.intellij.util.indexing.IndexDataInitializer$runParallelTasks$$inlined$map$lambda$1.run(IndexDataInitializer.kt:49)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:216)
at com.intellij.util.concurrency.BoundedTaskExecutor.access$200(BoundedTaskExecutor.java:27)
at com.intellij.util.concurrency.BoundedTaskExecutor$1.execute(BoundedTaskExecutor.java:195)
at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:213)
at com.intellij.util.concurrency.BoundedTaskExecutor$1.run(BoundedTaskExecutor.java:184)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: com.intellij.diagnostic.PluginException: Cannot create class idea.plugin.protoeditor.lang.PbParserDefinition (classloader=PluginClassLoader(plugin=PluginDescriptor(name=Protocol Buffer Editor, id=idea.plugin.protoeditor, descriptorPath=plugin.xml, path=~\AppData\Roaming\JetBrains\IntelliJIdea2021.1\plugins\protobuf-editor.jar, version=2.3.1, package=null), packagePrefix=null, instanceId=204, state=active))
at com.intellij.serviceContainer.ComponentManagerImpl.instantiateClass(ComponentManagerImpl.kt:763)
at com.intellij.serviceContainer.ComponentManagerImpl.instantiateClass(ComponentManagerImpl.kt:781)
at com.intellij.serviceContainer.LazyExtensionInstance.createInstance(LazyExtensionInstance.java:54)
at com.intellij.serviceContainer.LazyExtensionInstance.getInstance(LazyExtensionInstance.java:43)
at com.intellij.serviceContainer.BaseKeyedLazyInstance.getInstance(BaseKeyedLazyInstance.java:38)
at com.intellij.psi.stubs.StubUpdatingIndex.getExtensions(StubUpdatingIndex.java:438)
at com.intellij.psi.stubs.StubUpdatingIndex.instantiateElementTypesFromFields(StubUpdatingIndex.java:431)
at com.intellij.psi.stubs.StubUpdatingIndex.lambda$ensureSerializationManagerInitialized$0(StubUpdatingIndex.java:421)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:688)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:634)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:64)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:218)
at com.intellij.psi.stubs.StubUpdatingIndex.ensureSerializationManagerInitialized(StubUpdatingIndex.java:420)
at com.intellij.psi.stubs.StubUpdatingIndex.getValueExternalizer(StubUpdatingIndex.java:339)
at com.intellij.util.indexing.impl.storage.DefaultIndexStorageLayout.createIndexStorage(DefaultIndexStorageLayout.kt:58)
at com.intellij.util.indexing.impl.storage.DefaultIndexStorageLayout$SingleEntryStorageLayout.openIndexStorage(DefaultIndexStorageLayout.kt:149)
at com.intellij.psi.stubs.StubUpdatingIndex$3.openIndexStorage(StubUpdatingIndex.java:380)
at com.intellij.util.indexing.impl.storage.TransientFileContentIndex$1.openIndexStorage(TransientFileContentIndex.java:40)
at com.intellij.util.indexing.impl.storage.VfsAwareMapReduceIndex.lambda$new$0(VfsAwareMapReduceIndex.java:67)
at com.intellij.util.indexing.impl.MapReduceIndex.(MapReduceIndex.java:102)
at com.intellij.util.indexing.impl.storage.VfsAwareMapReduceIndex.(VfsAwareMapReduceIndex.java:80)
at com.intellij.util.indexing.impl.storage.VfsAwareMapReduceIndex.(VfsAwareMapReduceIndex.java:66)
at com.intellij.util.indexing.impl.storage.TransientFileContentIndex.(TransientFileContentIndex.java:36)
at com.intellij.psi.stubs.StubUpdatingIndexStorage.(StubUpdatingIndexStorage.java:32)
at com.intellij.psi.stubs.StubUpdatingIndex.createIndexImplementation(StubUpdatingIndex.java:372)
at com.intellij.util.indexing.FileBasedIndexImpl.createIndex(FileBasedIndexImpl.java:542)
at com.intellij.util.indexing.FileBasedIndexImpl.initIndexStorage(FileBasedIndexImpl.java:479)
at com.intellij.util.indexing.FileBasedIndexImpl.registerIndexer(FileBasedIndexImpl.java:439)
at com.intellij.util.indexing.FileBasedIndexDataInitialization.lambda$initAssociatedDataForExtensions$0(FileBasedIndexDataInitialization.java:79)
... 17 more
Caused by: java.lang.NoClassDefFoundError: Could not initialize class idea.plugin.protoeditor.lang.PbParserDefinition
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at com.intellij.serviceContainer.ComponentManagerImpl.instantiateClass(ComponentManagerImpl.kt:722)
... 45 more
2021-04-07 20:30:57,089 [ 6605] ERROR - .indexing.IndexDataInitializer - IntelliJ IDEA 2021.1 Build #IU-211.6693.111

Add support for PsiReferenceContributor for option and type names

Hi there,

Currently, if the plugin wasn't able to resolve type name/option name, it will be marked as an error and it looks like there is no way to customise this behaviour.

However, there could be cases when such resolutions are impossible directly from IDE (i.e. when extensions appear on a build server). IDEA contains a mechanism to provide custom reference resolver via PsiReferenceContributor/PsiReferenceProvider interfaces but the plugin does not support this functionality.

Cannot resolve option 'go_package'

The text go_package in the line appears in red in the editor. Previously it did not. Not sure when it started happening. I am using 2.1 version.

option go_package = "somepackage" 

When I hover over, I see the text: Cannot resolve option 'go_package'
how can I resolve?

Auto-configure *.proto paths from project dependencies

I have a project, using Kotlin/Gradle that has the following dependency:

implementation("com.google.api.grpc:proto-google-common-protos:1.16.0")

if I configure the path to the sources jar file in the Preferences --> Protocol Buffers as:

jar:///<...PATH TO HOME>/.gradle/caches/modules-2/files-2.1/com.google.api.grpc/proto-google-common-protos/1.16.0/bdc28414cdd1f5003c2fdcc59c7f597c2da5b1b1/proto-google-common-protos-1.16.0-sources.jar!/

The Plug-In finds the proto files and correctly resolves the imports.

Is there a way to have the plug-in pick up protofiles from the Gradle dependencies (or IntelliJ project libraries) using "AutoConfigure"?

The option to manually configure will not quite work as it requires the local path to the jar file, and that changes from developer to developer.

Any ideas would be most welcome.

Miguel

Relative imports

When using protoc, it's often common to include . as an include path. What this means is that proto files can import other files that are in the same directory as them. This also seems to be the default behaviour when using buf.build

The current workaround is to define the proto include path to include the folder where your protos are. The issue with this approach is that sometimes proto filenames are fairly generic like "enums.proto", so if you have multiple directories with proto files in your project this all falls apart.

Allowing a tickbox for relative imports would fix this.

Add collapse option to Structure view

In the Structure view, can you add an option to the toolbar to Collapse and Expand for all?

Currently, when I open a .proto, it shows all messages expanded by default with no way to collapse them (that I found) to just a list of the messages. This makes navigation harder as we have enums with lots of values, so it's a lot of scrolling to find the message I need. I also more often (always) need to find a specific message, not see the fields of a message.

highlight numbering gaps

message Foo {
  int32 a = 1;
  bool  b = 3;
}

Giving the 3 a different color to point out the numbering gap would be helpful.

Adding Import paths using Jar File

I have read the readme about adding import paths for the missing proto, but this time I would like to add an import path using a jar file, in my case the proto is in that jar file and it is very troublesome for me to cherry-pick and copy those files one by one.

False positive when linting enum value named `option`

Example:

enum EnumWithOptionValue {
  zero = 0;
  first = 1;
  second = 2;
  option = 3;
}

Errors with:

illegal name '=' (/path/to/file.proto, line XXX)

It seems to be assuming that option is something like option allow_alias = true; yet the above protobuf is perfectly valid.

Crashes 2020.2 on attempt to add new protobuf path

GoLand 2020.2.3
Build #GO-202.7319.61, built on September 16, 2020
Runtime version: 11.0.8+10-b944.31 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 10.16
GC: ParNew, ConcurrentMarkSweep
Memory: 1979M
Cores: 12
Registry: ide.completion.variant.limit=500, ide.allow.merge.buttons=false, suggest.all.run.configurations.from.context=TRUE, ideFeaturesTrainer.welcomeScreen.tutorialsTree=TRUE
Non-Bundled Plugins: GrepConsole, String Manipulation, org.jetbrains.settingsRepository, cz.daku.intellij.extraActions, NodeJS, idea.plugin.protoeditor

Note: this is macOS Big Sur (public beta).

Steps to reproduce:

  1. Install "Protocol Buffer Editor" plugin
  2. Open "Preferences -> Languages & Frameworks -> Protocol Buffers"
  3. Uncheck "Configure automatically"
  4. Add any path

GoLand crashes.
Output: https://pastebin.com/yfbY56DA

warning to a right code.

import same root dir path proto, warning to a right code.
eg. import "heartbeat.proto"; // service.proto

  • proto
    • service.proto
    • heartbeat.proto

Plugin does not understand bazel WORKSPACE as likely project root directory

Plugin does not understand bazel WORKSPACE file is in a likely project root directory.

This meant that my imports were RED, but still compiled fine. Once I added the WORKSPACE directory as an import path via the IJ->Preferences->Languages&Frameworks->ProtocolBuffers menu, the proto import path worked and my external protos resolved correctly.

Could the plugin support bazel WORKSPACEs as one of its 'configure automatically' options?

Imports not auto-configured on Linux, unlike macOS

Thanks for the great plugin! This project has helped my workflow.

I'm not sure if this is an issue with my OS (Ubuntu 20.04 Focal Fossa), the editor (IntelliJ 2020.1.2), or this plugin (version 2), but the imports were not auto-configured correctly, which is something I didn't experience on macOS.

To fix, I had to go to Settings > Languages & Frameworks > Protocol Buffers, and uncheck "Configure automatically", and then add a path to my root repo.

Just thought I'd raise the issue in case any one else experiences what they perceive as "broken imports" on Linux.

github imports are not resolved

This is on the latest goland stable 2021.1.3

option (gogoproto.testgen_all) = true;
option (gogoproto.populate_all) = true; // Required by testgen_all.
option (gogoproto.equal_all) = true;    // Required by testgen_all.

import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "github.com/golang/protobuf/ptypes/timestamp/timestamp.proto";

I get a cannot resolve import error here ^

Cannot resolve import 'some.proto'

Hi~
First, thank you for your plugin.

but, i met some problem.
It's "import" phase.

I composed it like this.
image

and used to "import" like this

// chaser.proto
syntax = "proto3";
option java_multiple_files = true;

/// some code

import "rian/apmax/commons.proto";

/// and continue...

Cannot resolve import 'rian/apmax/commons.proto' it's my problem.

And append build script by maven.

<!-- pom.xml -->
  <build>
    <extensions>
      <extension>
        <groupId>kr.motd.maven</groupId>
        <artifactId>os-maven-plugin</artifactId>
        <version>1.6.2</version>
      </extension>
    </extensions>
    <plugins>
      <plugin>
        <groupId>org.xolstice.maven.plugins</groupId>
        <artifactId>protobuf-maven-plugin</artifactId>
        <version>0.5.1</version>
        <configuration>
          <protocArtifact>com.google.protobuf:protoc:3.13.0:exe:${os.detected.classifier}</protocArtifact>
          <pluginId>grpc-java</pluginId>
          <pluginArtifact>io.grpc:protoc-gen-grpc-java:1.31.1:exe:${os.detected.classifier}</pluginArtifact>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>
              <goal>compile-custom</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

I don't know about that.
Thank for read my issue. bye~

navigate not work

navigate from java class to proto file is not work for me, my idea version is 2022.1 aarch64,can anyone help me?

Not compatible with 2020.3

Just started using Rider 2020.3 EAP1 and get this error: Plugin 'Protocol Buffer Editor' (version '2.1.0') is not compatible with the current version of the IDE, because it requires build 202.* or older but the current build is RD-203.3645.15

Might there be an update soon? I'll happily buy you one of those digital coffees or beers.

Keywords highlighting not working for rider 2020.3 (Windows)

Keywords are not highlighted in the .proto file. As far as I can tell, keywords are treated the same as identifiers: when I change the identifier color from File | Settings | Editor | Color Scheme | Protocol Buffer - actually keywords also getting highlighted with that color. In contrast, no matter what color I configure for keywords in settings, it gets ignored and identifier color is used for keywords anyway.

Issues navigating to protos defined nested in source

My project has Go application code, proto files, and generated Go code in the same repo. I'm using GoLand

When I configure import paths automatically, navigating from the usage of a generated object to its definition works as expected, but navigating inside proto files doesn't. Parent/sibling/etc proto dependencies cannot be resolved. (Example: When I open try to find the Go definition of foo.Foo, the editor takes me to foo.pb.go, and navigating within foo.proto to other files is broken)

When I configure import paths manually, navigating from the usage of a generated object to its definition instead takes me into the proto file. And navigating across proto files work. (Example: When I try to find the Go definition of foo.Foo, the editor takes me to foo.proto not foo.pb.go, and navigating within foo.proto works)

What I am trying to accomplish is both: navigating from the usage of foo.Foo to its definition takes me to foo.pb.go and navigating within foo.proto into other proto files works.

I cannot enable the proto directory as a root since it is nested under the project root already.

The only way I have solved this is by creating a brand new GoLand project with the root directory as the proto folder, but I would prefer to do everything in one Go project if possible.

Cannot resolve imports

There seems to be a problem with the plugin showing incorrectly that imports were not resolved even though they are:

image

image

Everything is working just fine and the imported file is available and found in the folder.

I can compile it no problem with this import line. It's just the editor which is incorrectly showing it red and giving "Cannot resolve imports."

To double confirm if I change the name of the file to something incorrect - it then fails to compile. If I change it back it compiles just fine.

Ie. it seems to be a Protocol Buffer Editor problem.

I am using Rider 2020.1.4 on Ubuntu Linux and I have Protocol Buffer Editor version 2.0.

Thank you for your continued development and support of this crucial plugin. Stay safe and healthy.

"Import paths" seem to be broken after the latest GoLand update.

GoLand version:

GoLand 2020.2.3
Build #GO-202.7319.61, built on September 16, 2020

Plugin version: 2.1.0

After my IDE has been updated earlier today I started getting "Cannot resolve import XXX" in .proto files, although the directory with respective files is added under Settings - Languages&Frameworks - Protocol Buffers - Import Paths and it worked just fine before.

Would appreciate your assistance resolving this issue. Please let me know if you require any additional information.

IntelliJ IDEA crashing MacOS BigSur in GCTaskThread

IntelliJ IDEA is crashing on MacOS BigSur OS with a JAVA error.

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x0000000111c1b0ed, pid=68391, tid=38147
#
# JRE version: OpenJDK Runtime Environment JBR-11.0.9.1.11-1145.77-jcef (11.0.9.1+11) (build 11.0.9.1+11-b1145.77)
# Java VM: OpenJDK 64-Bit Server VM JBR-11.0.9.1.11-1145.77-jcef (11.0.9.1+11-b1145.77, mixed mode, tiered, compressed oops, concurrent mark sweep gc, bsd-amd64)
# Problematic frame:
# V  [libjvm.dylib+0x2490ed]  _ZN13PromotionInfo21promoted_oops_iterateI28ParScanWithoutBarrierClosureEEvPT_+0x7d
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#

---------------  S U M M A R Y ------------

Command Line: -Xms128m -Xmx2048m -XX:ReservedCodeCacheSize=512m -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -XX:CICompilerCount=2 -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -ea -Dsun.io.useCanonCaches=false -Djdk.http.auth.tunneling.disabledSchemes="" -Djdk.attach.allowAttachSelf=true -Djdk.module.illegalAccess.silent=true -Dkotlinx.coroutines.debug=off -XX:ErrorFile=/Users/ramanvi/java_error_in_idea_%p.log -XX:HeapDumpPath=/Users/ramanvi/java_error_in_idea.hprof -Djb.vmOptionsFile=/Users/ramanvi/Library/Application Support/JetBrains/IntelliJIdea2020.3/idea.vmoptions -Didea.paths.selector=IntelliJIdea2020.3 -Didea.executable=idea -Didea.home.path=/Applications/IntelliJ IDEA.app/Contents -Didea.vendor.name=JetBrains 

Host: MacBookPro14,3 x86_64 2800 MHz, 8 cores, 16G, Darwin 20.2.0
Time: Thu Feb  4 20:21:36 2021 IST elapsed time: 45.978572 seconds (0d 0h 0m 45s)

---------------  T H R E A D  ---------------

Current thread (0x00007fb98290b000):  GCTaskThread "GC Thread#3" [stack: 0x0000700007862000,0x0000700007962000] [id=38147]

Stack: [0x0000700007862000,0x0000700007962000],  sp=0x0000700007961de0,  free space=1023k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.dylib+0x2490ed]  _ZN13PromotionInfo21promoted_oops_iterateI28ParScanWithoutBarrierClosureEEvPT_+0x7d
V  [libjvm.dylib+0x249061]  _ZN29ConcurrentMarkSweepGeneration37par_oop_since_save_marks_iterate_doneEi+0x23
V  [libjvm.dylib+0x623c46]  _ZN13ParNewGenTask4workEj+0x11a
V  [libjvm.dylib+0x77dd83]  _ZN10GangWorker4loopEv+0x43
V  [libjvm.dylib+0x70b9ac]  _ZN6Thread8call_runEv+0x68
V  [libjvm.dylib+0x610a53]  _ZL19thread_native_entryP6Thread+0x139
C  [libsystem_pthread.dylib+0x6950]  _pthread_start+0xe0
C  [libsystem_pthread.dylib+0x247b]  thread_start+0xf

There are Golang plugin and Protobuf plugin installed.
After disabling the "Protocol Buffer Editor (2.2.0)" plugin the crash went away.

see https://youtrack.jetbrains.com/issue/JBR-3078

Auto-Detect src/main/proto for plugin config

Hey,

I was just messing around with importing custom proto files, but the plugin said it couldn't find the file, - when running protoc in default configuration it works.

So I digged into the plugin configuration and found out that src/main/proto is not an auto-detected path for imports.
I suggest adding so, because src/main/proto is the default protoRootLocation.

Thanks for reading!

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.