From 021d7c6f1ec3b072c6175125fc4d83db2169c352 Mon Sep 17 00:00:00 2001 From: Peter Weinbergr Date: Thu, 27 Aug 2020 10:17:30 -0400 Subject: [PATCH] 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 TryBot-Result: Gobot Gobot Reviewed-by: Rebecca Stambler --- internal/lsp/general.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/lsp/general.go b/internal/lsp/general.go index 29e274d893..53424de435 100644 --- a/internal/lsp/general.go +++ b/internal/lsp/general.go @@ -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,