internal/lsp: generate RPC interface from Typescript source

The generated code adds some server methods that are unsupported, but were
prviously unimplemented, and makes small adjusments to some parameter types.

Change-Id: I3dd32cafa3e457193f0771e0f8e150c88b381c82
Reviewed-on: https://go-review.googlesource.com/c/tools/+/173420
Run-TryBot: Peter Weinberger <pjw@google.com>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/internal/lsp/cmd/cmd.go b/internal/lsp/cmd/cmd.go
index 3155f42..af05dcd 100644
--- a/internal/lsp/cmd/cmd.go
+++ b/internal/lsp/cmd/cmd.go
@@ -190,7 +190,7 @@
 	}
 	return nil
 }
-func (c *baseClient) Telemetry(ctx context.Context, t interface{}) error { return nil }
+func (c *baseClient) Event(ctx context.Context, t *interface{}) error { return nil }
 func (c *baseClient) RegisterCapability(ctx context.Context, p *protocol.RegistrationParams) error {
 	return nil
 }
@@ -218,8 +218,8 @@
 	}
 	return results, nil
 }
-func (c *baseClient) ApplyEdit(ctx context.Context, p *protocol.ApplyWorkspaceEditParams) (bool, error) {
-	return false, nil
+func (c *baseClient) ApplyEdit(ctx context.Context, p *protocol.ApplyWorkspaceEditParams) (*protocol.ApplyWorkspaceEditResponse, error) {
+	return &protocol.ApplyWorkspaceEditResponse{Applied: false, FailureReason: "not implemented"}, nil
 }
 func (c *baseClient) PublishDiagnostics(ctx context.Context, p *protocol.PublishDiagnosticsParams) error {
 	return nil
diff --git a/internal/lsp/protocol/client.go b/internal/lsp/protocol/tsclient.go
similarity index 68%
rename from internal/lsp/protocol/client.go
rename to internal/lsp/protocol/tsclient.go
index 2962a77..71d6c11 100644
--- a/internal/lsp/protocol/client.go
+++ b/internal/lsp/protocol/tsclient.go
@@ -1,9 +1,7 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
 package protocol
 
+//automatically generated
+
 import (
 	"context"
 	"encoding/json"
@@ -14,15 +12,15 @@
 
 type Client interface {
 	ShowMessage(context.Context, *ShowMessageParams) error
-	ShowMessageRequest(context.Context, *ShowMessageRequestParams) (*MessageActionItem, error)
 	LogMessage(context.Context, *LogMessageParams) error
-	Telemetry(context.Context, interface{}) error
-	RegisterCapability(context.Context, *RegistrationParams) error
-	UnregisterCapability(context.Context, *UnregistrationParams) error
+	Event(context.Context, *interface{}) error
+	PublishDiagnostics(context.Context, *PublishDiagnosticsParams) error
 	WorkspaceFolders(context.Context) ([]WorkspaceFolder, error)
 	Configuration(context.Context, *ConfigurationParams) ([]interface{}, error)
-	ApplyEdit(context.Context, *ApplyWorkspaceEditParams) (bool, error)
-	PublishDiagnostics(context.Context, *PublishDiagnosticsParams) error
+	RegisterCapability(context.Context, *RegistrationParams) error
+	UnregisterCapability(context.Context, *UnregistrationParams) error
+	ShowMessageRequest(context.Context, *ShowMessageRequestParams) (*MessageActionItem, error)
+	ApplyEdit(context.Context, *ApplyWorkspaceEditParams) (*ApplyWorkspaceEditResponse, error)
 }
 
 func clientHandler(log xlog.Logger, client Client) jsonrpc2.Handler {
@@ -35,8 +33,7 @@
 				return
 			}
 			conn.Cancel(params.ID)
-
-		case "window/showMessage":
+		case "window/showMessage": // notif
 			var params ShowMessageParams
 			if err := json.Unmarshal(*r.Params, &params); err != nil {
 				sendParseError(ctx, log, conn, r, err)
@@ -45,19 +42,7 @@
 			if err := client.ShowMessage(ctx, &params); err != nil {
 				log.Errorf(ctx, "%v", err)
 			}
-
-		case "window/showMessageRequest":
-			var params ShowMessageRequestParams
-			if err := json.Unmarshal(*r.Params, &params); err != nil {
-				sendParseError(ctx, log, conn, r, err)
-				return
-			}
-			resp, err := client.ShowMessageRequest(ctx, &params)
-			if err := conn.Reply(ctx, r, resp, err); err != nil {
-				log.Errorf(ctx, "%v", err)
-			}
-
-		case "window/logMessage":
+		case "window/logMessage": // notif
 			var params LogMessageParams
 			if err := json.Unmarshal(*r.Params, &params); err != nil {
 				sendParseError(ctx, log, conn, r, err)
@@ -66,38 +51,25 @@
 			if err := client.LogMessage(ctx, &params); err != nil {
 				log.Errorf(ctx, "%v", err)
 			}
-
-		case "telemetry/event":
+		case "telemetry/event": // notif
 			var params interface{}
 			if err := json.Unmarshal(*r.Params, &params); err != nil {
 				sendParseError(ctx, log, conn, r, err)
 				return
 			}
-			if err := client.Telemetry(ctx, &params); err != nil {
+			if err := client.Event(ctx, &params); err != nil {
 				log.Errorf(ctx, "%v", err)
 			}
-
-		case "client/registerCapability":
-			var params RegistrationParams
+		case "textDocument/publishDiagnostics": // notif
+			var params PublishDiagnosticsParams
 			if err := json.Unmarshal(*r.Params, &params); err != nil {
 				sendParseError(ctx, log, conn, r, err)
 				return
 			}
-			if err := client.RegisterCapability(ctx, &params); err != nil {
+			if err := client.PublishDiagnostics(ctx, &params); err != nil {
 				log.Errorf(ctx, "%v", err)
 			}
-
-		case "client/unregisterCapability":
-			var params UnregistrationParams
-			if err := json.Unmarshal(*r.Params, &params); err != nil {
-				sendParseError(ctx, log, conn, r, err)
-				return
-			}
-			if err := client.UnregisterCapability(ctx, &params); err != nil {
-				log.Errorf(ctx, "%v", err)
-			}
-
-		case "workspace/workspaceFolders":
+		case "workspace/workspaceFolders": // req
 			if r.Params != nil {
 				conn.Reply(ctx, r, nil, jsonrpc2.NewErrorf(jsonrpc2.CodeInvalidParams, "Expected no params"))
 				return
@@ -106,8 +78,7 @@
 			if err := conn.Reply(ctx, r, resp, err); err != nil {
 				log.Errorf(ctx, "%v", err)
 			}
-
-		case "workspace/configuration":
+		case "workspace/configuration": // req
 			var params ConfigurationParams
 			if err := json.Unmarshal(*r.Params, &params); err != nil {
 				sendParseError(ctx, log, conn, r, err)
@@ -117,8 +88,35 @@
 			if err := conn.Reply(ctx, r, resp, err); err != nil {
 				log.Errorf(ctx, "%v", err)
 			}
-
-		case "workspace/applyEdit":
+		case "client/registerCapability": // req
+			var params RegistrationParams
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			if err := client.RegisterCapability(ctx, &params); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "client/unregisterCapability": // req
+			var params UnregistrationParams
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			if err := client.UnregisterCapability(ctx, &params); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "window/showMessageRequest": // req
+			var params ShowMessageRequestParams
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			resp, err := client.ShowMessageRequest(ctx, &params)
+			if err := conn.Reply(ctx, r, resp, err); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "workspace/applyEdit": // req
 			var params ApplyWorkspaceEditParams
 			if err := json.Unmarshal(*r.Params, &params); err != nil {
 				sendParseError(ctx, log, conn, r, err)
@@ -129,16 +127,6 @@
 				log.Errorf(ctx, "%v", err)
 			}
 
-		case "textDocument/publishDiagnostics":
-			var params PublishDiagnosticsParams
-			if err := json.Unmarshal(*r.Params, &params); err != nil {
-				sendParseError(ctx, log, conn, r, err)
-				return
-			}
-			if err := client.PublishDiagnostics(ctx, &params); err != nil {
-				log.Errorf(ctx, "%v", err)
-			}
-
 		default:
 			if r.IsNotify() {
 				conn.Reply(ctx, r, nil, jsonrpc2.NewErrorf(jsonrpc2.CodeMethodNotFound, "method %q not found", r.Method))
@@ -151,58 +139,57 @@
 	*jsonrpc2.Conn
 }
 
-func (c *clientDispatcher) ShowMessage(ctx context.Context, params *ShowMessageParams) error {
-	return c.Conn.Notify(ctx, "window/showMessage", params)
+func (s *clientDispatcher) ShowMessage(ctx context.Context, params *ShowMessageParams) error {
+	return s.Conn.Notify(ctx, "window/showMessage", params)
 }
 
-func (c *clientDispatcher) ShowMessageRequest(ctx context.Context, params *ShowMessageRequestParams) (*MessageActionItem, error) {
+func (s *clientDispatcher) LogMessage(ctx context.Context, params *LogMessageParams) error {
+	return s.Conn.Notify(ctx, "window/logMessage", params)
+}
+
+func (s *clientDispatcher) Event(ctx context.Context, params *interface{}) error {
+	return s.Conn.Notify(ctx, "telemetry/event", params)
+}
+
+func (s *clientDispatcher) PublishDiagnostics(ctx context.Context, params *PublishDiagnosticsParams) error {
+	return s.Conn.Notify(ctx, "textDocument/publishDiagnostics", params)
+}
+func (s *clientDispatcher) WorkspaceFolders(ctx context.Context) ([]WorkspaceFolder, error) {
+	var result []WorkspaceFolder
+	if err := s.Conn.Call(ctx, "workspace/workspaceFolders", nil, &result); err != nil {
+		return nil, err
+	}
+	return result, nil
+}
+
+func (s *clientDispatcher) Configuration(ctx context.Context, params *ConfigurationParams) ([]interface{}, error) {
+	var result []interface{}
+	if err := s.Conn.Call(ctx, "workspace/configuration", params, &result); err != nil {
+		return nil, err
+	}
+	return result, nil
+}
+
+func (s *clientDispatcher) RegisterCapability(ctx context.Context, params *RegistrationParams) error {
+	return s.Conn.Notify(ctx, "client/registerCapability", params) // Notify? (not Call?)
+}
+
+func (s *clientDispatcher) UnregisterCapability(ctx context.Context, params *UnregistrationParams) error {
+	return s.Conn.Notify(ctx, "client/unregisterCapability", params) // Notify? (not Call?)
+}
+
+func (s *clientDispatcher) ShowMessageRequest(ctx context.Context, params *ShowMessageRequestParams) (*MessageActionItem, error) {
 	var result MessageActionItem
-	if err := c.Conn.Call(ctx, "window/showMessageRequest", params, &result); err != nil {
+	if err := s.Conn.Call(ctx, "window/showMessageRequest", params, &result); err != nil {
 		return nil, err
 	}
 	return &result, nil
 }
 
-func (c *clientDispatcher) LogMessage(ctx context.Context, params *LogMessageParams) error {
-	return c.Conn.Notify(ctx, "window/logMessage", params)
-}
-
-func (c *clientDispatcher) Telemetry(ctx context.Context, params interface{}) error {
-	return c.Conn.Notify(ctx, "telemetry/event", params)
-}
-
-func (c *clientDispatcher) RegisterCapability(ctx context.Context, params *RegistrationParams) error {
-	return c.Conn.Notify(ctx, "client/registerCapability", params)
-}
-
-func (c *clientDispatcher) UnregisterCapability(ctx context.Context, params *UnregistrationParams) error {
-	return c.Conn.Notify(ctx, "client/unregisterCapability", params)
-}
-
-func (c *clientDispatcher) WorkspaceFolders(ctx context.Context) ([]WorkspaceFolder, error) {
-	var result []WorkspaceFolder
-	if err := c.Conn.Call(ctx, "workspace/workspaceFolders", nil, &result); err != nil {
+func (s *clientDispatcher) ApplyEdit(ctx context.Context, params *ApplyWorkspaceEditParams) (*ApplyWorkspaceEditResponse, error) {
+	var result ApplyWorkspaceEditResponse
+	if err := s.Conn.Call(ctx, "workspace/applyEdit", params, &result); err != nil {
 		return nil, err
 	}
-	return result, nil
-}
-
-func (c *clientDispatcher) Configuration(ctx context.Context, params *ConfigurationParams) ([]interface{}, error) {
-	var result []interface{}
-	if err := c.Conn.Call(ctx, "workspace/configuration", params, &result); err != nil {
-		return nil, err
-	}
-	return result, nil
-}
-
-func (c *clientDispatcher) ApplyEdit(ctx context.Context, params *ApplyWorkspaceEditParams) (bool, error) {
-	var result bool
-	if err := c.Conn.Call(ctx, "workspace/applyEdit", params, &result); err != nil {
-		return false, err
-	}
-	return result, nil
-}
-
-func (c *clientDispatcher) PublishDiagnostics(ctx context.Context, params *PublishDiagnosticsParams) error {
-	return c.Conn.Notify(ctx, "textDocument/publishDiagnostics", params)
+	return &result, nil
 }
diff --git a/internal/lsp/protocol/tsprotocol.go b/internal/lsp/protocol/tsprotocol.go
index 923cb00..62afa96 100644
--- a/internal/lsp/protocol/tsprotocol.go
+++ b/internal/lsp/protocol/tsprotocol.go
@@ -3378,6 +3378,27 @@
 	Text string `json:"text"`
 }
 
+// SetTraceParams is
+type SetTraceParams struct {
+
+	// Value is
+	Value TraceValues `json:"value"`
+}
+
+// LogTraceParams is
+type LogTraceParams struct {
+
+	// Message is
+	Message string `json:"message"`
+
+	// Verbose is
+	Verbose string `json:"verbose,omitempty"`
+}
+
+// Tracer is
+type Tracer struct {
+}
+
 // FoldingRangeKind defines constants
 type FoldingRangeKind string
 
@@ -3435,6 +3456,24 @@
 // TextDocumentSaveReason defines constants
 type TextDocumentSaveReason float64
 
+// ErrorCodes defines constants
+type ErrorCodes float64
+
+// Touch defines constants
+type Touch float64
+
+// Trace defines constants
+type Trace string
+
+// TraceFormat defines constants
+type TraceFormat string
+
+// ConnectionErrors defines constants
+type ConnectionErrors float64
+
+// ConnectionState defines constants
+type ConnectionState float64
+
 const (
 
 	/*Comment defined:
@@ -3890,6 +3929,42 @@
 	 * When the editor lost focus.
 	 */
 	FocusOut TextDocumentSaveReason = 3
+
+	// MessageWriteError is
+	MessageWriteError ErrorCodes = 1
+
+	// MessageReadError is
+	MessageReadError ErrorCodes = 2
+
+	// First is
+	First Touch = 1
+
+	// Last is
+	Last Touch = 2
+
+	// JSON is
+	JSON TraceFormat = "json"
+
+	/*Closed defined:
+	 * The connection is closed.
+	 */
+	Closed ConnectionErrors = 1
+
+	/*Disposed defined:
+	 * The connection got disposed.
+	 */
+	Disposed ConnectionErrors = 2
+
+	/*AlreadyListening defined:
+	 * The connection is already in listening mode.
+	 */
+	AlreadyListening ConnectionErrors = 3
+
+	// New is
+	New ConnectionState = 1
+
+	// Listening is
+	Listening ConnectionState = 2
 )
 
 // DocumentFilter is a type
@@ -3949,3 +4024,12 @@
  * by the client.
  */
 type DeclarationLink LocationLink
+
+// LSPMessageType is a type
+/**
+ * A LSP Log Entry.
+ */
+type LSPMessageType string
+
+// TraceValues is a type
+type TraceValues string
diff --git a/internal/lsp/protocol/server.go b/internal/lsp/protocol/tsserver.go
similarity index 80%
rename from internal/lsp/protocol/server.go
rename to internal/lsp/protocol/tsserver.go
index d2cbb66..e756b79 100644
--- a/internal/lsp/protocol/server.go
+++ b/internal/lsp/protocol/tsserver.go
@@ -1,9 +1,7 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
 package protocol
 
+//automatically generated
+
 import (
 	"context"
 	"encoding/json"
@@ -13,49 +11,234 @@
 )
 
 type Server interface {
-	Initialize(context.Context, *InitializeParams) (*InitializeResult, error)
-	Initialized(context.Context, *InitializedParams) error
-	Shutdown(context.Context) error
-	Exit(context.Context) error
 	DidChangeWorkspaceFolders(context.Context, *DidChangeWorkspaceFoldersParams) error
+	Initialized(context.Context, *InitializedParams) error
+	Exit(context.Context) error
 	DidChangeConfiguration(context.Context, *DidChangeConfigurationParams) error
-	DidChangeWatchedFiles(context.Context, *DidChangeWatchedFilesParams) error
-	Symbol(context.Context, *WorkspaceSymbolParams) ([]SymbolInformation, error)
-	ExecuteCommand(context.Context, *ExecuteCommandParams) (interface{}, error)
 	DidOpen(context.Context, *DidOpenTextDocumentParams) error
 	DidChange(context.Context, *DidChangeTextDocumentParams) error
-	WillSave(context.Context, *WillSaveTextDocumentParams) error
-	WillSaveWaitUntil(context.Context, *WillSaveTextDocumentParams) ([]TextEdit, error)
-	DidSave(context.Context, *DidSaveTextDocumentParams) error
 	DidClose(context.Context, *DidCloseTextDocumentParams) error
+	DidSave(context.Context, *DidSaveTextDocumentParams) error
+	WillSave(context.Context, *WillSaveTextDocumentParams) error
+	DidChangeWatchedFiles(context.Context, *DidChangeWatchedFilesParams) error
+	SetTraceNotification(context.Context, *SetTraceParams) error
+	LogTraceNotification(context.Context, *LogTraceParams) error
+	Implementation(context.Context, *TextDocumentPositionParams) ([]Location, error)
+	TypeDefinition(context.Context, *TextDocumentPositionParams) ([]Location, error)
+	DocumentColor(context.Context, *DocumentColorParams) ([]ColorInformation, error)
+	ColorPresentation(context.Context, *ColorPresentationParams) ([]ColorPresentation, error)
+	FoldingRange(context.Context, *FoldingRangeParams) ([]FoldingRange, error)
+	Declaration(context.Context, *TextDocumentPositionParams) ([]DeclarationLink, error)
+	SelectionRange(context.Context, *SelectionRangeParams) ([][]SelectionRange, error)
+	Initialize(context.Context, *InitializeParams) (*InitializeResult, error)
+	Shutdown(context.Context) error
+	WillSaveWaitUntil(context.Context, *WillSaveTextDocumentParams) ([]TextEdit, error)
 	Completion(context.Context, *CompletionParams) (*CompletionList, error)
-	CompletionResolve(context.Context, *CompletionItem) (*CompletionItem, error)
+	Resolve(context.Context, *CompletionItem) (*CompletionItem, error)
 	Hover(context.Context, *TextDocumentPositionParams) (*Hover, error)
 	SignatureHelp(context.Context, *TextDocumentPositionParams) (*SignatureHelp, error)
 	Definition(context.Context, *TextDocumentPositionParams) ([]Location, error)
-	TypeDefinition(context.Context, *TextDocumentPositionParams) ([]Location, error)
-	Implementation(context.Context, *TextDocumentPositionParams) ([]Location, error)
 	References(context.Context, *ReferenceParams) ([]Location, error)
 	DocumentHighlight(context.Context, *TextDocumentPositionParams) ([]DocumentHighlight, error)
 	DocumentSymbol(context.Context, *DocumentSymbolParams) ([]DocumentSymbol, error)
+	Symbol(context.Context, *WorkspaceSymbolParams) ([]SymbolInformation, error)
 	CodeAction(context.Context, *CodeActionParams) ([]CodeAction, error)
 	CodeLens(context.Context, *CodeLensParams) ([]CodeLens, error)
-	CodeLensResolve(context.Context, *CodeLens) (*CodeLens, error)
-	DocumentLink(context.Context, *DocumentLinkParams) ([]DocumentLink, error)
-	DocumentLinkResolve(context.Context, *DocumentLink) (*DocumentLink, error)
-	DocumentColor(context.Context, *DocumentColorParams) ([]ColorInformation, error)
-	ColorPresentation(context.Context, *ColorPresentationParams) ([]ColorPresentation, error)
+	ResolveCodeLens(context.Context, *CodeLens) (*CodeLens, error)
 	Formatting(context.Context, *DocumentFormattingParams) ([]TextEdit, error)
 	RangeFormatting(context.Context, *DocumentRangeFormattingParams) ([]TextEdit, error)
 	OnTypeFormatting(context.Context, *DocumentOnTypeFormattingParams) ([]TextEdit, error)
-	Rename(context.Context, *RenameParams) ([]WorkspaceEdit, error)
-	FoldingRange(context.Context, *FoldingRangeParams) ([]FoldingRange, error)
+	Rename(context.Context, *RenameParams) (*WorkspaceEdit, error)
+	PrepareRename(context.Context, *TextDocumentPositionParams) (*Range, error)
+	DocumentLink(context.Context, *DocumentLinkParams) ([]DocumentLink, error)
+	ResolveDocumentLink(context.Context, *DocumentLink) (*DocumentLink, error)
+	ExecuteCommand(context.Context, *ExecuteCommandParams) (interface{}, error)
 }
 
 func serverHandler(log xlog.Logger, server Server) jsonrpc2.Handler {
 	return func(ctx context.Context, conn *jsonrpc2.Conn, r *jsonrpc2.Request) {
 		switch r.Method {
-		case "initialize":
+		case "$/cancelRequest":
+			var params CancelParams
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			conn.Cancel(params.ID)
+		case "workspace/didChangeWorkspaceFolders": // notif
+			var params DidChangeWorkspaceFoldersParams
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			if err := server.DidChangeWorkspaceFolders(ctx, &params); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "initialized": // notif
+			var params InitializedParams
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			if err := server.Initialized(ctx, &params); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "exit": // notif
+			if err := server.Exit(ctx); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "workspace/didChangeConfiguration": // notif
+			var params DidChangeConfigurationParams
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			if err := server.DidChangeConfiguration(ctx, &params); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "textDocument/didOpen": // notif
+			var params DidOpenTextDocumentParams
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			if err := server.DidOpen(ctx, &params); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "textDocument/didChange": // notif
+			var params DidChangeTextDocumentParams
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			if err := server.DidChange(ctx, &params); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "textDocument/didClose": // notif
+			var params DidCloseTextDocumentParams
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			if err := server.DidClose(ctx, &params); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "textDocument/didSave": // notif
+			var params DidSaveTextDocumentParams
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			if err := server.DidSave(ctx, &params); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "textDocument/willSave": // notif
+			var params WillSaveTextDocumentParams
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			if err := server.WillSave(ctx, &params); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "workspace/didChangeWatchedFiles": // notif
+			var params DidChangeWatchedFilesParams
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			if err := server.DidChangeWatchedFiles(ctx, &params); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "$/setTraceNotification": // notif
+			var params SetTraceParams
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			if err := server.SetTraceNotification(ctx, &params); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "$/logTraceNotification": // notif
+			var params LogTraceParams
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			if err := server.LogTraceNotification(ctx, &params); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "textDocument/implementation": // req
+			var params TextDocumentPositionParams
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			resp, err := server.Implementation(ctx, &params)
+			if err := conn.Reply(ctx, r, resp, err); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "textDocument/typeDefinition": // req
+			var params TextDocumentPositionParams
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			resp, err := server.TypeDefinition(ctx, &params)
+			if err := conn.Reply(ctx, r, resp, err); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "textDocument/documentColor": // req
+			var params DocumentColorParams
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			resp, err := server.DocumentColor(ctx, &params)
+			if err := conn.Reply(ctx, r, resp, err); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "textDocument/colorPresentation": // req
+			var params ColorPresentationParams
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			resp, err := server.ColorPresentation(ctx, &params)
+			if err := conn.Reply(ctx, r, resp, err); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "textDocument/foldingRange": // req
+			var params FoldingRangeParams
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			resp, err := server.FoldingRange(ctx, &params)
+			if err := conn.Reply(ctx, r, resp, err); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "textDocument/declaration": // req
+			var params TextDocumentPositionParams
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			resp, err := server.Declaration(ctx, &params)
+			if err := conn.Reply(ctx, r, resp, err); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "textDocument/selectionRange": // req
+			var params SelectionRangeParams
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			resp, err := server.SelectionRange(ctx, &params)
+			if err := conn.Reply(ctx, r, resp, err); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "initialize": // req
 			var params InitializeParams
 			if err := json.Unmarshal(*r.Params, &params); err != nil {
 				sendParseError(ctx, log, conn, r, err)
@@ -65,76 +248,105 @@
 			if err := conn.Reply(ctx, r, resp, err); err != nil {
 				log.Errorf(ctx, "%v", err)
 			}
-
-		case "initialized":
-			var params InitializedParams
-			if err := json.Unmarshal(*r.Params, &params); err != nil {
-				sendParseError(ctx, log, conn, r, err)
-				return
-			}
-			if err := server.Initialized(ctx, &params); err != nil {
-				log.Errorf(ctx, "%v", err)
-			}
-
-		case "shutdown":
+		case "shutdown": // req
 			if r.Params != nil {
 				conn.Reply(ctx, r, nil, jsonrpc2.NewErrorf(jsonrpc2.CodeInvalidParams, "Expected no params"))
 				return
 			}
-			if err := server.Shutdown(ctx); err == nil {
-				conn.Reply(ctx, r, nil, nil)
-			} else {
+			if err := server.Shutdown(ctx); err != nil {
 				log.Errorf(ctx, "%v", err)
 			}
-
-		case "exit":
-			if r.Params != nil {
-				conn.Reply(ctx, r, nil, jsonrpc2.NewErrorf(jsonrpc2.CodeInvalidParams, "Expected no params"))
-				return
-			}
-			if err := server.Exit(ctx); err != nil {
-				log.Errorf(ctx, "%v", err)
-			}
-
-		case "$/cancelRequest":
-			var params CancelParams
+		case "textDocument/willSaveWaitUntil": // req
+			var params WillSaveTextDocumentParams
 			if err := json.Unmarshal(*r.Params, &params); err != nil {
 				sendParseError(ctx, log, conn, r, err)
 				return
 			}
-			conn.Cancel(params.ID)
-
-		case "workspace/didChangeWorkspaceFolders":
-			var params DidChangeWorkspaceFoldersParams
+			resp, err := server.WillSaveWaitUntil(ctx, &params)
+			if err := conn.Reply(ctx, r, resp, err); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "textDocument/completion": // req
+			var params CompletionParams
 			if err := json.Unmarshal(*r.Params, &params); err != nil {
 				sendParseError(ctx, log, conn, r, err)
 				return
 			}
-			if err := server.DidChangeWorkspaceFolders(ctx, &params); err != nil {
+			resp, err := server.Completion(ctx, &params)
+			if err := conn.Reply(ctx, r, resp, err); err != nil {
 				log.Errorf(ctx, "%v", err)
 			}
-
-		case "workspace/didChangeConfiguration":
-			var params DidChangeConfigurationParams
+		case "completionItem/resolve": // req
+			var params CompletionItem
 			if err := json.Unmarshal(*r.Params, &params); err != nil {
 				sendParseError(ctx, log, conn, r, err)
 				return
 			}
-			if err := server.DidChangeConfiguration(ctx, &params); err != nil {
+			resp, err := server.Resolve(ctx, &params)
+			if err := conn.Reply(ctx, r, resp, err); err != nil {
 				log.Errorf(ctx, "%v", err)
 			}
-
-		case "workspace/didChangeWatchedFiles":
-			var params DidChangeWatchedFilesParams
+		case "textDocument/hover": // req
+			var params TextDocumentPositionParams
 			if err := json.Unmarshal(*r.Params, &params); err != nil {
 				sendParseError(ctx, log, conn, r, err)
 				return
 			}
-			if err := server.DidChangeWatchedFiles(ctx, &params); err != nil {
+			resp, err := server.Hover(ctx, &params)
+			if err := conn.Reply(ctx, r, resp, err); err != nil {
 				log.Errorf(ctx, "%v", err)
 			}
-
-		case "workspace/symbol":
+		case "textDocument/signatureHelp": // req
+			var params TextDocumentPositionParams
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			resp, err := server.SignatureHelp(ctx, &params)
+			if err := conn.Reply(ctx, r, resp, err); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "textDocument/definition": // req
+			var params TextDocumentPositionParams
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			resp, err := server.Definition(ctx, &params)
+			if err := conn.Reply(ctx, r, resp, err); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "textDocument/references": // req
+			var params ReferenceParams
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			resp, err := server.References(ctx, &params)
+			if err := conn.Reply(ctx, r, resp, err); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "textDocument/documentHighlight": // req
+			var params TextDocumentPositionParams
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			resp, err := server.DocumentHighlight(ctx, &params)
+			if err := conn.Reply(ctx, r, resp, err); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "textDocument/documentSymbol": // req
+			var params DocumentSymbolParams
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			resp, err := server.DocumentSymbol(ctx, &params)
+			if err := conn.Reply(ctx, r, resp, err); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "workspace/symbol": // req
 			var params WorkspaceSymbolParams
 			if err := json.Unmarshal(*r.Params, &params); err != nil {
 				sendParseError(ctx, log, conn, r, err)
@@ -144,8 +356,107 @@
 			if err := conn.Reply(ctx, r, resp, err); err != nil {
 				log.Errorf(ctx, "%v", err)
 			}
-
-		case "workspace/executeCommand":
+		case "textDocument/codeAction": // req
+			var params CodeActionParams
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			resp, err := server.CodeAction(ctx, &params)
+			if err := conn.Reply(ctx, r, resp, err); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "textDocument/codeLens": // req
+			var params CodeLensParams
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			resp, err := server.CodeLens(ctx, &params)
+			if err := conn.Reply(ctx, r, resp, err); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "codeLens/resolve": // req
+			var params CodeLens
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			resp, err := server.ResolveCodeLens(ctx, &params)
+			if err := conn.Reply(ctx, r, resp, err); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "textDocument/formatting": // req
+			var params DocumentFormattingParams
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			resp, err := server.Formatting(ctx, &params)
+			if err := conn.Reply(ctx, r, resp, err); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "textDocument/rangeFormatting": // req
+			var params DocumentRangeFormattingParams
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			resp, err := server.RangeFormatting(ctx, &params)
+			if err := conn.Reply(ctx, r, resp, err); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "textDocument/onTypeFormatting": // req
+			var params DocumentOnTypeFormattingParams
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			resp, err := server.OnTypeFormatting(ctx, &params)
+			if err := conn.Reply(ctx, r, resp, err); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "textDocument/rename": // req
+			var params RenameParams
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			resp, err := server.Rename(ctx, &params)
+			if err := conn.Reply(ctx, r, resp, err); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "textDocument/prepareRename": // req
+			var params TextDocumentPositionParams
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			resp, err := server.PrepareRename(ctx, &params)
+			if err := conn.Reply(ctx, r, resp, err); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "textDocument/documentLink": // req
+			var params DocumentLinkParams
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			resp, err := server.DocumentLink(ctx, &params)
+			if err := conn.Reply(ctx, r, resp, err); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "documentLink/resolve": // req
+			var params DocumentLink
+			if err := json.Unmarshal(*r.Params, &params); err != nil {
+				sendParseError(ctx, log, conn, r, err)
+				return
+			}
+			resp, err := server.ResolveDocumentLink(ctx, &params)
+			if err := conn.Reply(ctx, r, resp, err); err != nil {
+				log.Errorf(ctx, "%v", err)
+			}
+		case "workspace/executeCommand": // req
 			var params ExecuteCommandParams
 			if err := json.Unmarshal(*r.Params, &params); err != nil {
 				sendParseError(ctx, log, conn, r, err)
@@ -156,308 +467,6 @@
 				log.Errorf(ctx, "%v", err)
 			}
 
-		case "textDocument/didOpen":
-			var params DidOpenTextDocumentParams
-			if err := json.Unmarshal(*r.Params, &params); err != nil {
-				sendParseError(ctx, log, conn, r, err)
-				return
-			}
-			if err := server.DidOpen(ctx, &params); err != nil {
-				log.Errorf(ctx, "%v", err)
-			}
-
-		case "textDocument/didChange":
-			var params DidChangeTextDocumentParams
-			if err := json.Unmarshal(*r.Params, &params); err != nil {
-				sendParseError(ctx, log, conn, r, err)
-				return
-			}
-			if err := server.DidChange(ctx, &params); err != nil {
-				log.Errorf(ctx, "%v", err)
-			}
-
-		case "textDocument/willSave":
-			var params WillSaveTextDocumentParams
-			if err := json.Unmarshal(*r.Params, &params); err != nil {
-				sendParseError(ctx, log, conn, r, err)
-				return
-			}
-			if err := server.WillSave(ctx, &params); err != nil {
-				log.Errorf(ctx, "%v", err)
-			}
-
-		case "textDocument/willSaveWaitUntil":
-			var params WillSaveTextDocumentParams
-			if err := json.Unmarshal(*r.Params, &params); err != nil {
-				sendParseError(ctx, log, conn, r, err)
-				return
-			}
-			resp, err := server.WillSaveWaitUntil(ctx, &params)
-			if err := conn.Reply(ctx, r, resp, err); err != nil {
-				log.Errorf(ctx, "%v", err)
-			}
-
-		case "textDocument/didSave":
-			var params DidSaveTextDocumentParams
-			if err := json.Unmarshal(*r.Params, &params); err != nil {
-				sendParseError(ctx, log, conn, r, err)
-				return
-			}
-			if err := server.DidSave(ctx, &params); err != nil {
-				log.Errorf(ctx, "%v", err)
-			}
-
-		case "textDocument/didClose":
-			var params DidCloseTextDocumentParams
-			if err := json.Unmarshal(*r.Params, &params); err != nil {
-				sendParseError(ctx, log, conn, r, err)
-				return
-			}
-			if err := server.DidClose(ctx, &params); err != nil {
-				log.Errorf(ctx, "%v", err)
-			}
-
-		case "textDocument/completion":
-			var params CompletionParams
-			if err := json.Unmarshal(*r.Params, &params); err != nil {
-				sendParseError(ctx, log, conn, r, err)
-				return
-			}
-			resp, err := server.Completion(ctx, &params)
-			if err := conn.Reply(ctx, r, resp, err); err != nil {
-				log.Errorf(ctx, "%v", err)
-			}
-
-		case "completionItem/resolve":
-			var params CompletionItem
-			if err := json.Unmarshal(*r.Params, &params); err != nil {
-				sendParseError(ctx, log, conn, r, err)
-				return
-			}
-			resp, err := server.CompletionResolve(ctx, &params)
-			if err := conn.Reply(ctx, r, resp, err); err != nil {
-				log.Errorf(ctx, "%v", err)
-			}
-
-		case "textDocument/hover":
-			var params TextDocumentPositionParams
-			if err := json.Unmarshal(*r.Params, &params); err != nil {
-				sendParseError(ctx, log, conn, r, err)
-				return
-			}
-			resp, err := server.Hover(ctx, &params)
-			if err := conn.Reply(ctx, r, resp, err); err != nil {
-				log.Errorf(ctx, "%v", err)
-			}
-
-		case "textDocument/signatureHelp":
-			var params TextDocumentPositionParams
-			if err := json.Unmarshal(*r.Params, &params); err != nil {
-				sendParseError(ctx, log, conn, r, err)
-				return
-			}
-			resp, err := server.SignatureHelp(ctx, &params)
-			if err := conn.Reply(ctx, r, resp, err); err != nil {
-				log.Errorf(ctx, "%v", err)
-			}
-
-		case "textDocument/definition":
-			var params TextDocumentPositionParams
-			if err := json.Unmarshal(*r.Params, &params); err != nil {
-				sendParseError(ctx, log, conn, r, err)
-				return
-			}
-			resp, err := server.Definition(ctx, &params)
-			if err := conn.Reply(ctx, r, resp, err); err != nil {
-				log.Errorf(ctx, "%v", err)
-			}
-
-		case "textDocument/typeDefinition":
-			var params TextDocumentPositionParams
-			if err := json.Unmarshal(*r.Params, &params); err != nil {
-				sendParseError(ctx, log, conn, r, err)
-				return
-			}
-			resp, err := server.TypeDefinition(ctx, &params)
-			if err := conn.Reply(ctx, r, resp, err); err != nil {
-				log.Errorf(ctx, "%v", err)
-			}
-
-		case "textDocument/implementation":
-			var params TextDocumentPositionParams
-			if err := json.Unmarshal(*r.Params, &params); err != nil {
-				sendParseError(ctx, log, conn, r, err)
-				return
-			}
-			resp, err := server.Implementation(ctx, &params)
-			if err := conn.Reply(ctx, r, resp, err); err != nil {
-				log.Errorf(ctx, "%v", err)
-			}
-
-		case "textDocument/references":
-			var params ReferenceParams
-			if err := json.Unmarshal(*r.Params, &params); err != nil {
-				sendParseError(ctx, log, conn, r, err)
-				return
-			}
-			resp, err := server.References(ctx, &params)
-			if err := conn.Reply(ctx, r, resp, err); err != nil {
-				log.Errorf(ctx, "%v", err)
-			}
-
-		case "textDocument/documentHighlight":
-			var params TextDocumentPositionParams
-			if err := json.Unmarshal(*r.Params, &params); err != nil {
-				sendParseError(ctx, log, conn, r, err)
-				return
-			}
-			resp, err := server.DocumentHighlight(ctx, &params)
-			if err := conn.Reply(ctx, r, resp, err); err != nil {
-				log.Errorf(ctx, "%v", err)
-			}
-
-		case "textDocument/documentSymbol":
-			var params DocumentSymbolParams
-			if err := json.Unmarshal(*r.Params, &params); err != nil {
-				sendParseError(ctx, log, conn, r, err)
-				return
-			}
-			resp, err := server.DocumentSymbol(ctx, &params)
-			if err := conn.Reply(ctx, r, resp, err); err != nil {
-				log.Errorf(ctx, "%v", err)
-			}
-
-		case "textDocument/codeAction":
-			var params CodeActionParams
-			if err := json.Unmarshal(*r.Params, &params); err != nil {
-				sendParseError(ctx, log, conn, r, err)
-				return
-			}
-			resp, err := server.CodeAction(ctx, &params)
-			if err := conn.Reply(ctx, r, resp, err); err != nil {
-				log.Errorf(ctx, "%v", err)
-			}
-
-		case "textDocument/codeLens":
-			var params CodeLensParams
-			if err := json.Unmarshal(*r.Params, &params); err != nil {
-				sendParseError(ctx, log, conn, r, err)
-				return
-			}
-			resp, err := server.CodeLens(ctx, &params)
-			if err := conn.Reply(ctx, r, resp, err); err != nil {
-				log.Errorf(ctx, "%v", err)
-			}
-
-		case "codeLens/resolve":
-			var params CodeLens
-			if err := json.Unmarshal(*r.Params, &params); err != nil {
-				sendParseError(ctx, log, conn, r, err)
-				return
-			}
-			resp, err := server.CodeLensResolve(ctx, &params)
-			if err := conn.Reply(ctx, r, resp, err); err != nil {
-				log.Errorf(ctx, "%v", err)
-			}
-
-		case "textDocument/documentLink":
-			var params DocumentLinkParams
-			if err := json.Unmarshal(*r.Params, &params); err != nil {
-				sendParseError(ctx, log, conn, r, err)
-				return
-			}
-			resp, err := server.DocumentLink(ctx, &params)
-			if err := conn.Reply(ctx, r, resp, err); err != nil {
-				log.Errorf(ctx, "%v", err)
-			}
-
-		case "documentLink/resolve":
-			var params DocumentLink
-			if err := json.Unmarshal(*r.Params, &params); err != nil {
-				sendParseError(ctx, log, conn, r, err)
-				return
-			}
-			resp, err := server.DocumentLinkResolve(ctx, &params)
-			if err := conn.Reply(ctx, r, resp, err); err != nil {
-				log.Errorf(ctx, "%v", err)
-			}
-
-		case "textDocument/documentColor":
-			var params DocumentColorParams
-			if err := json.Unmarshal(*r.Params, &params); err != nil {
-				sendParseError(ctx, log, conn, r, err)
-				return
-			}
-			resp, err := server.DocumentColor(ctx, &params)
-			if err := conn.Reply(ctx, r, resp, err); err != nil {
-				log.Errorf(ctx, "%v", err)
-			}
-
-		case "textDocument/colorPresentation":
-			var params ColorPresentationParams
-			if err := json.Unmarshal(*r.Params, &params); err != nil {
-				sendParseError(ctx, log, conn, r, err)
-				return
-			}
-			resp, err := server.ColorPresentation(ctx, &params)
-			if err := conn.Reply(ctx, r, resp, err); err != nil {
-				log.Errorf(ctx, "%v", err)
-			}
-
-		case "textDocument/formatting":
-			var params DocumentFormattingParams
-			if err := json.Unmarshal(*r.Params, &params); err != nil {
-				sendParseError(ctx, log, conn, r, err)
-				return
-			}
-			resp, err := server.Formatting(ctx, &params)
-			if err := conn.Reply(ctx, r, resp, err); err != nil {
-				log.Errorf(ctx, "%v", err)
-			}
-
-		case "textDocument/rangeFormatting":
-			var params DocumentRangeFormattingParams
-			if err := json.Unmarshal(*r.Params, &params); err != nil {
-				sendParseError(ctx, log, conn, r, err)
-				return
-			}
-			resp, err := server.RangeFormatting(ctx, &params)
-			if err := conn.Reply(ctx, r, resp, err); err != nil {
-				log.Errorf(ctx, "%v", err)
-			}
-
-		case "textDocument/onTypeFormatting":
-			var params DocumentOnTypeFormattingParams
-			if err := json.Unmarshal(*r.Params, &params); err != nil {
-				sendParseError(ctx, log, conn, r, err)
-				return
-			}
-			resp, err := server.OnTypeFormatting(ctx, &params)
-			if err := conn.Reply(ctx, r, resp, err); err != nil {
-				log.Errorf(ctx, "%v", err)
-			}
-
-		case "textDocument/rename":
-			var params RenameParams
-			if err := json.Unmarshal(*r.Params, &params); err != nil {
-				sendParseError(ctx, log, conn, r, err)
-				return
-			}
-			resp, err := server.Rename(ctx, &params)
-			if err := conn.Reply(ctx, r, resp, err); err != nil {
-				log.Errorf(ctx, "%v", err)
-			}
-
-		case "textDocument/foldingRange":
-			var params FoldingRangeParams
-			if err := json.Unmarshal(*r.Params, &params); err != nil {
-				sendParseError(ctx, log, conn, r, err)
-				return
-			}
-			resp, err := server.FoldingRange(ctx, &params)
-			if err := conn.Reply(ctx, r, resp, err); err != nil {
-				log.Errorf(ctx, "%v", err)
-			}
 		default:
 			if r.IsNotify() {
 				conn.Reply(ctx, r, nil, jsonrpc2.NewErrorf(jsonrpc2.CodeMethodNotFound, "method %q not found", r.Method))
@@ -470,54 +479,22 @@
 	*jsonrpc2.Conn
 }
 
-func (s *serverDispatcher) Initialize(ctx context.Context, params *InitializeParams) (*InitializeResult, error) {
-	var result InitializeResult
-	if err := s.Conn.Call(ctx, "initialize", params, &result); err != nil {
-		return nil, err
-	}
-	return &result, nil
+func (s *serverDispatcher) DidChangeWorkspaceFolders(ctx context.Context, params *DidChangeWorkspaceFoldersParams) error {
+	return s.Conn.Notify(ctx, "workspace/didChangeWorkspaceFolders", params)
 }
 
 func (s *serverDispatcher) Initialized(ctx context.Context, params *InitializedParams) error {
 	return s.Conn.Notify(ctx, "initialized", params)
 }
 
-func (s *serverDispatcher) Shutdown(ctx context.Context) error {
-	return s.Conn.Call(ctx, "shutdown", nil, nil)
-}
-
 func (s *serverDispatcher) Exit(ctx context.Context) error {
 	return s.Conn.Notify(ctx, "exit", nil)
 }
 
-func (s *serverDispatcher) DidChangeWorkspaceFolders(ctx context.Context, params *DidChangeWorkspaceFoldersParams) error {
-	return s.Conn.Notify(ctx, "workspace/didChangeWorkspaceFolders", params)
-}
-
 func (s *serverDispatcher) DidChangeConfiguration(ctx context.Context, params *DidChangeConfigurationParams) error {
 	return s.Conn.Notify(ctx, "workspace/didChangeConfiguration", params)
 }
 
-func (s *serverDispatcher) DidChangeWatchedFiles(ctx context.Context, params *DidChangeWatchedFilesParams) error {
-	return s.Conn.Notify(ctx, "workspace/didChangeWatchedFiles", params)
-}
-
-func (s *serverDispatcher) Symbol(ctx context.Context, params *WorkspaceSymbolParams) ([]SymbolInformation, error) {
-	var result []SymbolInformation
-	if err := s.Conn.Call(ctx, "workspace/symbol", params, &result); err != nil {
-		return nil, err
-	}
-	return result, nil
-}
-
-func (s *serverDispatcher) ExecuteCommand(ctx context.Context, params *ExecuteCommandParams) (interface{}, error) {
-	var result interface{}
-	if err := s.Conn.Call(ctx, "workspace/executeCommand", params, &result); err != nil {
-		return nil, err
-	}
-	return result, nil
-}
-
 func (s *serverDispatcher) DidOpen(ctx context.Context, params *DidOpenTextDocumentParams) error {
 	return s.Conn.Notify(ctx, "textDocument/didOpen", params)
 }
@@ -526,10 +503,97 @@
 	return s.Conn.Notify(ctx, "textDocument/didChange", params)
 }
 
+func (s *serverDispatcher) DidClose(ctx context.Context, params *DidCloseTextDocumentParams) error {
+	return s.Conn.Notify(ctx, "textDocument/didClose", params)
+}
+
+func (s *serverDispatcher) DidSave(ctx context.Context, params *DidSaveTextDocumentParams) error {
+	return s.Conn.Notify(ctx, "textDocument/didSave", params)
+}
+
 func (s *serverDispatcher) WillSave(ctx context.Context, params *WillSaveTextDocumentParams) error {
 	return s.Conn.Notify(ctx, "textDocument/willSave", params)
 }
 
+func (s *serverDispatcher) DidChangeWatchedFiles(ctx context.Context, params *DidChangeWatchedFilesParams) error {
+	return s.Conn.Notify(ctx, "workspace/didChangeWatchedFiles", params)
+}
+
+func (s *serverDispatcher) SetTraceNotification(ctx context.Context, params *SetTraceParams) error {
+	return s.Conn.Notify(ctx, "$/setTraceNotification", params)
+}
+
+func (s *serverDispatcher) LogTraceNotification(ctx context.Context, params *LogTraceParams) error {
+	return s.Conn.Notify(ctx, "$/logTraceNotification", params)
+}
+func (s *serverDispatcher) Implementation(ctx context.Context, params *TextDocumentPositionParams) ([]Location, error) {
+	var result []Location
+	if err := s.Conn.Call(ctx, "textDocument/implementation", params, &result); err != nil {
+		return nil, err
+	}
+	return result, nil
+}
+
+func (s *serverDispatcher) TypeDefinition(ctx context.Context, params *TextDocumentPositionParams) ([]Location, error) {
+	var result []Location
+	if err := s.Conn.Call(ctx, "textDocument/typeDefinition", params, &result); err != nil {
+		return nil, err
+	}
+	return result, nil
+}
+
+func (s *serverDispatcher) DocumentColor(ctx context.Context, params *DocumentColorParams) ([]ColorInformation, error) {
+	var result []ColorInformation
+	if err := s.Conn.Call(ctx, "textDocument/documentColor", params, &result); err != nil {
+		return nil, err
+	}
+	return result, nil
+}
+
+func (s *serverDispatcher) ColorPresentation(ctx context.Context, params *ColorPresentationParams) ([]ColorPresentation, error) {
+	var result []ColorPresentation
+	if err := s.Conn.Call(ctx, "textDocument/colorPresentation", params, &result); err != nil {
+		return nil, err
+	}
+	return result, nil
+}
+
+func (s *serverDispatcher) FoldingRange(ctx context.Context, params *FoldingRangeParams) ([]FoldingRange, error) {
+	var result []FoldingRange
+	if err := s.Conn.Call(ctx, "textDocument/foldingRange", params, &result); err != nil {
+		return nil, err
+	}
+	return result, nil
+}
+
+func (s *serverDispatcher) Declaration(ctx context.Context, params *TextDocumentPositionParams) ([]DeclarationLink, error) {
+	var result []DeclarationLink
+	if err := s.Conn.Call(ctx, "textDocument/declaration", params, &result); err != nil {
+		return nil, err
+	}
+	return result, nil
+}
+
+func (s *serverDispatcher) SelectionRange(ctx context.Context, params *SelectionRangeParams) ([][]SelectionRange, error) {
+	var result [][]SelectionRange
+	if err := s.Conn.Call(ctx, "textDocument/selectionRange", params, &result); err != nil {
+		return nil, err
+	}
+	return result, nil
+}
+
+func (s *serverDispatcher) Initialize(ctx context.Context, params *InitializeParams) (*InitializeResult, error) {
+	var result InitializeResult
+	if err := s.Conn.Call(ctx, "initialize", params, &result); err != nil {
+		return nil, err
+	}
+	return &result, nil
+}
+
+func (s *serverDispatcher) Shutdown(ctx context.Context) error {
+	return s.Conn.Call(ctx, "shutdown", nil, nil)
+}
+
 func (s *serverDispatcher) WillSaveWaitUntil(ctx context.Context, params *WillSaveTextDocumentParams) ([]TextEdit, error) {
 	var result []TextEdit
 	if err := s.Conn.Call(ctx, "textDocument/willSaveWaitUntil", params, &result); err != nil {
@@ -538,14 +602,6 @@
 	return result, nil
 }
 
-func (s *serverDispatcher) DidSave(ctx context.Context, params *DidSaveTextDocumentParams) error {
-	return s.Conn.Notify(ctx, "textDocument/didSave", params)
-}
-
-func (s *serverDispatcher) DidClose(ctx context.Context, params *DidCloseTextDocumentParams) error {
-	return s.Conn.Notify(ctx, "textDocument/didClose", params)
-}
-
 func (s *serverDispatcher) Completion(ctx context.Context, params *CompletionParams) (*CompletionList, error) {
 	var result CompletionList
 	if err := s.Conn.Call(ctx, "textDocument/completion", params, &result); err != nil {
@@ -554,7 +610,7 @@
 	return &result, nil
 }
 
-func (s *serverDispatcher) CompletionResolve(ctx context.Context, params *CompletionItem) (*CompletionItem, error) {
+func (s *serverDispatcher) Resolve(ctx context.Context, params *CompletionItem) (*CompletionItem, error) {
 	var result CompletionItem
 	if err := s.Conn.Call(ctx, "completionItem/resolve", params, &result); err != nil {
 		return nil, err
@@ -586,22 +642,6 @@
 	return result, nil
 }
 
-func (s *serverDispatcher) TypeDefinition(ctx context.Context, params *TextDocumentPositionParams) ([]Location, error) {
-	var result []Location
-	if err := s.Conn.Call(ctx, "textDocument/typeDefinition", params, &result); err != nil {
-		return nil, err
-	}
-	return result, nil
-}
-
-func (s *serverDispatcher) Implementation(ctx context.Context, params *TextDocumentPositionParams) ([]Location, error) {
-	var result []Location
-	if err := s.Conn.Call(ctx, "textDocument/implementation", params, &result); err != nil {
-		return nil, err
-	}
-	return result, nil
-}
-
 func (s *serverDispatcher) References(ctx context.Context, params *ReferenceParams) ([]Location, error) {
 	var result []Location
 	if err := s.Conn.Call(ctx, "textDocument/references", params, &result); err != nil {
@@ -626,6 +666,14 @@
 	return result, nil
 }
 
+func (s *serverDispatcher) Symbol(ctx context.Context, params *WorkspaceSymbolParams) ([]SymbolInformation, error) {
+	var result []SymbolInformation
+	if err := s.Conn.Call(ctx, "workspace/symbol", params, &result); err != nil {
+		return nil, err
+	}
+	return result, nil
+}
+
 func (s *serverDispatcher) CodeAction(ctx context.Context, params *CodeActionParams) ([]CodeAction, error) {
 	var result []CodeAction
 	if err := s.Conn.Call(ctx, "textDocument/codeAction", params, &result); err != nil {
@@ -642,7 +690,7 @@
 	return result, nil
 }
 
-func (s *serverDispatcher) CodeLensResolve(ctx context.Context, params *CodeLens) (*CodeLens, error) {
+func (s *serverDispatcher) ResolveCodeLens(ctx context.Context, params *CodeLens) (*CodeLens, error) {
 	var result CodeLens
 	if err := s.Conn.Call(ctx, "codeLens/resolve", params, &result); err != nil {
 		return nil, err
@@ -650,38 +698,6 @@
 	return &result, nil
 }
 
-func (s *serverDispatcher) DocumentLink(ctx context.Context, params *DocumentLinkParams) ([]DocumentLink, error) {
-	var result []DocumentLink
-	if err := s.Conn.Call(ctx, "textDocument/documentLink", params, &result); err != nil {
-		return nil, err
-	}
-	return result, nil
-}
-
-func (s *serverDispatcher) DocumentLinkResolve(ctx context.Context, params *DocumentLink) (*DocumentLink, error) {
-	var result DocumentLink
-	if err := s.Conn.Call(ctx, "documentLink/resolve", params, &result); err != nil {
-		return nil, err
-	}
-	return &result, nil
-}
-
-func (s *serverDispatcher) DocumentColor(ctx context.Context, params *DocumentColorParams) ([]ColorInformation, error) {
-	var result []ColorInformation
-	if err := s.Conn.Call(ctx, "textDocument/documentColor", params, &result); err != nil {
-		return nil, err
-	}
-	return result, nil
-}
-
-func (s *serverDispatcher) ColorPresentation(ctx context.Context, params *ColorPresentationParams) ([]ColorPresentation, error) {
-	var result []ColorPresentation
-	if err := s.Conn.Call(ctx, "textDocument/colorPresentation", params, &result); err != nil {
-		return nil, err
-	}
-	return result, nil
-}
-
 func (s *serverDispatcher) Formatting(ctx context.Context, params *DocumentFormattingParams) ([]TextEdit, error) {
 	var result []TextEdit
 	if err := s.Conn.Call(ctx, "textDocument/formatting", params, &result); err != nil {
@@ -706,17 +722,41 @@
 	return result, nil
 }
 
-func (s *serverDispatcher) Rename(ctx context.Context, params *RenameParams) ([]WorkspaceEdit, error) {
-	var result []WorkspaceEdit
+func (s *serverDispatcher) Rename(ctx context.Context, params *RenameParams) (*WorkspaceEdit, error) {
+	var result WorkspaceEdit
 	if err := s.Conn.Call(ctx, "textDocument/rename", params, &result); err != nil {
 		return nil, err
 	}
+	return &result, nil
+}
+
+func (s *serverDispatcher) PrepareRename(ctx context.Context, params *TextDocumentPositionParams) (*Range, error) {
+	var result Range
+	if err := s.Conn.Call(ctx, "textDocument/prepareRename", params, &result); err != nil {
+		return nil, err
+	}
+	return &result, nil
+}
+
+func (s *serverDispatcher) DocumentLink(ctx context.Context, params *DocumentLinkParams) ([]DocumentLink, error) {
+	var result []DocumentLink
+	if err := s.Conn.Call(ctx, "textDocument/documentLink", params, &result); err != nil {
+		return nil, err
+	}
 	return result, nil
 }
 
-func (s *serverDispatcher) FoldingRange(ctx context.Context, params *FoldingRangeParams) ([]FoldingRange, error) {
-	var result []FoldingRange
-	if err := s.Conn.Call(ctx, "textDocument/foldingRange", params, &result); err != nil {
+func (s *serverDispatcher) ResolveDocumentLink(ctx context.Context, params *DocumentLink) (*DocumentLink, error) {
+	var result DocumentLink
+	if err := s.Conn.Call(ctx, "documentLink/resolve", params, &result); err != nil {
+		return nil, err
+	}
+	return &result, nil
+}
+
+func (s *serverDispatcher) ExecuteCommand(ctx context.Context, params *ExecuteCommandParams) (interface{}, error) {
+	var result interface{}
+	if err := s.Conn.Call(ctx, "workspace/executeCommand", params, &result); err != nil {
 		return nil, err
 	}
 	return result, nil
diff --git a/internal/lsp/server.go b/internal/lsp/server.go
index 1f2d37b..63533e8 100644
--- a/internal/lsp/server.go
+++ b/internal/lsp/server.go
@@ -206,16 +206,16 @@
 	return nil, nil // ignore
 }
 
-func (s *Server) CodeLensResolve(context.Context, *protocol.CodeLens) (*protocol.CodeLens, error) {
-	return nil, notImplemented("CodeLensResolve")
+func (s *Server) ResolveCodeLens(context.Context, *protocol.CodeLens) (*protocol.CodeLens, error) {
+	return nil, notImplemented("ResolveCodeLens")
 }
 
 func (s *Server) DocumentLink(context.Context, *protocol.DocumentLinkParams) ([]protocol.DocumentLink, error) {
 	return nil, nil // ignore
 }
 
-func (s *Server) DocumentLinkResolve(context.Context, *protocol.DocumentLink) (*protocol.DocumentLink, error) {
-	return nil, notImplemented("DocumentLinkResolve")
+func (s *Server) ResolveDocumentLink(context.Context, *protocol.DocumentLink) (*protocol.DocumentLink, error) {
+	return nil, notImplemented("ResolveDocumentLink")
 }
 
 func (s *Server) DocumentColor(context.Context, *protocol.DocumentColorParams) ([]protocol.ColorInformation, error) {
@@ -238,14 +238,37 @@
 	return nil, notImplemented("OnTypeFormatting")
 }
 
-func (s *Server) Rename(context.Context, *protocol.RenameParams) ([]protocol.WorkspaceEdit, error) {
+func (s *Server) Rename(context.Context, *protocol.RenameParams) (*protocol.WorkspaceEdit, error) {
 	return nil, notImplemented("Rename")
 }
 
+func (s *Server) Declaration(context.Context, *protocol.TextDocumentPositionParams) ([]protocol.DeclarationLink, error) {
+	return nil, notImplemented("Declaration")
+}
+
 func (s *Server) FoldingRange(context.Context, *protocol.FoldingRangeParams) ([]protocol.FoldingRange, error) {
 	return nil, notImplemented("FoldingRange")
 }
 
+func (s *Server) LogTraceNotification(context.Context, *protocol.LogTraceParams) error {
+	return notImplemented("LogtraceNotification")
+}
+
+func (s *Server) PrepareRename(context.Context, *protocol.TextDocumentPositionParams) (*protocol.Range, error) {
+	return nil, notImplemented("PrepareRename")
+}
+
+func (s *Server) Resolve(context.Context, *protocol.CompletionItem) (*protocol.CompletionItem, error) {
+	return nil, notImplemented("Resolve")
+}
+
+func (s *Server) SelectionRange(context.Context, *protocol.SelectionRangeParams) ([][]protocol.SelectionRange, error) {
+	return nil, notImplemented("SelectionRange")
+}
+
+func (s *Server) SetTraceNotification(context.Context, *protocol.SetTraceParams) error {
+	return notImplemented("SetTraceNotification")
+}
 func notImplemented(method string) *jsonrpc2.Error {
 	return jsonrpc2.NewErrorf(jsonrpc2.CodeMethodNotFound, "method %q not yet implemented", method)
 }