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