mirror of
https://github.com/golang/go.git
synced 2025-05-05 23:53:05 +00:00
internal/lsp/protocol: handle case of an otherwise empty notification
Some notifications, like exit, have no other arguments, a case the code was not handling correctly. Change-Id: Ib5ff536352ba6ad0d09cd80c9d5f0a987abbe500 Reviewed-on: https://go-review.googlesource.com/c/tools/+/200298 Reviewed-by: Rebecca Stambler <rstambler@golang.org> Run-TryBot: Peter Weinberger <pjw@google.com>
This commit is contained in:
parent
4c025a95b2
commit
8de300cfc2
@ -218,9 +218,13 @@ func logIn(outfd io.Writer, data []byte) {
|
|||||||
} else {
|
} else {
|
||||||
fmt.Fprintf(&buf, "Result: %s%s", string(*v.Result), eor)
|
fmt.Fprintf(&buf, "Result: %s%s", string(*v.Result), eor)
|
||||||
}
|
}
|
||||||
} else if v.ID == nil && v.Method != "" && v.Params != nil {
|
} else if v.ID == nil && v.Method != "" {
|
||||||
|
p := "null"
|
||||||
|
if v.Params != nil {
|
||||||
|
p = string(*v.Params)
|
||||||
|
}
|
||||||
fmt.Fprintf(&buf, "Sending notification '%s'.\n", v.Method)
|
fmt.Fprintf(&buf, "Sending 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
|
} else { // for completeness, as it should never happen
|
||||||
buf = strings.Builder{} // undo common Trace
|
buf = strings.Builder{} // undo common Trace
|
||||||
fmt.Fprintf(&buf, "[Error - %s] on read ID?%v method:%q Params:%v Result:%v Error:%v%s",
|
fmt.Fprintf(&buf, "[Error - %s] on read ID?%v method:%q Params:%v Result:%v Error:%v%s",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user