jvolkman / intellij-protobuf-editor

Protocol Buffers for IntelliJ-based IDEs
Apache License 2.0
122 stars 15 forks source link

github imports are not resolved #67

Closed Ghilteras closed 3 years ago

Ghilteras commented 3 years ago

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 ^

jvolkman commented 3 years ago

Hard to help without more info about your project setup. Add the parent of the github.com directory as a project source path, or add it to the list of import parths.

Ghilteras commented 3 years ago

@jvolkman the syntax I pasted works, it's just the plugin that does not resolve the external links, I think it's a bug because it should be able to resolve them. I'm not sure what you mean by project setup, what specific info are you looking for? Also how do I add the parent github.com directory as a source path? There is no github directory, it's an external import

jvolkman commented 3 years ago

The protobuf compiler doesn't support downloading remote files, so they must be on your machine somewhere. github.com is the name of a directory. Maybe it's under $HOME/go/src or something? Anyway, protoc knows where it is and the protobuf plugin also needs to know. The easiest way is to probably just add a path under settings -> languages -> protocol buffers following instructions here.

Ghilteras commented 3 years ago

@jvolkman the path where the package lives is in $home/go/src but adding file:///Users/apantano/go/pkg/mod/github.com/gogo/protobuf@v1.3.2/gogoproto to settings -> languages -> protocol buffers does not solve the issue.