1
0
mirror of https://github.com/golang/go synced 2024-11-18 12:54:44 -07:00

internal/lsp/protocol: generate correct log messages for 'exit' notifications

The log code left out the case where a notification had no parameters at all.

Change-Id: I1d832edb7b7e85422ef6baba1e05286e69dd0cde
Reviewed-on: https://go-review.googlesource.com/c/tools/+/197724
Reviewed-by: Ian Cottrell <iancottrell@google.com>
Run-TryBot: Peter Weinberger <pjw@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Peter Weinberger 2019-09-30 12:54:23 -04:00
parent 7c411dea38
commit 8b695b21ef

View File

@ -159,8 +159,12 @@ func logOut(outfd io.Writer, data []byte) {
fmt.Fprintf(&buf, "Result: %s%s", string(*v.Result), eor)
}
} else if v.ID == nil && v.Method != "" && v.Params != nil {
p := "null"
if v.Params != nil {
p = string(*v.Params)
}
fmt.Fprintf(&buf, "Received notification '%s'.\n", v.Method)
fmt.Fprintf(&buf, "Params: %s%s", *v.Params, eor)
fmt.Fprintf(&buf, "Params: %s%s", p, eor)
} else { // for completeness, as it should never happen
buf = strings.Builder{} // undo common Trace
fmt.Fprintf(&buf, "[Error - %s] on write ID?%v method:%q Params:%v Result:%v Error:%v%s",