Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VSCode Extension not recognizing buf dependencies in imports #209

Open
2 of 5 tasks
MartinLoeper opened this issue Jul 8, 2024 · 1 comment
Open
2 of 5 tasks

Comments

@MartinLoeper
Copy link

Describe the bug
The linter does not recognize dependencies defined in buf.yaml (deps key) when imported in our .proto files:

[Error - 10:45:01 PM] Request textDocument/definition failed.
  Message: revenueperhour.proto:5:8: open buf/validate/validate.proto: no such file or directory
  Code: 0 

Related Components

  • protoc-gen-grpc-federation
  • grpc-federation-linter
  • grpc-federation-language-server
  • grpc-federation-generator
  • others

To Reproduce

  • Create a buf.yaml like the following:
version: v2
modules:
  - path: proto
deps:
  - buf.build/bufbuild/protovalidate
  - buf.build/googleapis/googleapis
  • Create a .proto file with imports like the following:
import "google/protobuf/timestamp.proto";

Expected behavior
The import should be resolved by the vscode extension mercari.grpc-federation v1.0.2.

I am wondering if I am missing some configuration here or whether the extension should work with buf dependencies out of the box?

Screenshots

Additional context

@goccy
Copy link
Member

goccy commented Jul 11, 2024

@MartinLoeper Thank you for your reporting !

Currently, the language server is not configured to look at buf.gen.yaml or buf.work.yaml and buf.yaml . Therefore, as mentioned below, it is necessary to pass the --import-path option when starting the language server.

https://github.com/mercari/grpc-federation/tree/main/cmd/grpc-federation-language-server#usage

In the case of VSCode, specify it in settings.json as follows. Therefore, all proto files to be referenced must exist on the local filesystem. This behavior poses an issue if you are using Buf Registry to reference proto files, so we plan to improve it in the future.

https://github.com/mercari/grpc-federation/blob/main/.vscode/settings.json#L8-L13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants