jvolkman / intellij-protobuf-editor

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

support local protobuf import #13

Closed mehran-prs closed 4 years ago

mehran-prs commented 4 years ago

It does not recognize local file imports.

jvolkman commented 4 years ago

@mehran-prs Can you provide more details?

By default it looks for files in directories marked as Sources Root. But you can override its search path in Settings -> Languages & Frameworks -> Protocol Buffers.

mehran-prs commented 4 years ago

This is my project tree (foo is the root of the project)

foo
    └── useraccess
        └── v1
            └── service
                ├── base.proto
                └── user.proto

the content of user.proto file:

syntax = "proto3";

package useraccess.v1.service;
import "google/protobuf/empty.proto";
import "foo/useraccess/v1/service/base.proto";

service GroupService {
...
}

I also tried import "useraccess/v1/service/base.proto"; but it does not recognize my local import.

mehran-prs commented 4 years ago

I got it, I should set the parent of the project root (the parent of foo/useraccess/v1/service/base.proto ) as import path and then it works :)
so thanks, I'll close it.