in internal/lsp/protocol/tsserver.go [98:601]
func serverDispatch(ctx context.Context, server Server, reply jsonrpc2.Replier, r jsonrpc2.Request) (bool, error) {
switch r.Method() {
case "workspace/didChangeWorkspaceFolders": // notif
var params DidChangeWorkspaceFoldersParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
err := server.DidChangeWorkspaceFolders(ctx, ¶ms)
return true, reply(ctx, nil, err)
case "window/workDoneProgress/cancel": // notif
var params WorkDoneProgressCancelParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
err := server.WorkDoneProgressCancel(ctx, ¶ms)
return true, reply(ctx, nil, err)
case "workspace/didCreateFiles": // notif
var params CreateFilesParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
err := server.DidCreateFiles(ctx, ¶ms)
return true, reply(ctx, nil, err)
case "workspace/didRenameFiles": // notif
var params RenameFilesParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
err := server.DidRenameFiles(ctx, ¶ms)
return true, reply(ctx, nil, err)
case "workspace/didDeleteFiles": // notif
var params DeleteFilesParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
err := server.DidDeleteFiles(ctx, ¶ms)
return true, reply(ctx, nil, err)
case "initialized": // notif
var params InitializedParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
err := server.Initialized(ctx, ¶ms)
return true, reply(ctx, nil, err)
case "exit": // notif
err := server.Exit(ctx)
return true, reply(ctx, nil, err)
case "workspace/didChangeConfiguration": // notif
var params DidChangeConfigurationParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
err := server.DidChangeConfiguration(ctx, ¶ms)
return true, reply(ctx, nil, err)
case "textDocument/didOpen": // notif
var params DidOpenTextDocumentParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
err := server.DidOpen(ctx, ¶ms)
return true, reply(ctx, nil, err)
case "textDocument/didChange": // notif
var params DidChangeTextDocumentParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
err := server.DidChange(ctx, ¶ms)
return true, reply(ctx, nil, err)
case "textDocument/didClose": // notif
var params DidCloseTextDocumentParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
err := server.DidClose(ctx, ¶ms)
return true, reply(ctx, nil, err)
case "textDocument/didSave": // notif
var params DidSaveTextDocumentParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
err := server.DidSave(ctx, ¶ms)
return true, reply(ctx, nil, err)
case "textDocument/willSave": // notif
var params WillSaveTextDocumentParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
err := server.WillSave(ctx, ¶ms)
return true, reply(ctx, nil, err)
case "workspace/didChangeWatchedFiles": // notif
var params DidChangeWatchedFilesParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
err := server.DidChangeWatchedFiles(ctx, ¶ms)
return true, reply(ctx, nil, err)
case "notebookDocument/didOpen": // notif
var params DidOpenNotebookDocumentParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
err := server.DidOpenNotebookDocument(ctx, ¶ms)
return true, reply(ctx, nil, err)
case "notebookDocument/didChange": // notif
var params DidChangeNotebookDocumentParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
err := server.DidChangeNotebookDocument(ctx, ¶ms)
return true, reply(ctx, nil, err)
case "notebookDocument/didClose": // notif
var params DidCloseNotebookDocumentParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
err := server.DidCloseNotebookDocument(ctx, ¶ms)
return true, reply(ctx, nil, err)
case "$/setTrace": // notif
var params SetTraceParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
err := server.SetTrace(ctx, ¶ms)
return true, reply(ctx, nil, err)
case "$/logTrace": // notif
var params LogTraceParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
err := server.LogTrace(ctx, ¶ms)
return true, reply(ctx, nil, err)
case "textDocument/implementation": // req
var params ImplementationParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.Implementation(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "textDocument/typeDefinition": // req
var params TypeDefinitionParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.TypeDefinition(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "textDocument/documentColor": // req
var params DocumentColorParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.DocumentColor(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "textDocument/colorPresentation": // req
var params ColorPresentationParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.ColorPresentation(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "textDocument/foldingRange": // req
var params FoldingRangeParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.FoldingRange(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "textDocument/declaration": // req
var params DeclarationParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.Declaration(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "textDocument/selectionRange": // req
var params SelectionRangeParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.SelectionRange(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "textDocument/prepareCallHierarchy": // req
var params CallHierarchyPrepareParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.PrepareCallHierarchy(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "callHierarchy/incomingCalls": // req
var params CallHierarchyIncomingCallsParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.IncomingCalls(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "callHierarchy/outgoingCalls": // req
var params CallHierarchyOutgoingCallsParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.OutgoingCalls(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "textDocument/semanticTokens/full": // req
var params SemanticTokensParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.SemanticTokensFull(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "textDocument/semanticTokens/full/delta": // req
var params SemanticTokensDeltaParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.SemanticTokensFullDelta(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "textDocument/semanticTokens/range": // req
var params SemanticTokensRangeParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.SemanticTokensRange(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "workspace/semanticTokens/refresh": // req
if len(r.Params()) > 0 {
return true, reply(ctx, nil, errors.Errorf("%w: expected no params", jsonrpc2.ErrInvalidParams))
}
err := server.SemanticTokensRefresh(ctx)
return true, reply(ctx, nil, err)
case "textDocument/linkedEditingRange": // req
var params LinkedEditingRangeParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.LinkedEditingRange(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "workspace/willCreateFiles": // req
var params CreateFilesParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.WillCreateFiles(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "workspace/willRenameFiles": // req
var params RenameFilesParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.WillRenameFiles(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "workspace/willDeleteFiles": // req
var params DeleteFilesParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.WillDeleteFiles(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "textDocument/moniker": // req
var params MonikerParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.Moniker(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "textDocument/prepareTypeHierarchy": // req
var params TypeHierarchyPrepareParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.PrepareTypeHierarchy(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "typeHierarchy/supertypes": // req
var params TypeHierarchySupertypesParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.Supertypes(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "typeHierarchy/subtypes": // req
var params TypeHierarchySubtypesParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.Subtypes(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "textDocument/inlineValues": // req
var params InlineValuesParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.InlineValues(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "workspace/inlineValues/refresh": // req
if len(r.Params()) > 0 {
return true, reply(ctx, nil, errors.Errorf("%w: expected no params", jsonrpc2.ErrInvalidParams))
}
err := server.InlineValuesRefresh(ctx)
return true, reply(ctx, nil, err)
case "initialize": // req
var params ParamInitialize
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
if _, ok := err.(*json.UnmarshalTypeError); !ok {
return true, sendParseError(ctx, reply, err)
}
}
resp, err := server.Initialize(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "shutdown": // req
if len(r.Params()) > 0 {
return true, reply(ctx, nil, errors.Errorf("%w: expected no params", jsonrpc2.ErrInvalidParams))
}
err := server.Shutdown(ctx)
return true, reply(ctx, nil, err)
case "textDocument/willSaveWaitUntil": // req
var params WillSaveTextDocumentParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.WillSaveWaitUntil(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "textDocument/completion": // req
var params CompletionParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.Completion(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "completionItem/resolve": // req
var params CompletionItem
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.Resolve(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "textDocument/hover": // req
var params HoverParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.Hover(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "textDocument/signatureHelp": // req
var params SignatureHelpParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.SignatureHelp(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "textDocument/definition": // req
var params DefinitionParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.Definition(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "textDocument/references": // req
var params ReferenceParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.References(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "textDocument/documentHighlight": // req
var params DocumentHighlightParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.DocumentHighlight(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "textDocument/documentSymbol": // req
var params DocumentSymbolParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.DocumentSymbol(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "textDocument/codeAction": // req
var params CodeActionParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.CodeAction(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "codeAction/resolve": // req
var params CodeAction
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.ResolveCodeAction(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "workspace/symbol": // req
var params WorkspaceSymbolParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.Symbol(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "workspaceSymbol/resolve": // req
var params WorkspaceSymbol
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.ResolveWorkspaceSymbol(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "textDocument/codeLens": // req
var params CodeLensParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.CodeLens(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "codeLens/resolve": // req
var params CodeLens
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.ResolveCodeLens(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "workspace/codeLens/refresh": // req
if len(r.Params()) > 0 {
return true, reply(ctx, nil, errors.Errorf("%w: expected no params", jsonrpc2.ErrInvalidParams))
}
err := server.CodeLensRefresh(ctx)
return true, reply(ctx, nil, err)
case "textDocument/documentLink": // req
var params DocumentLinkParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.DocumentLink(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "documentLink/resolve": // req
var params DocumentLink
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.ResolveDocumentLink(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "textDocument/formatting": // req
var params DocumentFormattingParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.Formatting(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "textDocument/rangeFormatting": // req
var params DocumentRangeFormattingParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.RangeFormatting(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "textDocument/onTypeFormatting": // req
var params DocumentOnTypeFormattingParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.OnTypeFormatting(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "textDocument/rename": // req
var params RenameParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.Rename(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "textDocument/prepareRename": // req
var params PrepareRenameParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.PrepareRename(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "workspace/executeCommand": // req
var params ExecuteCommandParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.ExecuteCommand(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "textDocument/diagnostic": // req
var params string
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.Diagnostic(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "workspace/diagnostic": // req
var params WorkspaceDiagnosticParams
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
return true, sendParseError(ctx, reply, err)
}
resp, err := server.DiagnosticWorkspace(ctx, ¶ms)
return true, reply(ctx, resp, err)
case "workspace/diagnostic/refresh": // req
if len(r.Params()) > 0 {
return true, reply(ctx, nil, errors.Errorf("%w: expected no params", jsonrpc2.ErrInvalidParams))
}
err := server.DiagnosticRefresh(ctx)
return true, reply(ctx, nil, err)
default:
return false, nil
}
}