vscode-proto3 icon indicating copy to clipboard operation
vscode-proto3 copied to clipboard

Import "foo/bar/msg.proto" was not found or had errors

Open hovinlu opened this issue 3 years ago • 4 comments

I opened the example files: imports.proto. and then there went a wrong that Import "foo/bar/msg.proto" was not found or had errors. is it a bug?

hovinlu avatar Jul 13 '21 09:07 hovinlu

I have the same issue, where the import path from the linter does not match the path required by protoc.

The linter checks from the root of the project Whereas protoc checks relative to the .proto file

Very confusing and frustrating to see errors (from the linter) when it is actually correct for the compiler.

IvoSchols avatar Jul 21 '21 12:07 IvoSchols

Same for me. Compile works but errors shown image

Also note that when include path is incorrect then no error is shown, but compile fails image image

footfish avatar Oct 27 '21 10:10 footfish

The problem I reported above resolved itself after a VSC restart.

footfish avatar Oct 28 '21 07:10 footfish

Have you tried adding proto_paths to vscode extension settings ?

"protoc": {
    "options": [
        "--proto_path=foo/bar"
    ]
  }

cf https://github.com/zxh0/vscode-proto3#fields, quoting "protoc compiler arguments/flags, required for proto validation and compilation"

dav-m85 avatar Nov 26 '21 14:11 dav-m85