salesforce / bazel-vscode-java

Bazel Java development extension for VS Code
BSD 3-Clause "New" or "Revised" License
41 stars 8 forks source link

Bazel based projects not present in Java project selection #106

Open rleonid opened 7 months ago

rleonid commented 7 months ago

We have a large monorepo with different languages and using Bazel as our build system. I have installed the plugin, added a WORKSPACE file with (workspace(name="example")) and a .eclipse/.bazelproject with :

directories:
  lib/common_java 

derive_targets_from_directories:

targets:

lib/common_java is just one of our folders with a BUILD.bazel file and asrc/main/java folder.

When I restart vscode with the plugin enabled (the Prerelease version 😄), it does not intercept the project setup workflow when I open a .java inside of lib/common_java. The java extension pack wants to only add .gradle or maven files, and we migrated away from the former.

It also adds a large section of files.exclude to my .vscode/settings.json (even with bazel.projectview.updateFileWatcherExclusion": false) which is unfortunate.

rleonid commented 7 months ago

I am also not certain of what debug information I can provide for you, AFAIU, there isn't a dedicated output window for this plugin.

guw commented 7 months ago

derive_targets_from_directories is set to true?

Can you check the log files? Have you seen the troubleshooting doc here?

Note, sometimes it's also worth trying to import this into Eclipse. Eclipse is using the same engine underneath but makes errors more visible/obvious than VS Code.

rleonid commented 7 months ago

Yes, sorry that was a copy and paste error; I was trying to figure out the right arguments for that file. When I first open up code, I am greeted by image

If I Import All nothing comes up in Java Projects but if I select (and this is after Java: Clean Language Server Workspace ) Let Me Select... I only see the projects that we have vendored into our codebase, and their gradle files. (We do not use the Java there directly, it just gets distributed with their repo alongside C stuff we do use), but not our Bazel defined Java projects.

Wrt to the trouble shooting doc, yes I've tried various things from it. The first step is not working though as we are not getting a Java Projects tab. Interestingly, I also tried https://github.com/salesforce/bazel-vscode-java/blob/main/docs/troubleshoot.md#maven-or-gradle section and java.import.bazel.enabled section is not recognized by VSCode plugin as a valid setting. Which is more evidence that somehow my install is not functioning correctly.

What should I look at next? Thank you!