Vscode-java: Bazel Support

Created on 30 Apr 2019  Â·  10Comments  Â·  Source: redhat-developer/vscode-java

vscode-java does not recognize bazel as a build environment

Environment
  • Operating System:
  • JDK version:
  • Visual Studio Code version:
  • Java extension version:
Steps To Reproduce
  1. Load a java project with bazel as the build system (example)
  2. Navigate to any .java file
Current Result

Receive "Classpath is incomplete" warning

Expected Result

vscode-java to infer classpath from bazel

Additional Informations
help wanted

Most helpful comment

Its very painful to work in a monorepo with vscode without this.

All 10 comments

Seems like this work would be related to https://github.com/eclipse/eclipse.jdt.ls/issues/543

I would also love to see this supported.

I would love to get this support as well please!

After tinkering for hours, I have not yet been able to get vscode to launch & debug my java+bazel project. I can run in console no problem, but I also love this request to get bazel fully supported in vscode-java.

Its very painful to work in a monorepo with vscode without this.

A thought on how to implement this. We could reuse the JDT extension bundle from salesforce/bazel-eclipse. Not sure on the best route for repackaging this for VSCode and making sure that the project is credited though.

Interesting. I spent Friday noodling with the intellij plugin, slicing out the intellij-ide-info.txt generation piece into something I could reuse. I ended up with something _super_ hacky, which for example lifts the test code into the generator to allow injection of bits of the parsing code using intellij's dependency injection framework. From there I then generated a json snippet that can be copied-n-pasted into settings.json. Hack-city!

I could share that if people thought it useful, but it lacks a certain panache, shall we say.

I filed an issue with the bazel-IntelliJ people to see if they were enthused, but they weren't particularly, which is fair enough:

https://github.com/bazelbuild/intellij/issues/1827

Love it, I see your hacky plugin and raise you this hacky bash script that I'm using as a workaround

https://gist.github.com/enriched/b0a685e124a2abff3ac92bf3a5e63630

Oh, you made a project and classpath. Maybe that's a better idea. OK when I get time I'm going to put my hacktasticness up on github and maybe try to dehack a little bit, and try to see if our bazel-intellij friends like the idea.

Well now. I just found this thing, and I made it work with an hour's
noodling, and now I have the javas with the bazels with the vscodes. All I
had to do was to fix the distribution I was getting natively for my
code-server setup, which didn't have the platform-specific stuff. But this
is way less overhead for a bazel setup, and I bet the 'real' vscode install
works fine...

https://github.com/georgewfraser/java-language-server

On Wed, May 20, 2020 at 6:43 PM Rich Adams notifications@github.com wrote:

Love it, I see your hacky plugin and raise you this hacky bash script that
I'm using as a workaround

https://gist.github.com/enriched/b0a685e124a2abff3ac92bf3a5e63630

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/redhat-developer/vscode-java/issues/909#issuecomment-631624238,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ABN425OMZZ5HBP42AIIYHDLRSQJC7ANCNFSM4HJMZWPA
.

Was this page helpful?
0 / 5 - 0 ratings