Skip to content

Commit

Permalink
lsp/general.go: change error messages to give more context
Browse files Browse the repository at this point in the history
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 <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Rebecca Stambler <[email protected]>
  • Loading branch information
pjweinbgo committed Aug 27, 2020
1 parent debfaf6 commit 021d7c6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/lsp/general.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 021d7c6

Please sign in to comment.