-
-
Notifications
You must be signed in to change notification settings - Fork 676
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 support for Bazel + Go project doesn't work correctly for new packages #3014
Comments
The error in VSCode also goes away when I do:
|
Sorry I just re-read your message! |
You can inspect the Is there any error? Can you inspect the json payload and check that the package you're trying to import is indeed there? |
I had checked that and it had generated some valid json (that I think there's some bug in how reloading new packages work because the error goes away when I restart the Editor or "Reload Window". So somehow the editor continues using some old state and doesn't recognize a newly added package until restart. |
Thanks, so the issue is indeed between perhaps gopackagesdriver, gopls and vscode perhaps? For some reason it's not "reloading" the packages? Maybe something with vscode itself ? |
Perhaps. Though this is not an issue with regular non-bazel go tooling. |
Can you enable gopls tracing see if at least the gopackagesdriver is called "regularly" ? |
There's definitely a lot of chatter in the
Including messages like:
|
I'd like to resurface this issue. I'm seeing the exact same problem with Bazel v0.31.0. This happens not only with new repositories but with each new import added to a file. Makes it really irritating to use VSCode as you constantly need to reload the editor to suppress its warnings. |
Does anyone know if there is a solution to this issue? |
What version of rules_go are you using?
v0.29.0
What version of gazelle are you using?
v0.24.0
What version of Bazel are you using?
4.2.1
Does this issue reproduce with the latest releases of all the above?
I am using the latest versions already.
What operating system and processor architecture are you using?
Intel Mac
Any other potentially useful information about your toolchain?
Here's my
.vscode/settings.json
file:Here's my
tools/editor/gopackagesdriver.sh
file:What's working
We have a Go repo that's using Bazel. I am trying to make changes to that repo from VSCode. With the above mentioned files in the repo, "Go to Definition" etc. started working. Thank you! :)
What's not working
However, when I add a new package (along with its
BUILD.bazel
file), I can't successfully import it from another package (even after adding the new package in thedeps
of thego_library
rule).The import shows a red squiggly line which says the following on hover:
If I restart VSCode, the error goes away.
IntelliJ IDEA (GoLand) also has a similar issue with new packages, however there the problem is fixed by
Sync Project with BUILD Files
without restarting the IDE.cc @steeve @linzhp
The text was updated successfully, but these errors were encountered: