-
Notifications
You must be signed in to change notification settings - Fork 308
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
IDE indexing broken for go_proto_library with custom compilers #7010
Comments
I got an update for this: It seems that the problem is due to Let's say @my_plugin_repo//foo:my_plugin claims 6 files, but the protoc-plugin only generates 4 files. The missing 2 files will be generated by "rules_go" containing // +build ignore
package ignore Then, getPackageName somehow recognizes this, and return "ignore" as package name. For the official rules, the package name would be I hacked |
Hi @H5-O5, thank you for the details. Would you expect that getPackageName respects the |
Edit: I misunderstood. The answer is yes. getPackageName should respect |
@H5-O5, thank you for your suggestion. While I see where you’re coming from, Let me know if you have additional thoughts or scenarios where this approach might fall short. |
Here's an example of how build flags help avoid similar package conflicts in GoLand (without a Bazel plugin): link |
OK. I got it. The filter should be looking at fyi, this is where the placeholder go file is created: Could you consider this patch instead? return files.stream()
.map(file -> VfsUtils.resolveVirtualFile(file, /* refreshIfNeeded= */ false))
.filter(Objects::nonNull)
.map(psiManager::findFile)
.filter(GoFile.class::isInstance)
.map(GoFile.class::cast)
+ .filter(goFile -> !Objects.equals(goFile.getBuildFlags(), "ignore"))
.map(GoFile::getCanonicalPackageName) // strips _test suffix from test packages
.filter(Objects::nonNull)
.filter(packageName -> !packageName.equals("ignore")) If so, I'd like to make a PR of it. |
Hi @H5-05, thanks for the patch—it looks good! Please go ahead and open a PR, we’ll review it. |
This fixed the indexing problem caused by retrieving the wrong package name. fixes bazelbuild#7010
This fixed the indexing problem caused by retrieving the wrong package name. fixes #7010
Description of the bug:
Hi everyone, I wonder if someone could help me with this issue:
I have custom proto plugins, and my BUILD file looks like this:
where my_plugin will generate some codes in a different importpath.
bazel build
is happy (that is, if a target depends on cache_go_proto_my_plugin, it can successfully use the import path without a problem). But GoLand with bazel plugin would only indexmy.example.com/proj/cachepb
but notmy.example.com/proj/cachepb/cacheservice
.Interestingly, GoLand shows the import as green text with red wavy underline showing
unused import
. If I type cacheservice, it pops up completion entries correctly. But if you writefoo := cacheservice.SomeFunc()
, theSomeFunc()
is marked as red. You can't jump to SomeFunc andfoo.<TAB>
doesn't work.What could be the problem and how can I debug this?
Which category does this issue belong to?
No response
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Creating an MWE is not easy. Let's see if there are things I could try before I create an MWE.
Which Intellij IDE are you using? Please provide the specific version.
#GO-243.21565.208
What programming languages and tools are you using? Please provide specific versions.
No response
What Bazel plugin version are you using?
tried latest stable version and DEV version
Have you found anything relevant by searching the web?
Nope
Any other information, logs, or outputs that you want to share?
No response
The text was updated successfully, but these errors were encountered: