Skip to content

Commit 8b695b2

Browse files
committed
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 <[email protected]> Run-TryBot: Peter Weinberger <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent 7c411de commit 8b695b2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

internal/lsp/protocol/log.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,12 @@ func logOut(outfd io.Writer, data []byte) {
159159
fmt.Fprintf(&buf, "Result: %s%s", string(*v.Result), eor)
160160
}
161161
} else if v.ID == nil && v.Method != "" && v.Params != nil {
162+
p := "null"
163+
if v.Params != nil {
164+
p = string(*v.Params)
165+
}
162166
fmt.Fprintf(&buf, "Received notification '%s'.\n", v.Method)
163-
fmt.Fprintf(&buf, "Params: %s%s", *v.Params, eor)
167+
fmt.Fprintf(&buf, "Params: %s%s", p, eor)
164168
} else { // for completeness, as it should never happen
165169
buf = strings.Builder{} // undo common Trace
166170
fmt.Fprintf(&buf, "[Error - %s] on write ID?%v method:%q Params:%v Result:%v Error:%v%s",

0 commit comments

Comments
 (0)