You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a Bazel workspace includes java_proto_library macros, the proto must be added as a dependency of at least one java_library rule to appear in the classpath for autocompletion, etc.
Expected Behavior
Based on how the rest of the classpath is built, I believe the intention is that proto classes would be included regardless of whether or not they were already used.
The basic strategy for dealing with bazel is to compute a global classpath, that contains the union of the classpaths of every java library and binary in the project. The idea is that the language server doesn't try to deeply understand your build. Instead, it is basically permissive about errors in your dependency structure, and assumes that bazel itself will reveal those to you when you build at the command line.
theothertomelliott
changed the title
Bazel: Protobuf classes must be build and used as a dependency to be included in the classpath
Bazel: Protobuf classes must be built and used as a dependency to be included in the classpath
Aug 28, 2020
Observed Behavior
When a Bazel workspace includes
java_proto_library
macros, the proto must be added as a dependency of at least onejava_library
rule to appear in the classpath for autocompletion, etc.Expected Behavior
Based on how the rest of the classpath is built, I believe the intention is that proto classes would be included regardless of whether or not they were already used.
Reproduction Steps
See: https://github.com/theothertomelliott/bazel-issues/tree/vscode_java_protos
===
It looks like the cause is a combination of Java protos being created as aspects rather than rules, so they don't show up with aquery by default (https://stackoverflow.com/questions/63430530/bazel-aquery-returns-no-action-information-for-java-proto-library/63455560#63455560), and the list of types included in the classpath aquery not including
proto_library
.I'd be happy to submit a PR to include all protos up-front, as I've got pretty close to a solution while investigating.
The text was updated successfully, but these errors were encountered: