Skip to content
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: use RelatedInformation for diagnostics on interface implementation errors #39062

Open
stamblerre opened this issue May 14, 2020 · 0 comments
Labels
FeatureRequest gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.

Comments

@stamblerre
Copy link
Contributor

See the example in https://play.golang.org/p/2TrSYmBsdLU.

In this case, both the compiler and go/types report error messages on L17 where the error occurs. However, in cases like these, the user is most likely interested in fixing their mistake on L9 by changing the return type of Hello. We should add this position in the RelatedInformation field of diagnostics.

@stamblerre stamblerre added this to the gopls/v0.5.0 milestone May 14, 2020
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels May 14, 2020
@stamblerre stamblerre modified the milestones: gopls/v0.5.0, gopls/v1.0.0 Jul 22, 2020
@stamblerre stamblerre removed this from the gopls/v1.0.0 milestone Aug 26, 2020
@stamblerre stamblerre changed the title x/tools/gopls: improve error messages for interface implementation diagnostics x/tools/gopls: make use of RelatedInformation in diagnostics Sep 4, 2020
gopherbot pushed a commit to golang/tools that referenced this issue Sep 4, 2020
The type checker sometimes emits secondary diagnostics. For instance,
if a function is defined twice, then when it sees the second definition
it emits a diagnostic at the second definition and a secondary diagnostic
pointing to the first diagnostic. Presently gopls treats these as two
separate diagnostics. The changed code still produces two diagnostics,
but now the secondary diagnostic is also converted into a
RelatedInformation so the user sees a xpointer to the earlier definition.

Updates golang/go#39062.

Change-Id: Ic421ec91d2b46c28681ab3ec010d5b02c0442e68
Reviewed-on: https://go-review.googlesource.com/c/tools/+/251617
Run-TryBot: Peter Weinberger <pjw@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
@stamblerre stamblerre added this to the gopls/unplanned milestone Oct 21, 2020
@stamblerre stamblerre changed the title x/tools/gopls: make use of RelatedInformation in diagnostics x/tools/gopls: use RelatedInformation for diagnostics on interface implementation Nov 13, 2020
@stamblerre stamblerre changed the title x/tools/gopls: use RelatedInformation for diagnostics on interface implementation x/tools/gopls: use RelatedInformation for diagnostics on interface implementation errors Nov 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

2 participants