From 8696927a2839210fb998cd751a78f8609855a381 Mon Sep 17 00:00:00 2001 From: Peter Weinberger Date: Mon, 13 May 2019 12:27:26 -0400 Subject: [PATCH] internal/lsp: respond to shutdown requests and add DO NOT EDITs Partly fixes golang/go#31333 (responds to shutdown request, but does not reject later requests) Fixes: golang/go#31375 by adding DO NOT EDIT comments to tsclient.go, tsserver.go, and further details in the package doc in tsprotocol.go, following the rule in golang/go#13560 Change-Id: I412e3dc6661373b8b70cdd15a385ad7bbd55a897 Reviewed-on: https://go-review.googlesource.com/c/tools/+/176921 Run-TryBot: Peter Weinberger Reviewed-by: Ian Cottrell TryBot-Result: Gobot Gobot --- internal/lsp/protocol/tsclient.go | 2 +- internal/lsp/protocol/tsprotocol.go | 7 +++++-- internal/lsp/protocol/tsserver.go | 5 +++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/internal/lsp/protocol/tsclient.go b/internal/lsp/protocol/tsclient.go index 71d6c1168f..b92f01c7b9 100644 --- a/internal/lsp/protocol/tsclient.go +++ b/internal/lsp/protocol/tsclient.go @@ -1,6 +1,6 @@ package protocol -//automatically generated +// Code generated (see typescript/README.md) DO NOT EDIT. import ( "context" diff --git a/internal/lsp/protocol/tsprotocol.go b/internal/lsp/protocol/tsprotocol.go index 62afa96506..e18587ef38 100644 --- a/internal/lsp/protocol/tsprotocol.go +++ b/internal/lsp/protocol/tsprotocol.go @@ -1,8 +1,11 @@ -// Package protocol contains data types for LSP jsonrpcs +// Package protocol contains data types and code for LSP jsonrpcs // generated automatically from vscode-languageserver-node -// version of Fri Apr 05 2019 10:16:07 GMT-0400 (Eastern Daylight Time) +// commit: 54f6caacea8aa0cf9f45527153d993010c1cc793 +// last fetched Fri Apr 05 2019 10:16:07 GMT-0400 (Eastern Daylight Time) package protocol +// Code generated (see typescript/README.md) DO NOT EDIT. + // WorkspaceFolder is type WorkspaceFolder struct { diff --git a/internal/lsp/protocol/tsserver.go b/internal/lsp/protocol/tsserver.go index e756b79ca5..3d53000cd5 100644 --- a/internal/lsp/protocol/tsserver.go +++ b/internal/lsp/protocol/tsserver.go @@ -1,6 +1,6 @@ package protocol -//automatically generated +// Code generated (see typescript/README.md) DO NOT EDIT. import ( "context" @@ -253,7 +253,8 @@ func serverHandler(log xlog.Logger, server Server) jsonrpc2.Handler { conn.Reply(ctx, r, nil, jsonrpc2.NewErrorf(jsonrpc2.CodeInvalidParams, "Expected no params")) return } - if err := server.Shutdown(ctx); err != nil { + err := server.Shutdown(ctx) + if err := conn.Reply(ctx, r, nil, err); err != nil { log.Errorf(ctx, "%v", err) } case "textDocument/willSaveWaitUntil": // req