github.com/april1989/origin-go-tools@v0.0.32/internal/lsp/protocol/tsserver.go (about)

     1  package protocol
     2  
     3  // Package protocol contains data types and code for LSP jsonrpcs
     4  // generated automatically from vscode-languageserver-node
     5  // commit: 399de64448129835b53c7efe8962de91681d6cde
     6  // last fetched Wed Aug 26 2020 20:34:24 GMT-0400 (Eastern Daylight Time)
     7  
     8  // Code generated (see typescript/README.md) DO NOT EDIT.
     9  
    10  import (
    11  	"context"
    12  	"encoding/json"
    13  
    14  	"github.com/april1989/origin-go-tools/internal/jsonrpc2"
    15  	errors "golang.org/x/xerrors"
    16  )
    17  
    18  type Server interface {
    19  	DidChangeWorkspaceFolders(context.Context, *DidChangeWorkspaceFoldersParams) error
    20  	WorkDoneProgressCancel(context.Context, *WorkDoneProgressCancelParams) error
    21  	Initialized(context.Context, *InitializedParams) error
    22  	Exit(context.Context) error
    23  	DidChangeConfiguration(context.Context, *DidChangeConfigurationParams) error
    24  	DidOpen(context.Context, *DidOpenTextDocumentParams) error
    25  	DidChange(context.Context, *DidChangeTextDocumentParams) error
    26  	DidClose(context.Context, *DidCloseTextDocumentParams) error
    27  	DidSave(context.Context, *DidSaveTextDocumentParams) error
    28  	WillSave(context.Context, *WillSaveTextDocumentParams) error
    29  	DidChangeWatchedFiles(context.Context, *DidChangeWatchedFilesParams) error
    30  	SetTrace(context.Context, *SetTraceParams) error
    31  	LogTrace(context.Context, *LogTraceParams) error
    32  	Implementation(context.Context, *ImplementationParams) (Definition /*Definition | DefinitionLink[] | null*/, error)
    33  	TypeDefinition(context.Context, *TypeDefinitionParams) (Definition /*Definition | DefinitionLink[] | null*/, error)
    34  	DocumentColor(context.Context, *DocumentColorParams) ([]ColorInformation, error)
    35  	ColorPresentation(context.Context, *ColorPresentationParams) ([]ColorPresentation, error)
    36  	FoldingRange(context.Context, *FoldingRangeParams) ([]FoldingRange /*FoldingRange[] | null*/, error)
    37  	Declaration(context.Context, *DeclarationParams) (Declaration /*Declaration | DeclarationLink[] | null*/, error)
    38  	SelectionRange(context.Context, *SelectionRangeParams) ([]SelectionRange /*SelectionRange[] | null*/, error)
    39  	PrepareCallHierarchy(context.Context, *CallHierarchyPrepareParams) ([]CallHierarchyItem /*CallHierarchyItem[] | null*/, error)
    40  	IncomingCalls(context.Context, *CallHierarchyIncomingCallsParams) ([]CallHierarchyIncomingCall /*CallHierarchyIncomingCall[] | null*/, error)
    41  	OutgoingCalls(context.Context, *CallHierarchyOutgoingCallsParams) ([]CallHierarchyOutgoingCall /*CallHierarchyOutgoingCall[] | null*/, error)
    42  	Initialize(context.Context, *ParamInitialize) (*InitializeResult, error)
    43  	Shutdown(context.Context) error
    44  	WillSaveWaitUntil(context.Context, *WillSaveTextDocumentParams) ([]TextEdit /*TextEdit[] | null*/, error)
    45  	Completion(context.Context, *CompletionParams) (*CompletionList /*CompletionItem[] | CompletionList | null*/, error)
    46  	Resolve(context.Context, *CompletionItem) (*CompletionItem, error)
    47  	Hover(context.Context, *HoverParams) (*Hover /*Hover | null*/, error)
    48  	SignatureHelp(context.Context, *SignatureHelpParams) (*SignatureHelp /*SignatureHelp | null*/, error)
    49  	Definition(context.Context, *DefinitionParams) (Definition /*Definition | DefinitionLink[] | null*/, error)
    50  	References(context.Context, *ReferenceParams) ([]Location /*Location[] | null*/, error)
    51  	DocumentHighlight(context.Context, *DocumentHighlightParams) ([]DocumentHighlight /*DocumentHighlight[] | null*/, error)
    52  	DocumentSymbol(context.Context, *DocumentSymbolParams) ([]interface{} /*SymbolInformation[] | DocumentSymbol[] | null*/, error)
    53  	CodeAction(context.Context, *CodeActionParams) ([]CodeAction /*(Command | CodeAction)[] | null*/, error)
    54  	Symbol(context.Context, *WorkspaceSymbolParams) ([]SymbolInformation /*SymbolInformation[] | null*/, error)
    55  	CodeLens(context.Context, *CodeLensParams) ([]CodeLens /*CodeLens[] | null*/, error)
    56  	ResolveCodeLens(context.Context, *CodeLens) (*CodeLens, error)
    57  	DocumentLink(context.Context, *DocumentLinkParams) ([]DocumentLink /*DocumentLink[] | null*/, error)
    58  	ResolveDocumentLink(context.Context, *DocumentLink) (*DocumentLink, error)
    59  	Formatting(context.Context, *DocumentFormattingParams) ([]TextEdit /*TextEdit[] | null*/, error)
    60  	RangeFormatting(context.Context, *DocumentRangeFormattingParams) ([]TextEdit /*TextEdit[] | null*/, error)
    61  	OnTypeFormatting(context.Context, *DocumentOnTypeFormattingParams) ([]TextEdit /*TextEdit[] | null*/, error)
    62  	Rename(context.Context, *RenameParams) (*WorkspaceEdit /*WorkspaceEdit | null*/, error)
    63  	PrepareRename(context.Context, *PrepareRenameParams) (*Range /*Range | { range: Range, placeholder: string } | null*/, error)
    64  	ExecuteCommand(context.Context, *ExecuteCommandParams) (interface{} /*any | null*/, error)
    65  	SemanticTokensFull(context.Context, *SemanticTokensParams) (*SemanticTokens /*SemanticTokens | null*/, error)
    66  	SemanticTokensFullDelta(context.Context, *SemanticTokensDeltaParams) (interface{} /* SemanticTokens | SemanticTokensDelta | nil*/, error)
    67  	SemanticTokensRange(context.Context, *SemanticTokensRangeParams) (*SemanticTokens /*SemanticTokens | null*/, error)
    68  	NonstandardRequest(ctx context.Context, method string, params interface{}) (interface{}, error)
    69  }
    70  
    71  func serverDispatch(ctx context.Context, server Server, reply jsonrpc2.Replier, r jsonrpc2.Request) (bool, error) {
    72  	switch r.Method() {
    73  	case "workspace/didChangeWorkspaceFolders": // notif
    74  		var params DidChangeWorkspaceFoldersParams
    75  		if err := json.Unmarshal(r.Params(), &params); err != nil {
    76  			return true, sendParseError(ctx, reply, err)
    77  		}
    78  		err := server.DidChangeWorkspaceFolders(ctx, &params)
    79  		return true, reply(ctx, nil, err)
    80  	case "window/workDoneProgress/cancel": // notif
    81  		var params WorkDoneProgressCancelParams
    82  		if err := json.Unmarshal(r.Params(), &params); err != nil {
    83  			return true, sendParseError(ctx, reply, err)
    84  		}
    85  		err := server.WorkDoneProgressCancel(ctx, &params)
    86  		return true, reply(ctx, nil, err)
    87  	case "initialized": // notif
    88  		var params InitializedParams
    89  		if err := json.Unmarshal(r.Params(), &params); err != nil {
    90  			return true, sendParseError(ctx, reply, err)
    91  		}
    92  		err := server.Initialized(ctx, &params)
    93  		return true, reply(ctx, nil, err)
    94  	case "exit": // notif
    95  		err := server.Exit(ctx)
    96  		return true, reply(ctx, nil, err)
    97  	case "workspace/didChangeConfiguration": // notif
    98  		var params DidChangeConfigurationParams
    99  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   100  			return true, sendParseError(ctx, reply, err)
   101  		}
   102  		err := server.DidChangeConfiguration(ctx, &params)
   103  		return true, reply(ctx, nil, err)
   104  	case "textDocument/didOpen": // notif
   105  		var params DidOpenTextDocumentParams
   106  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   107  			return true, sendParseError(ctx, reply, err)
   108  		}
   109  		err := server.DidOpen(ctx, &params)
   110  		return true, reply(ctx, nil, err)
   111  	case "textDocument/didChange": // notif
   112  		var params DidChangeTextDocumentParams
   113  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   114  			return true, sendParseError(ctx, reply, err)
   115  		}
   116  		err := server.DidChange(ctx, &params)
   117  		return true, reply(ctx, nil, err)
   118  	case "textDocument/didClose": // notif
   119  		var params DidCloseTextDocumentParams
   120  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   121  			return true, sendParseError(ctx, reply, err)
   122  		}
   123  		err := server.DidClose(ctx, &params)
   124  		return true, reply(ctx, nil, err)
   125  	case "textDocument/didSave": // notif
   126  		var params DidSaveTextDocumentParams
   127  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   128  			return true, sendParseError(ctx, reply, err)
   129  		}
   130  		err := server.DidSave(ctx, &params)
   131  		return true, reply(ctx, nil, err)
   132  	case "textDocument/willSave": // notif
   133  		var params WillSaveTextDocumentParams
   134  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   135  			return true, sendParseError(ctx, reply, err)
   136  		}
   137  		err := server.WillSave(ctx, &params)
   138  		return true, reply(ctx, nil, err)
   139  	case "workspace/didChangeWatchedFiles": // notif
   140  		var params DidChangeWatchedFilesParams
   141  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   142  			return true, sendParseError(ctx, reply, err)
   143  		}
   144  		err := server.DidChangeWatchedFiles(ctx, &params)
   145  		return true, reply(ctx, nil, err)
   146  	case "$/setTrace": // notif
   147  		var params SetTraceParams
   148  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   149  			return true, sendParseError(ctx, reply, err)
   150  		}
   151  		err := server.SetTrace(ctx, &params)
   152  		return true, reply(ctx, nil, err)
   153  	case "$/logTrace": // notif
   154  		var params LogTraceParams
   155  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   156  			return true, sendParseError(ctx, reply, err)
   157  		}
   158  		err := server.LogTrace(ctx, &params)
   159  		return true, reply(ctx, nil, err)
   160  	case "textDocument/implementation": // req
   161  		var params ImplementationParams
   162  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   163  			return true, sendParseError(ctx, reply, err)
   164  		}
   165  		resp, err := server.Implementation(ctx, &params)
   166  		return true, reply(ctx, resp, err)
   167  	case "textDocument/typeDefinition": // req
   168  		var params TypeDefinitionParams
   169  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   170  			return true, sendParseError(ctx, reply, err)
   171  		}
   172  		resp, err := server.TypeDefinition(ctx, &params)
   173  		return true, reply(ctx, resp, err)
   174  	case "textDocument/documentColor": // req
   175  		var params DocumentColorParams
   176  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   177  			return true, sendParseError(ctx, reply, err)
   178  		}
   179  		resp, err := server.DocumentColor(ctx, &params)
   180  		return true, reply(ctx, resp, err)
   181  	case "textDocument/colorPresentation": // req
   182  		var params ColorPresentationParams
   183  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   184  			return true, sendParseError(ctx, reply, err)
   185  		}
   186  		resp, err := server.ColorPresentation(ctx, &params)
   187  		return true, reply(ctx, resp, err)
   188  	case "textDocument/foldingRange": // req
   189  		var params FoldingRangeParams
   190  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   191  			return true, sendParseError(ctx, reply, err)
   192  		}
   193  		resp, err := server.FoldingRange(ctx, &params)
   194  		return true, reply(ctx, resp, err)
   195  	case "textDocument/declaration": // req
   196  		var params DeclarationParams
   197  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   198  			return true, sendParseError(ctx, reply, err)
   199  		}
   200  		resp, err := server.Declaration(ctx, &params)
   201  		return true, reply(ctx, resp, err)
   202  	case "textDocument/selectionRange": // req
   203  		var params SelectionRangeParams
   204  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   205  			return true, sendParseError(ctx, reply, err)
   206  		}
   207  		resp, err := server.SelectionRange(ctx, &params)
   208  		return true, reply(ctx, resp, err)
   209  	case "textDocument/prepareCallHierarchy": // req
   210  		var params CallHierarchyPrepareParams
   211  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   212  			return true, sendParseError(ctx, reply, err)
   213  		}
   214  		resp, err := server.PrepareCallHierarchy(ctx, &params)
   215  		return true, reply(ctx, resp, err)
   216  	case "callHierarchy/incomingCalls": // req
   217  		var params CallHierarchyIncomingCallsParams
   218  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   219  			return true, sendParseError(ctx, reply, err)
   220  		}
   221  		resp, err := server.IncomingCalls(ctx, &params)
   222  		return true, reply(ctx, resp, err)
   223  	case "callHierarchy/outgoingCalls": // req
   224  		var params CallHierarchyOutgoingCallsParams
   225  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   226  			return true, sendParseError(ctx, reply, err)
   227  		}
   228  		resp, err := server.OutgoingCalls(ctx, &params)
   229  		return true, reply(ctx, resp, err)
   230  	case "initialize": // req
   231  		var params ParamInitialize
   232  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   233  			return true, sendParseError(ctx, reply, err)
   234  		}
   235  		resp, err := server.Initialize(ctx, &params)
   236  		return true, reply(ctx, resp, err)
   237  	case "shutdown": // req
   238  		if len(r.Params()) > 0 {
   239  			return true, reply(ctx, nil, errors.Errorf("%w: expected no params", jsonrpc2.ErrInvalidParams))
   240  		}
   241  		err := server.Shutdown(ctx)
   242  		return true, reply(ctx, nil, err)
   243  	case "textDocument/willSaveWaitUntil": // req
   244  		var params WillSaveTextDocumentParams
   245  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   246  			return true, sendParseError(ctx, reply, err)
   247  		}
   248  		resp, err := server.WillSaveWaitUntil(ctx, &params)
   249  		return true, reply(ctx, resp, err)
   250  	case "textDocument/completion": // req
   251  		var params CompletionParams
   252  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   253  			return true, sendParseError(ctx, reply, err)
   254  		}
   255  		resp, err := server.Completion(ctx, &params)
   256  		return true, reply(ctx, resp, err)
   257  	case "completionItem/resolve": // req
   258  		var params CompletionItem
   259  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   260  			return true, sendParseError(ctx, reply, err)
   261  		}
   262  		resp, err := server.Resolve(ctx, &params)
   263  		return true, reply(ctx, resp, err)
   264  	case "textDocument/hover": // req
   265  		var params HoverParams
   266  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   267  			return true, sendParseError(ctx, reply, err)
   268  		}
   269  		resp, err := server.Hover(ctx, &params)
   270  		return true, reply(ctx, resp, err)
   271  	case "textDocument/signatureHelp": // req
   272  		var params SignatureHelpParams
   273  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   274  			return true, sendParseError(ctx, reply, err)
   275  		}
   276  		resp, err := server.SignatureHelp(ctx, &params)
   277  		return true, reply(ctx, resp, err)
   278  	case "textDocument/definition": // req
   279  		var params DefinitionParams
   280  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   281  			return true, sendParseError(ctx, reply, err)
   282  		}
   283  		resp, err := server.Definition(ctx, &params)
   284  		return true, reply(ctx, resp, err)
   285  	case "textDocument/references": // req
   286  		var params ReferenceParams
   287  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   288  			return true, sendParseError(ctx, reply, err)
   289  		}
   290  		resp, err := server.References(ctx, &params)
   291  		return true, reply(ctx, resp, err)
   292  	case "textDocument/documentHighlight": // req
   293  		var params DocumentHighlightParams
   294  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   295  			return true, sendParseError(ctx, reply, err)
   296  		}
   297  		resp, err := server.DocumentHighlight(ctx, &params)
   298  		return true, reply(ctx, resp, err)
   299  	case "textDocument/documentSymbol": // req
   300  		var params DocumentSymbolParams
   301  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   302  			return true, sendParseError(ctx, reply, err)
   303  		}
   304  		resp, err := server.DocumentSymbol(ctx, &params)
   305  		return true, reply(ctx, resp, err)
   306  	case "textDocument/codeAction": // req
   307  		var params CodeActionParams
   308  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   309  			return true, sendParseError(ctx, reply, err)
   310  		}
   311  		resp, err := server.CodeAction(ctx, &params)
   312  		return true, reply(ctx, resp, err)
   313  	case "workspace/symbol": // req
   314  		var params WorkspaceSymbolParams
   315  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   316  			return true, sendParseError(ctx, reply, err)
   317  		}
   318  		resp, err := server.Symbol(ctx, &params)
   319  		return true, reply(ctx, resp, err)
   320  	case "textDocument/codeLens": // req
   321  		var params CodeLensParams
   322  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   323  			return true, sendParseError(ctx, reply, err)
   324  		}
   325  		resp, err := server.CodeLens(ctx, &params)
   326  		return true, reply(ctx, resp, err)
   327  	case "codeLens/resolve": // req
   328  		var params CodeLens
   329  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   330  			return true, sendParseError(ctx, reply, err)
   331  		}
   332  		resp, err := server.ResolveCodeLens(ctx, &params)
   333  		return true, reply(ctx, resp, err)
   334  	case "textDocument/documentLink": // req
   335  		var params DocumentLinkParams
   336  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   337  			return true, sendParseError(ctx, reply, err)
   338  		}
   339  		resp, err := server.DocumentLink(ctx, &params)
   340  		return true, reply(ctx, resp, err)
   341  	case "documentLink/resolve": // req
   342  		var params DocumentLink
   343  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   344  			return true, sendParseError(ctx, reply, err)
   345  		}
   346  		resp, err := server.ResolveDocumentLink(ctx, &params)
   347  		return true, reply(ctx, resp, err)
   348  	case "textDocument/formatting": // req
   349  		var params DocumentFormattingParams
   350  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   351  			return true, sendParseError(ctx, reply, err)
   352  		}
   353  		resp, err := server.Formatting(ctx, &params)
   354  		return true, reply(ctx, resp, err)
   355  	case "textDocument/rangeFormatting": // req
   356  		var params DocumentRangeFormattingParams
   357  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   358  			return true, sendParseError(ctx, reply, err)
   359  		}
   360  		resp, err := server.RangeFormatting(ctx, &params)
   361  		return true, reply(ctx, resp, err)
   362  	case "textDocument/onTypeFormatting": // req
   363  		var params DocumentOnTypeFormattingParams
   364  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   365  			return true, sendParseError(ctx, reply, err)
   366  		}
   367  		resp, err := server.OnTypeFormatting(ctx, &params)
   368  		return true, reply(ctx, resp, err)
   369  	case "textDocument/rename": // req
   370  		var params RenameParams
   371  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   372  			return true, sendParseError(ctx, reply, err)
   373  		}
   374  		resp, err := server.Rename(ctx, &params)
   375  		return true, reply(ctx, resp, err)
   376  	case "textDocument/prepareRename": // req
   377  		var params PrepareRenameParams
   378  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   379  			return true, sendParseError(ctx, reply, err)
   380  		}
   381  		resp, err := server.PrepareRename(ctx, &params)
   382  		return true, reply(ctx, resp, err)
   383  	case "workspace/executeCommand": // req
   384  		var params ExecuteCommandParams
   385  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   386  			return true, sendParseError(ctx, reply, err)
   387  		}
   388  		resp, err := server.ExecuteCommand(ctx, &params)
   389  		return true, reply(ctx, resp, err)
   390  	case "textDocument/semanticTokens/full": // req
   391  		var params SemanticTokensParams
   392  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   393  			return true, sendParseError(ctx, reply, err)
   394  		}
   395  		resp, err := server.SemanticTokensFull(ctx, &params)
   396  		return true, reply(ctx, resp, err)
   397  	case "textDocument/semanticTokens/full/delta": // req
   398  		var params SemanticTokensDeltaParams
   399  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   400  			return true, sendParseError(ctx, reply, err)
   401  		}
   402  		resp, err := server.SemanticTokensFullDelta(ctx, &params)
   403  		return true, reply(ctx, resp, err)
   404  	case "textDocument/semanticTokens/range": // req
   405  		var params SemanticTokensRangeParams
   406  		if err := json.Unmarshal(r.Params(), &params); err != nil {
   407  			return true, sendParseError(ctx, reply, err)
   408  		}
   409  		resp, err := server.SemanticTokensRange(ctx, &params)
   410  		return true, reply(ctx, resp, err)
   411  
   412  	default:
   413  		return false, nil
   414  	}
   415  }
   416  
   417  func (s *serverDispatcher) DidChangeWorkspaceFolders(ctx context.Context, params *DidChangeWorkspaceFoldersParams) error {
   418  	return s.Conn.Notify(ctx, "workspace/didChangeWorkspaceFolders", params)
   419  }
   420  
   421  func (s *serverDispatcher) WorkDoneProgressCancel(ctx context.Context, params *WorkDoneProgressCancelParams) error {
   422  	return s.Conn.Notify(ctx, "window/workDoneProgress/cancel", params)
   423  }
   424  
   425  func (s *serverDispatcher) Initialized(ctx context.Context, params *InitializedParams) error {
   426  	return s.Conn.Notify(ctx, "initialized", params)
   427  }
   428  
   429  func (s *serverDispatcher) Exit(ctx context.Context) error {
   430  	return s.Conn.Notify(ctx, "exit", nil)
   431  }
   432  
   433  func (s *serverDispatcher) DidChangeConfiguration(ctx context.Context, params *DidChangeConfigurationParams) error {
   434  	return s.Conn.Notify(ctx, "workspace/didChangeConfiguration", params)
   435  }
   436  
   437  func (s *serverDispatcher) DidOpen(ctx context.Context, params *DidOpenTextDocumentParams) error {
   438  	return s.Conn.Notify(ctx, "textDocument/didOpen", params)
   439  }
   440  
   441  func (s *serverDispatcher) DidChange(ctx context.Context, params *DidChangeTextDocumentParams) error {
   442  	return s.Conn.Notify(ctx, "textDocument/didChange", params)
   443  }
   444  
   445  func (s *serverDispatcher) DidClose(ctx context.Context, params *DidCloseTextDocumentParams) error {
   446  	return s.Conn.Notify(ctx, "textDocument/didClose", params)
   447  }
   448  
   449  func (s *serverDispatcher) DidSave(ctx context.Context, params *DidSaveTextDocumentParams) error {
   450  	return s.Conn.Notify(ctx, "textDocument/didSave", params)
   451  }
   452  
   453  func (s *serverDispatcher) WillSave(ctx context.Context, params *WillSaveTextDocumentParams) error {
   454  	return s.Conn.Notify(ctx, "textDocument/willSave", params)
   455  }
   456  
   457  func (s *serverDispatcher) DidChangeWatchedFiles(ctx context.Context, params *DidChangeWatchedFilesParams) error {
   458  	return s.Conn.Notify(ctx, "workspace/didChangeWatchedFiles", params)
   459  }
   460  
   461  func (s *serverDispatcher) SetTrace(ctx context.Context, params *SetTraceParams) error {
   462  	return s.Conn.Notify(ctx, "$/setTrace", params)
   463  }
   464  
   465  func (s *serverDispatcher) LogTrace(ctx context.Context, params *LogTraceParams) error {
   466  	return s.Conn.Notify(ctx, "$/logTrace", params)
   467  }
   468  func (s *serverDispatcher) Implementation(ctx context.Context, params *ImplementationParams) (Definition /*Definition | DefinitionLink[] | null*/, error) {
   469  	var result Definition /*Definition | DefinitionLink[] | null*/
   470  	if err := Call(ctx, s.Conn, "textDocument/implementation", params, &result); err != nil {
   471  		return nil, err
   472  	}
   473  	return result, nil
   474  }
   475  
   476  func (s *serverDispatcher) TypeDefinition(ctx context.Context, params *TypeDefinitionParams) (Definition /*Definition | DefinitionLink[] | null*/, error) {
   477  	var result Definition /*Definition | DefinitionLink[] | null*/
   478  	if err := Call(ctx, s.Conn, "textDocument/typeDefinition", params, &result); err != nil {
   479  		return nil, err
   480  	}
   481  	return result, nil
   482  }
   483  
   484  func (s *serverDispatcher) DocumentColor(ctx context.Context, params *DocumentColorParams) ([]ColorInformation, error) {
   485  	var result []ColorInformation
   486  	if err := Call(ctx, s.Conn, "textDocument/documentColor", params, &result); err != nil {
   487  		return nil, err
   488  	}
   489  	return result, nil
   490  }
   491  
   492  func (s *serverDispatcher) ColorPresentation(ctx context.Context, params *ColorPresentationParams) ([]ColorPresentation, error) {
   493  	var result []ColorPresentation
   494  	if err := Call(ctx, s.Conn, "textDocument/colorPresentation", params, &result); err != nil {
   495  		return nil, err
   496  	}
   497  	return result, nil
   498  }
   499  
   500  func (s *serverDispatcher) FoldingRange(ctx context.Context, params *FoldingRangeParams) ([]FoldingRange /*FoldingRange[] | null*/, error) {
   501  	var result []FoldingRange /*FoldingRange[] | null*/
   502  	if err := Call(ctx, s.Conn, "textDocument/foldingRange", params, &result); err != nil {
   503  		return nil, err
   504  	}
   505  	return result, nil
   506  }
   507  
   508  func (s *serverDispatcher) Declaration(ctx context.Context, params *DeclarationParams) (Declaration /*Declaration | DeclarationLink[] | null*/, error) {
   509  	var result Declaration /*Declaration | DeclarationLink[] | null*/
   510  	if err := Call(ctx, s.Conn, "textDocument/declaration", params, &result); err != nil {
   511  		return nil, err
   512  	}
   513  	return result, nil
   514  }
   515  
   516  func (s *serverDispatcher) SelectionRange(ctx context.Context, params *SelectionRangeParams) ([]SelectionRange /*SelectionRange[] | null*/, error) {
   517  	var result []SelectionRange /*SelectionRange[] | null*/
   518  	if err := Call(ctx, s.Conn, "textDocument/selectionRange", params, &result); err != nil {
   519  		return nil, err
   520  	}
   521  	return result, nil
   522  }
   523  
   524  func (s *serverDispatcher) PrepareCallHierarchy(ctx context.Context, params *CallHierarchyPrepareParams) ([]CallHierarchyItem /*CallHierarchyItem[] | null*/, error) {
   525  	var result []CallHierarchyItem /*CallHierarchyItem[] | null*/
   526  	if err := Call(ctx, s.Conn, "textDocument/prepareCallHierarchy", params, &result); err != nil {
   527  		return nil, err
   528  	}
   529  	return result, nil
   530  }
   531  
   532  func (s *serverDispatcher) IncomingCalls(ctx context.Context, params *CallHierarchyIncomingCallsParams) ([]CallHierarchyIncomingCall /*CallHierarchyIncomingCall[] | null*/, error) {
   533  	var result []CallHierarchyIncomingCall /*CallHierarchyIncomingCall[] | null*/
   534  	if err := Call(ctx, s.Conn, "callHierarchy/incomingCalls", params, &result); err != nil {
   535  		return nil, err
   536  	}
   537  	return result, nil
   538  }
   539  
   540  func (s *serverDispatcher) OutgoingCalls(ctx context.Context, params *CallHierarchyOutgoingCallsParams) ([]CallHierarchyOutgoingCall /*CallHierarchyOutgoingCall[] | null*/, error) {
   541  	var result []CallHierarchyOutgoingCall /*CallHierarchyOutgoingCall[] | null*/
   542  	if err := Call(ctx, s.Conn, "callHierarchy/outgoingCalls", params, &result); err != nil {
   543  		return nil, err
   544  	}
   545  	return result, nil
   546  }
   547  
   548  func (s *serverDispatcher) Initialize(ctx context.Context, params *ParamInitialize) (*InitializeResult, error) {
   549  	var result *InitializeResult
   550  	if err := Call(ctx, s.Conn, "initialize", params, &result); err != nil {
   551  		return nil, err
   552  	}
   553  	return result, nil
   554  }
   555  
   556  func (s *serverDispatcher) Shutdown(ctx context.Context) error {
   557  	return Call(ctx, s.Conn, "shutdown", nil, nil)
   558  }
   559  
   560  func (s *serverDispatcher) WillSaveWaitUntil(ctx context.Context, params *WillSaveTextDocumentParams) ([]TextEdit /*TextEdit[] | null*/, error) {
   561  	var result []TextEdit /*TextEdit[] | null*/
   562  	if err := Call(ctx, s.Conn, "textDocument/willSaveWaitUntil", params, &result); err != nil {
   563  		return nil, err
   564  	}
   565  	return result, nil
   566  }
   567  
   568  func (s *serverDispatcher) Completion(ctx context.Context, params *CompletionParams) (*CompletionList /*CompletionItem[] | CompletionList | null*/, error) {
   569  	var result *CompletionList /*CompletionItem[] | CompletionList | null*/
   570  	if err := Call(ctx, s.Conn, "textDocument/completion", params, &result); err != nil {
   571  		return nil, err
   572  	}
   573  	return result, nil
   574  }
   575  
   576  func (s *serverDispatcher) Resolve(ctx context.Context, params *CompletionItem) (*CompletionItem, error) {
   577  	var result *CompletionItem
   578  	if err := Call(ctx, s.Conn, "completionItem/resolve", params, &result); err != nil {
   579  		return nil, err
   580  	}
   581  	return result, nil
   582  }
   583  
   584  func (s *serverDispatcher) Hover(ctx context.Context, params *HoverParams) (*Hover /*Hover | null*/, error) {
   585  	var result *Hover /*Hover | null*/
   586  	if err := Call(ctx, s.Conn, "textDocument/hover", params, &result); err != nil {
   587  		return nil, err
   588  	}
   589  	return result, nil
   590  }
   591  
   592  func (s *serverDispatcher) SignatureHelp(ctx context.Context, params *SignatureHelpParams) (*SignatureHelp /*SignatureHelp | null*/, error) {
   593  	var result *SignatureHelp /*SignatureHelp | null*/
   594  	if err := Call(ctx, s.Conn, "textDocument/signatureHelp", params, &result); err != nil {
   595  		return nil, err
   596  	}
   597  	return result, nil
   598  }
   599  
   600  func (s *serverDispatcher) Definition(ctx context.Context, params *DefinitionParams) (Definition /*Definition | DefinitionLink[] | null*/, error) {
   601  	var result Definition /*Definition | DefinitionLink[] | null*/
   602  	if err := Call(ctx, s.Conn, "textDocument/definition", params, &result); err != nil {
   603  		return nil, err
   604  	}
   605  	return result, nil
   606  }
   607  
   608  func (s *serverDispatcher) References(ctx context.Context, params *ReferenceParams) ([]Location /*Location[] | null*/, error) {
   609  	var result []Location /*Location[] | null*/
   610  	if err := Call(ctx, s.Conn, "textDocument/references", params, &result); err != nil {
   611  		return nil, err
   612  	}
   613  	return result, nil
   614  }
   615  
   616  func (s *serverDispatcher) DocumentHighlight(ctx context.Context, params *DocumentHighlightParams) ([]DocumentHighlight /*DocumentHighlight[] | null*/, error) {
   617  	var result []DocumentHighlight /*DocumentHighlight[] | null*/
   618  	if err := Call(ctx, s.Conn, "textDocument/documentHighlight", params, &result); err != nil {
   619  		return nil, err
   620  	}
   621  	return result, nil
   622  }
   623  
   624  func (s *serverDispatcher) DocumentSymbol(ctx context.Context, params *DocumentSymbolParams) ([]interface{} /*SymbolInformation[] | DocumentSymbol[] | null*/, error) {
   625  	var result []interface{} /*SymbolInformation[] | DocumentSymbol[] | null*/
   626  	if err := Call(ctx, s.Conn, "textDocument/documentSymbol", params, &result); err != nil {
   627  		return nil, err
   628  	}
   629  	return result, nil
   630  }
   631  
   632  func (s *serverDispatcher) CodeAction(ctx context.Context, params *CodeActionParams) ([]CodeAction /*(Command | CodeAction)[] | null*/, error) {
   633  	var result []CodeAction /*(Command | CodeAction)[] | null*/
   634  	if err := Call(ctx, s.Conn, "textDocument/codeAction", params, &result); err != nil {
   635  		return nil, err
   636  	}
   637  	return result, nil
   638  }
   639  
   640  func (s *serverDispatcher) Symbol(ctx context.Context, params *WorkspaceSymbolParams) ([]SymbolInformation /*SymbolInformation[] | null*/, error) {
   641  	var result []SymbolInformation /*SymbolInformation[] | null*/
   642  	if err := Call(ctx, s.Conn, "workspace/symbol", params, &result); err != nil {
   643  		return nil, err
   644  	}
   645  	return result, nil
   646  }
   647  
   648  func (s *serverDispatcher) CodeLens(ctx context.Context, params *CodeLensParams) ([]CodeLens /*CodeLens[] | null*/, error) {
   649  	var result []CodeLens /*CodeLens[] | null*/
   650  	if err := Call(ctx, s.Conn, "textDocument/codeLens", params, &result); err != nil {
   651  		return nil, err
   652  	}
   653  	return result, nil
   654  }
   655  
   656  func (s *serverDispatcher) ResolveCodeLens(ctx context.Context, params *CodeLens) (*CodeLens, error) {
   657  	var result *CodeLens
   658  	if err := Call(ctx, s.Conn, "codeLens/resolve", params, &result); err != nil {
   659  		return nil, err
   660  	}
   661  	return result, nil
   662  }
   663  
   664  func (s *serverDispatcher) DocumentLink(ctx context.Context, params *DocumentLinkParams) ([]DocumentLink /*DocumentLink[] | null*/, error) {
   665  	var result []DocumentLink /*DocumentLink[] | null*/
   666  	if err := Call(ctx, s.Conn, "textDocument/documentLink", params, &result); err != nil {
   667  		return nil, err
   668  	}
   669  	return result, nil
   670  }
   671  
   672  func (s *serverDispatcher) ResolveDocumentLink(ctx context.Context, params *DocumentLink) (*DocumentLink, error) {
   673  	var result *DocumentLink
   674  	if err := Call(ctx, s.Conn, "documentLink/resolve", params, &result); err != nil {
   675  		return nil, err
   676  	}
   677  	return result, nil
   678  }
   679  
   680  func (s *serverDispatcher) Formatting(ctx context.Context, params *DocumentFormattingParams) ([]TextEdit /*TextEdit[] | null*/, error) {
   681  	var result []TextEdit /*TextEdit[] | null*/
   682  	if err := Call(ctx, s.Conn, "textDocument/formatting", params, &result); err != nil {
   683  		return nil, err
   684  	}
   685  	return result, nil
   686  }
   687  
   688  func (s *serverDispatcher) RangeFormatting(ctx context.Context, params *DocumentRangeFormattingParams) ([]TextEdit /*TextEdit[] | null*/, error) {
   689  	var result []TextEdit /*TextEdit[] | null*/
   690  	if err := Call(ctx, s.Conn, "textDocument/rangeFormatting", params, &result); err != nil {
   691  		return nil, err
   692  	}
   693  	return result, nil
   694  }
   695  
   696  func (s *serverDispatcher) OnTypeFormatting(ctx context.Context, params *DocumentOnTypeFormattingParams) ([]TextEdit /*TextEdit[] | null*/, error) {
   697  	var result []TextEdit /*TextEdit[] | null*/
   698  	if err := Call(ctx, s.Conn, "textDocument/onTypeFormatting", params, &result); err != nil {
   699  		return nil, err
   700  	}
   701  	return result, nil
   702  }
   703  
   704  func (s *serverDispatcher) Rename(ctx context.Context, params *RenameParams) (*WorkspaceEdit /*WorkspaceEdit | null*/, error) {
   705  	var result *WorkspaceEdit /*WorkspaceEdit | null*/
   706  	if err := Call(ctx, s.Conn, "textDocument/rename", params, &result); err != nil {
   707  		return nil, err
   708  	}
   709  	return result, nil
   710  }
   711  
   712  func (s *serverDispatcher) PrepareRename(ctx context.Context, params *PrepareRenameParams) (*Range /*Range | { range: Range, placeholder: string } | null*/, error) {
   713  	var result *Range /*Range | { range: Range, placeholder: string } | null*/
   714  	if err := Call(ctx, s.Conn, "textDocument/prepareRename", params, &result); err != nil {
   715  		return nil, err
   716  	}
   717  	return result, nil
   718  }
   719  
   720  func (s *serverDispatcher) ExecuteCommand(ctx context.Context, params *ExecuteCommandParams) (interface{} /*any | null*/, error) {
   721  	var result interface{} /*any | null*/
   722  	if err := Call(ctx, s.Conn, "workspace/executeCommand", params, &result); err != nil {
   723  		return nil, err
   724  	}
   725  	return result, nil
   726  }
   727  
   728  func (s *serverDispatcher) SemanticTokensFull(ctx context.Context, params *SemanticTokensParams) (*SemanticTokens /*SemanticTokens | null*/, error) {
   729  	var result *SemanticTokens /*SemanticTokens | null*/
   730  	if err := Call(ctx, s.Conn, "textDocument/semanticTokens/full", params, &result); err != nil {
   731  		return nil, err
   732  	}
   733  	return result, nil
   734  }
   735  
   736  func (s *serverDispatcher) SemanticTokensFullDelta(ctx context.Context, params *SemanticTokensDeltaParams) (interface{} /* SemanticTokens | SemanticTokensDelta | nil*/, error) {
   737  	var result interface{} /* SemanticTokens | SemanticTokensDelta | nil*/
   738  	if err := Call(ctx, s.Conn, "textDocument/semanticTokens/full/delta", params, &result); err != nil {
   739  		return nil, err
   740  	}
   741  	return result, nil
   742  }
   743  
   744  func (s *serverDispatcher) SemanticTokensRange(ctx context.Context, params *SemanticTokensRangeParams) (*SemanticTokens /*SemanticTokens | null*/, error) {
   745  	var result *SemanticTokens /*SemanticTokens | null*/
   746  	if err := Call(ctx, s.Conn, "textDocument/semanticTokens/range", params, &result); err != nil {
   747  		return nil, err
   748  	}
   749  	return result, nil
   750  }
   751  
   752  func (s *serverDispatcher) NonstandardRequest(ctx context.Context, method string, params interface{}) (interface{}, error) {
   753  	var result interface{}
   754  	if err := Call(ctx, s.Conn, method, params, &result); err != nil {
   755  		return nil, err
   756  	}
   757  	return result, nil
   758  }