12

Simply I have these directories

enter image description here

in proof.proto I am importing the common_message.proto to be able to use the predefined message and Everything works fine -> [compiling proto files with no problem]

but the only thing that annoys me is that my vs-code always show this to me

enter image description here

and I am using the

enter image description here

as my linter extension

NOTE: that I am compiling proto files with protoc with no problems the importation has no errors (all good) but the error on IDE kinda annoy me

I want to know that if there is a way that I can get rid of the error?

THANK YOU

Thiti-Dev
  • 229
  • 2
  • 11

2 Answers2

14

You can solve the problem by set up "protoc" options.

Go into settings > Extensions > vscode-proto3 configuration and then click Edit in settings.json. (you can just edit .vscode/settings.json too.)

After that, give --proto_path options like below codes.

{
    "protoc": {
        "options": [
            "--proto_path=<path of your proto files>"
        ]
    }
}
jaylee
  • 196
  • 2
  • 8
  • 2
    this option works IDE-wide, and if you add your proto source path hardcoded this way, it breaks once you switch working on another project. – Boris Mulder May 09 '22 at 13:58
  • 5
    You can actually user this option in a per-workspace basis if you add it to your `.vscode/settings.json` file. – Nathan Dortman Jul 06 '22 at 12:28
6

You can set the proto_path to the "proto" directory, it may work for every project if you are using that dir or subdir, works for me and I have several subdir/proto in my project.

proto_path example

queru
  • 107
  • 2
  • 3