vscode-proto3
vscode-proto3 copied to clipboard
Follow imports
Now I get errors from imported fields:
From:
import "currency.proto";
It would be awesome if those import types are also imported.
Hi, could you provide some more information? What is the error message?
The message reads "currency.Currency" is not defined
.
Reproduction is easy:
"foo.proto"
syntax = "proto3";
package foo;
message Foo {
string a = 1;
}
and in the same folder "bar.proto"
syntax = "proto3";
package bar;
import "foo.proto";
message Bar {
foo.Foo a = 1;
}
yields the error message "foo.Foo" is not defined
with the error marker on foo.Foo a = 1;
Hi, maybe the problem is comes from import statement. How about change it to import "foo.proto";
?
Ow, my bad, that syntax is what I already use in real files. This still does not fix the issue, I still get the undefined error.
This extension just calls protoc when it need to check proto syntax. So I guess the import path is not correct. How about import "path/to/foo.proto";
?
I have the same problem. Both files are in the same folder. They compile fine using protoc on the command line.
Hi,
I have the same issue described here.
Multiple proto files in the same directory ( same package so I dont prefix with xx.yyy
but I import them ) and I also have "xxxx" is not defined
Protoc is able to compile those files too.
hi @Tommy-42 could you provide a minimal folder with some proto files to let me reproduce this issue ? thank you
Hey @zxh0 sure :)
This should trigger the error on vscode but compile fine with : protoc --go_out=. *.proto
I have the same problem. "msg.base.ReqReconnect" is not defined.
The message is not normally identified
@Tommy-42 it's weird that I am not able to reproduce the error (on both Windows and macOS) using test.zip you uploaded
hi @hanyu363 could you give me a zip like Tommy-42 to let me reproduce the error?
proto.zip Is it related to setting up
@hanyu363 我没办法重现你的问题,我给你邮箱发了一封邮件,请查收一下。
英文差,这么快就被识别出来了。 问题解决了。。应该需要设置一下Proto文件路径才可以。。 "protoc": { "path": "/usr/local/bin/protoc", "options": [ "--proto_path=/Users/weihua/workspace/CityGuardians/common/proto", ] } 谢谢啦。
If you open the proto directory alone, no problem. If proto is not the root directory, it needs to be explicitly specified in the vs configuration. Then restart the editor just fine. Please refer to "protoc": { "path": "/usr/local/bin/protoc", "options": [ "--proto_path=${workspaceRoot}/common/proto", ] }
thank you @hanyu363
I have the same issue: the defined type that from imported proto file is marked as not defined by vscode-proto3. Both of the proto files are from the same folder named proto, I've tried to set proto_path=${workspaceRoot}/proto in setting.json, while it seems not work.
@mingweiLIU please remove ${workspaceRoot}
and use relative path in your settings.json
Thanks, it works now!
@mingweiLIU I have the same issue,how to fix ?
@luanxuechao Just set proto_path=proto in setting.json will be ok (proto is the folder name of your proto files).
Encoutered the same issue, just restarted vscode then problem solved.
Encoutered the same issue, just restarted vscode then problem solved.
So do I.
+1 same issue -- had to restart
I had the same problem (I use Windows 10) and I solved it by adding the following to my workspace settings.json:
{
"protoc": {
"path": "C:/Path/To/Protoc binary",
"options": [
"--proto_path=C:/path/to/my/protofiles/directory",
]
}
}
I just found out:
the syntax
import "uphierarchy/message.proto";
works in VS code if uphierarchy
is the folder from where vs code was started.
That means: No need to override settings.json locally
If I have a multi-root workspace, how should this setting be written. Different roots will have different include paths?
This isn't working for me. If I set the proto_path
option VSCode is still unable to jump to definitions. If I open the Proto path in VSCode directly as the root, then it works.
For me it really doesn't work. After modifying settings.json
errors aren't shown, and autocomplete will not suggest imported symbols (but sometime i can jump to definitions).