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
x/tools/gopls: unable to filter irrelevant diagnostics #36427
Comments
This may be a vim issue rather than one with gopls. The gopls syntax error message says that it is a diagnostic for p.go in its "uri" field. (at least when I try your example) gopls looks at p.go because it runs go/packages.Load ./... (that is, on the whole module) to report errors that would stop the module from compiling, I think. |
I don't think so. I raised this issue because the diagnostics returned by This isn't about me being able to filter to show only the And by extension we might also want to show diagnostic errors for reverse dependencies too, filtering out anything else. But without this information being sent by |
Can you share the
which make it clear that the error is not in |
That's exactly what I see as well.
Indeed. But we can't programmatically filter out that diagnostic in What I'm imagining here is three modes of showing diagnostics in the quickfix window in Vim:
Because if there are errors, like in package |
How would this work in the context of LSP |
That's exactly the reason for me raising this issue. |
This sounds like a specifically terminal-based editor issue. In VS Code, all diagnostics are associated with a file and diagnostics are shown for the whole workspace, so you are able to see which diagnostics belong to which file by looking in the file explorer tab on the left or through the "Problems" pane. I expect most people keep working until their entire workspace builds. In Vim, I see how this might be an issue since you don't have similar navigation tools. I would recommend looking into how other LSP clients handle this. The closest thing that LSP has for this is the "Related Information" in the diagnostic, but that's not exactly what you mean (I think). To me, it sounds like you are looking for additional configuration in |
At this point, we've migrated to diagnosing the user's entire workspace on every file change. I don't think we will move from this approach or add additional configuration for it in the near future, and the additional complexity does not seem worth the benefit to me. Closing this issue as a result. |
I am one such user providing feedback! Admittedly just one, but a user nonetheless 😄
I'm actually discussing/suggesting something different. But it's not high priority, so not worth us spending time on now. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Continuing discussion from #36243 (comment)
Consider the following setup:
Furthermore, that we want to work on the main package at the module root.
If we open
govim
and openmain.go
we see the following diagnostics:i.e. nothing to do with the main package.
Based on the diagnostics we get back from
gopls
, we (in the editor) have no way of filtering to only show the diagnostics that are relevant to the package we are working on (i.e. the package and its transitive dependencies).What did you expect to see?
Expected to have some way to filter the diagnostics based on my current file, i.e. context.
What did you see instead?
All diagnostics.
cc @stamblerre
The text was updated successfully, but these errors were encountered: