1
0
mirror of https://github.com/golang/go synced 2024-11-18 07:04:52 -07:00

lsp/general.go: change error messages to give more context

The origin and meaning of error messages in IDEs is sometimes obscure.
For instance "unexpected config annotations\nSource: Go (extension)" in vscode has an ambiguous Source, and it's not clear what config annotations
are being referred to. This CL would change the first part of that
message to "unexpected gopls setting 'annotations', making clear that
the message is from gopls (and not the Go extension shim), and that the
suspect value is 'annotations' itself.

Change-Id: Ia79534859fe101e6fbbd660bf426e2c1ac619b7f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/251078
Run-TryBot: Peter Weinberger <pjw@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
This commit is contained in:
Peter Weinbergr 2020-08-27 10:17:30 -04:00 committed by Peter Weinberger
parent debfaf60dc
commit 021d7c6f1e

View File

@ -418,14 +418,14 @@ func (s *Server) handleOptionResults(ctx context.Context, results source.OptionR
case source.OptionUnexpected:
if err := s.client.ShowMessage(ctx, &protocol.ShowMessageParams{
Type: protocol.Error,
Message: fmt.Sprintf("unexpected config %s", result.Name),
Message: fmt.Sprintf("unexpected gopls setting %q", result.Name),
}); err != nil {
return err
}
case source.OptionDeprecated:
msg := fmt.Sprintf("config %s is deprecated", result.Name)
msg := fmt.Sprintf("gopls setting %q is deprecated", result.Name)
if result.Replacement != "" {
msg = fmt.Sprintf("%s, use %s instead", msg, result.Replacement)
msg = fmt.Sprintf("%s, use %q instead", msg, result.Replacement)
}
if err := s.client.ShowMessage(ctx, &protocol.ShowMessageParams{
Type: protocol.Warning,