2018-09-24 15:24:58 -06:00
|
|
|
package protocol
|
|
|
|
|
2019-11-17 12:29:15 -07:00
|
|
|
// Package protocol contains data types and code for LSP jsonrpcs
|
|
|
|
// generated automatically from vscode-languageserver-node
|
2020-03-09 10:51:18 -06:00
|
|
|
// commit: 151b520c995ee3d76729b5c46258ab273d989726
|
2020-03-30 15:09:42 -06:00
|
|
|
// last fetched Mon Mar 30 2020 21:01:17 GMT-0400 (Eastern Daylight Time)
|
2019-11-17 12:29:15 -07:00
|
|
|
|
2019-05-13 10:27:26 -06:00
|
|
|
// Code generated (see typescript/README.md) DO NOT EDIT.
|
2019-04-23 08:05:23 -06:00
|
|
|
|
2018-09-24 15:24:58 -06:00
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"encoding/json"
|
2020-04-09 20:37:52 -06:00
|
|
|
"fmt"
|
2018-09-24 15:24:58 -06:00
|
|
|
|
|
|
|
"golang.org/x/tools/internal/jsonrpc2"
|
2019-10-11 14:08:39 -06:00
|
|
|
"golang.org/x/tools/internal/xcontext"
|
2018-09-24 15:24:58 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
type Server interface {
|
2019-04-23 08:05:23 -06:00
|
|
|
DidChangeWorkspaceFolders(context.Context, *DidChangeWorkspaceFoldersParams) error
|
2020-01-27 06:23:25 -07:00
|
|
|
WorkDoneProgressCancel(context.Context, *WorkDoneProgressCancelParams) error
|
2018-09-24 15:24:58 -06:00
|
|
|
Initialized(context.Context, *InitializedParams) error
|
|
|
|
Exit(context.Context) error
|
|
|
|
DidChangeConfiguration(context.Context, *DidChangeConfigurationParams) error
|
|
|
|
DidOpen(context.Context, *DidOpenTextDocumentParams) error
|
|
|
|
DidChange(context.Context, *DidChangeTextDocumentParams) error
|
2019-04-23 08:05:23 -06:00
|
|
|
DidClose(context.Context, *DidCloseTextDocumentParams) error
|
|
|
|
DidSave(context.Context, *DidSaveTextDocumentParams) error
|
2018-09-24 15:24:58 -06:00
|
|
|
WillSave(context.Context, *WillSaveTextDocumentParams) error
|
2019-04-23 08:05:23 -06:00
|
|
|
DidChangeWatchedFiles(context.Context, *DidChangeWatchedFilesParams) error
|
|
|
|
SetTraceNotification(context.Context, *SetTraceParams) error
|
|
|
|
LogTraceNotification(context.Context, *LogTraceParams) error
|
2019-11-17 12:29:15 -07:00
|
|
|
Implementation(context.Context, *ImplementationParams) (Definition /*Definition | DefinitionLink[] | null*/, error)
|
|
|
|
TypeDefinition(context.Context, *TypeDefinitionParams) (Definition /*Definition | DefinitionLink[] | null*/, error)
|
2019-04-23 08:05:23 -06:00
|
|
|
DocumentColor(context.Context, *DocumentColorParams) ([]ColorInformation, error)
|
|
|
|
ColorPresentation(context.Context, *ColorPresentationParams) ([]ColorPresentation, error)
|
2019-11-17 12:29:15 -07:00
|
|
|
FoldingRange(context.Context, *FoldingRangeParams) ([]FoldingRange /*FoldingRange[] | null*/, error)
|
|
|
|
Declaration(context.Context, *DeclarationParams) (Declaration /*Declaration | DeclarationLink[] | null*/, error)
|
|
|
|
SelectionRange(context.Context, *SelectionRangeParams) ([]SelectionRange /*SelectionRange[] | null*/, error)
|
|
|
|
Initialize(context.Context, *ParamInitialize) (*InitializeResult, error)
|
2019-04-23 08:05:23 -06:00
|
|
|
Shutdown(context.Context) error
|
2019-11-17 12:29:15 -07:00
|
|
|
WillSaveWaitUntil(context.Context, *WillSaveTextDocumentParams) ([]TextEdit /*TextEdit[] | null*/, error)
|
|
|
|
Completion(context.Context, *CompletionParams) (*CompletionList /*CompletionItem[] | CompletionList | null*/, error)
|
2019-04-23 08:05:23 -06:00
|
|
|
Resolve(context.Context, *CompletionItem) (*CompletionItem, error)
|
2019-11-17 12:29:15 -07:00
|
|
|
Hover(context.Context, *HoverParams) (*Hover /*Hover | null*/, error)
|
|
|
|
SignatureHelp(context.Context, *SignatureHelpParams) (*SignatureHelp /*SignatureHelp | null*/, error)
|
|
|
|
Definition(context.Context, *DefinitionParams) (Definition /*Definition | DefinitionLink[] | null*/, error)
|
|
|
|
References(context.Context, *ReferenceParams) ([]Location /*Location[] | null*/, error)
|
|
|
|
DocumentHighlight(context.Context, *DocumentHighlightParams) ([]DocumentHighlight /*DocumentHighlight[] | null*/, error)
|
2020-03-02 15:18:50 -07:00
|
|
|
DocumentSymbol(context.Context, *DocumentSymbolParams) ([]interface{} /*SymbolInformation[] | DocumentSymbol[] | null*/, error)
|
2019-11-19 06:42:45 -07:00
|
|
|
CodeAction(context.Context, *CodeActionParams) ([]CodeAction /*(Command | CodeAction)[] | null*/, error)
|
2019-11-17 12:29:15 -07:00
|
|
|
Symbol(context.Context, *WorkspaceSymbolParams) ([]SymbolInformation /*SymbolInformation[] | null*/, error)
|
|
|
|
CodeLens(context.Context, *CodeLensParams) ([]CodeLens /*CodeLens[] | null*/, error)
|
2019-04-23 08:05:23 -06:00
|
|
|
ResolveCodeLens(context.Context, *CodeLens) (*CodeLens, error)
|
2019-11-17 12:29:15 -07:00
|
|
|
DocumentLink(context.Context, *DocumentLinkParams) ([]DocumentLink /*DocumentLink[] | null*/, error)
|
2019-10-11 14:08:39 -06:00
|
|
|
ResolveDocumentLink(context.Context, *DocumentLink) (*DocumentLink, error)
|
2019-11-17 12:29:15 -07:00
|
|
|
Formatting(context.Context, *DocumentFormattingParams) ([]TextEdit /*TextEdit[] | null*/, error)
|
|
|
|
RangeFormatting(context.Context, *DocumentRangeFormattingParams) ([]TextEdit /*TextEdit[] | null*/, error)
|
|
|
|
OnTypeFormatting(context.Context, *DocumentOnTypeFormattingParams) ([]TextEdit /*TextEdit[] | null*/, error)
|
|
|
|
Rename(context.Context, *RenameParams) (*WorkspaceEdit /*WorkspaceEdit | null*/, error)
|
2020-02-11 08:22:19 -07:00
|
|
|
PrepareRename(context.Context, *PrepareRenameParams) (*Range /*Range | { range: Range, placeholder: string } | null*/, error)
|
2019-11-17 12:29:15 -07:00
|
|
|
ExecuteCommand(context.Context, *ExecuteCommandParams) (interface{} /*any | null*/, error)
|
2020-01-27 06:23:25 -07:00
|
|
|
PrepareCallHierarchy(context.Context, *CallHierarchyPrepareParams) ([]CallHierarchyItem /*CallHierarchyItem[] | null*/, error)
|
|
|
|
IncomingCalls(context.Context, *CallHierarchyIncomingCallsParams) ([]CallHierarchyIncomingCall /*CallHierarchyIncomingCall[] | null*/, error)
|
|
|
|
OutgoingCalls(context.Context, *CallHierarchyOutgoingCallsParams) ([]CallHierarchyOutgoingCall /*CallHierarchyOutgoingCall[] | null*/, error)
|
|
|
|
SemanticTokens(context.Context, *SemanticTokensParams) (*SemanticTokens /*SemanticTokens | null*/, error)
|
|
|
|
SemanticTokensEdits(context.Context, *SemanticTokensEditsParams) (interface{} /* SemanticTokens | SemanticTokensEdits | nil*/, error)
|
|
|
|
SemanticTokensRange(context.Context, *SemanticTokensRangeParams) (*SemanticTokens /*SemanticTokens | null*/, error)
|
2020-01-10 15:35:46 -07:00
|
|
|
NonstandardRequest(ctx context.Context, method string, params interface{}) (interface{}, error)
|
2018-09-24 15:24:58 -06:00
|
|
|
}
|
|
|
|
|
2020-03-30 15:09:42 -06:00
|
|
|
func ServerHandler(server Server, handler jsonrpc2.Handler) jsonrpc2.Handler {
|
2020-04-12 20:47:10 -06:00
|
|
|
return func(ctx context.Context, reply jsonrpc2.Replier, r jsonrpc2.Request) error {
|
2020-03-30 15:09:42 -06:00
|
|
|
if ctx.Err() != nil {
|
|
|
|
ctx := xcontext.Detach(ctx)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, nil, RequestCancelledError)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
2020-04-12 20:47:10 -06:00
|
|
|
switch r.Method() {
|
2020-03-30 15:09:42 -06:00
|
|
|
case "workspace/didChangeWorkspaceFolders": // notif
|
|
|
|
var params DidChangeWorkspaceFoldersParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
2020-04-01 07:35:06 -06:00
|
|
|
err := server.DidChangeWorkspaceFolders(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, nil, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "window/workDoneProgress/cancel": // notif
|
|
|
|
var params WorkDoneProgressCancelParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
2020-04-01 07:35:06 -06:00
|
|
|
err := server.WorkDoneProgressCancel(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, nil, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "initialized": // notif
|
|
|
|
var params InitializedParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
2020-04-01 07:35:06 -06:00
|
|
|
err := server.Initialized(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, nil, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "exit": // notif
|
2020-04-30 13:59:37 -06:00
|
|
|
err := server.Exit(ctx)
|
|
|
|
return reply(ctx, nil, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "workspace/didChangeConfiguration": // notif
|
|
|
|
var params DidChangeConfigurationParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
2020-04-01 07:35:06 -06:00
|
|
|
err := server.DidChangeConfiguration(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, nil, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "textDocument/didOpen": // notif
|
|
|
|
var params DidOpenTextDocumentParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
2020-04-01 07:35:06 -06:00
|
|
|
err := server.DidOpen(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, nil, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "textDocument/didChange": // notif
|
|
|
|
var params DidChangeTextDocumentParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
2020-04-01 07:35:06 -06:00
|
|
|
err := server.DidChange(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, nil, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "textDocument/didClose": // notif
|
|
|
|
var params DidCloseTextDocumentParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
2020-04-01 07:35:06 -06:00
|
|
|
err := server.DidClose(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, nil, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "textDocument/didSave": // notif
|
|
|
|
var params DidSaveTextDocumentParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
2020-04-01 07:35:06 -06:00
|
|
|
err := server.DidSave(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, nil, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "textDocument/willSave": // notif
|
|
|
|
var params WillSaveTextDocumentParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
2020-04-01 07:35:06 -06:00
|
|
|
err := server.WillSave(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, nil, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "workspace/didChangeWatchedFiles": // notif
|
|
|
|
var params DidChangeWatchedFilesParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
2020-04-01 07:35:06 -06:00
|
|
|
err := server.DidChangeWatchedFiles(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, nil, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "$/setTraceNotification": // notif
|
|
|
|
var params SetTraceParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
2020-04-01 07:35:06 -06:00
|
|
|
err := server.SetTraceNotification(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, nil, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "$/logTraceNotification": // notif
|
|
|
|
var params LogTraceParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
2020-04-01 07:35:06 -06:00
|
|
|
err := server.LogTraceNotification(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, nil, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "textDocument/implementation": // req
|
|
|
|
var params ImplementationParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
resp, err := server.Implementation(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "textDocument/typeDefinition": // req
|
|
|
|
var params TypeDefinitionParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
resp, err := server.TypeDefinition(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "textDocument/documentColor": // req
|
|
|
|
var params DocumentColorParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
resp, err := server.DocumentColor(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "textDocument/colorPresentation": // req
|
|
|
|
var params ColorPresentationParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
resp, err := server.ColorPresentation(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "textDocument/foldingRange": // req
|
|
|
|
var params FoldingRangeParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
resp, err := server.FoldingRange(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "textDocument/declaration": // req
|
|
|
|
var params DeclarationParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
resp, err := server.Declaration(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "textDocument/selectionRange": // req
|
|
|
|
var params SelectionRangeParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
resp, err := server.SelectionRange(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "initialize": // req
|
|
|
|
var params ParamInitialize
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
resp, err := server.Initialize(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "shutdown": // req
|
2020-04-12 20:47:10 -06:00
|
|
|
if len(r.Params()) > 0 {
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, nil, fmt.Errorf("%w: expected no params", jsonrpc2.ErrInvalidParams))
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
err := server.Shutdown(ctx)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, nil, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "textDocument/willSaveWaitUntil": // req
|
|
|
|
var params WillSaveTextDocumentParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
resp, err := server.WillSaveWaitUntil(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "textDocument/completion": // req
|
|
|
|
var params CompletionParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
resp, err := server.Completion(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "completionItem/resolve": // req
|
|
|
|
var params CompletionItem
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
resp, err := server.Resolve(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "textDocument/hover": // req
|
|
|
|
var params HoverParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
resp, err := server.Hover(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "textDocument/signatureHelp": // req
|
|
|
|
var params SignatureHelpParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
resp, err := server.SignatureHelp(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "textDocument/definition": // req
|
|
|
|
var params DefinitionParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
resp, err := server.Definition(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "textDocument/references": // req
|
|
|
|
var params ReferenceParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
resp, err := server.References(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "textDocument/documentHighlight": // req
|
|
|
|
var params DocumentHighlightParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
resp, err := server.DocumentHighlight(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "textDocument/documentSymbol": // req
|
|
|
|
var params DocumentSymbolParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
resp, err := server.DocumentSymbol(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "textDocument/codeAction": // req
|
|
|
|
var params CodeActionParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
resp, err := server.CodeAction(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "workspace/symbol": // req
|
|
|
|
var params WorkspaceSymbolParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
resp, err := server.Symbol(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "textDocument/codeLens": // req
|
|
|
|
var params CodeLensParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
resp, err := server.CodeLens(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "codeLens/resolve": // req
|
|
|
|
var params CodeLens
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
resp, err := server.ResolveCodeLens(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "textDocument/documentLink": // req
|
|
|
|
var params DocumentLinkParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
resp, err := server.DocumentLink(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "documentLink/resolve": // req
|
|
|
|
var params DocumentLink
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
resp, err := server.ResolveDocumentLink(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "textDocument/formatting": // req
|
|
|
|
var params DocumentFormattingParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
resp, err := server.Formatting(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "textDocument/rangeFormatting": // req
|
|
|
|
var params DocumentRangeFormattingParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
resp, err := server.RangeFormatting(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "textDocument/onTypeFormatting": // req
|
|
|
|
var params DocumentOnTypeFormattingParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
resp, err := server.OnTypeFormatting(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "textDocument/rename": // req
|
|
|
|
var params RenameParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
resp, err := server.Rename(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "textDocument/prepareRename": // req
|
|
|
|
var params PrepareRenameParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
resp, err := server.PrepareRename(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "workspace/executeCommand": // req
|
|
|
|
var params ExecuteCommandParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
resp, err := server.ExecuteCommand(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "textDocument/prepareCallHierarchy": // req
|
|
|
|
var params CallHierarchyPrepareParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
resp, err := server.PrepareCallHierarchy(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "callHierarchy/incomingCalls": // req
|
|
|
|
var params CallHierarchyIncomingCallsParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
resp, err := server.IncomingCalls(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "callHierarchy/outgoingCalls": // req
|
|
|
|
var params CallHierarchyOutgoingCallsParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
resp, err := server.OutgoingCalls(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "textDocument/semanticTokens": // req
|
|
|
|
var params SemanticTokensParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
resp, err := server.SemanticTokens(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "textDocument/semanticTokens/edits": // req
|
|
|
|
var params SemanticTokensEditsParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
resp, err := server.SemanticTokensEdits(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
case "textDocument/semanticTokens/range": // req
|
|
|
|
var params SemanticTokensRangeParams
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
|
|
|
resp, err := server.SemanticTokensRange(ctx, ¶ms)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
default:
|
|
|
|
var params interface{}
|
2020-04-12 20:47:10 -06:00
|
|
|
if err := json.Unmarshal(r.Params(), ¶ms); err != nil {
|
|
|
|
return sendParseError(ctx, reply, err)
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
2020-04-12 20:47:10 -06:00
|
|
|
resp, err := server.NonstandardRequest(ctx, r.Method(), params)
|
2020-04-09 21:54:23 -06:00
|
|
|
return reply(ctx, resp, err)
|
2020-01-10 15:35:46 -07:00
|
|
|
|
2020-03-30 15:09:42 -06:00
|
|
|
}
|
2018-09-24 15:24:58 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
type serverDispatcher struct {
|
|
|
|
*jsonrpc2.Conn
|
|
|
|
}
|
|
|
|
|
2019-04-23 08:05:23 -06:00
|
|
|
func (s *serverDispatcher) DidChangeWorkspaceFolders(ctx context.Context, params *DidChangeWorkspaceFoldersParams) error {
|
|
|
|
return s.Conn.Notify(ctx, "workspace/didChangeWorkspaceFolders", params)
|
2018-09-24 15:24:58 -06:00
|
|
|
}
|
|
|
|
|
2020-01-27 06:23:25 -07:00
|
|
|
func (s *serverDispatcher) WorkDoneProgressCancel(ctx context.Context, params *WorkDoneProgressCancelParams) error {
|
|
|
|
return s.Conn.Notify(ctx, "window/workDoneProgress/cancel", params)
|
|
|
|
}
|
|
|
|
|
2018-09-24 15:24:58 -06:00
|
|
|
func (s *serverDispatcher) Initialized(ctx context.Context, params *InitializedParams) error {
|
|
|
|
return s.Conn.Notify(ctx, "initialized", params)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *serverDispatcher) Exit(ctx context.Context) error {
|
|
|
|
return s.Conn.Notify(ctx, "exit", nil)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *serverDispatcher) DidChangeConfiguration(ctx context.Context, params *DidChangeConfigurationParams) error {
|
|
|
|
return s.Conn.Notify(ctx, "workspace/didChangeConfiguration", params)
|
|
|
|
}
|
|
|
|
|
2019-04-23 08:05:23 -06:00
|
|
|
func (s *serverDispatcher) DidOpen(ctx context.Context, params *DidOpenTextDocumentParams) error {
|
|
|
|
return s.Conn.Notify(ctx, "textDocument/didOpen", params)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *serverDispatcher) DidChange(ctx context.Context, params *DidChangeTextDocumentParams) error {
|
|
|
|
return s.Conn.Notify(ctx, "textDocument/didChange", params)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *serverDispatcher) DidClose(ctx context.Context, params *DidCloseTextDocumentParams) error {
|
|
|
|
return s.Conn.Notify(ctx, "textDocument/didClose", params)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *serverDispatcher) DidSave(ctx context.Context, params *DidSaveTextDocumentParams) error {
|
|
|
|
return s.Conn.Notify(ctx, "textDocument/didSave", params)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *serverDispatcher) WillSave(ctx context.Context, params *WillSaveTextDocumentParams) error {
|
|
|
|
return s.Conn.Notify(ctx, "textDocument/willSave", params)
|
|
|
|
}
|
|
|
|
|
2018-09-24 15:24:58 -06:00
|
|
|
func (s *serverDispatcher) DidChangeWatchedFiles(ctx context.Context, params *DidChangeWatchedFilesParams) error {
|
|
|
|
return s.Conn.Notify(ctx, "workspace/didChangeWatchedFiles", params)
|
|
|
|
}
|
|
|
|
|
2019-04-23 08:05:23 -06:00
|
|
|
func (s *serverDispatcher) SetTraceNotification(ctx context.Context, params *SetTraceParams) error {
|
|
|
|
return s.Conn.Notify(ctx, "$/setTraceNotification", params)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *serverDispatcher) LogTraceNotification(ctx context.Context, params *LogTraceParams) error {
|
|
|
|
return s.Conn.Notify(ctx, "$/logTraceNotification", params)
|
|
|
|
}
|
2019-11-17 12:29:15 -07:00
|
|
|
func (s *serverDispatcher) Implementation(ctx context.Context, params *ImplementationParams) (Definition /*Definition | DefinitionLink[] | null*/, error) {
|
|
|
|
var result Definition /*Definition | DefinitionLink[] | null*/
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, "textDocument/implementation", params, &result); err != nil {
|
2018-09-24 15:24:58 -06:00
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return result, nil
|
|
|
|
}
|
|
|
|
|
2019-11-17 12:29:15 -07:00
|
|
|
func (s *serverDispatcher) TypeDefinition(ctx context.Context, params *TypeDefinitionParams) (Definition /*Definition | DefinitionLink[] | null*/, error) {
|
|
|
|
var result Definition /*Definition | DefinitionLink[] | null*/
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, "textDocument/typeDefinition", params, &result); err != nil {
|
2018-09-24 15:24:58 -06:00
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return result, nil
|
|
|
|
}
|
|
|
|
|
2019-04-23 08:05:23 -06:00
|
|
|
func (s *serverDispatcher) DocumentColor(ctx context.Context, params *DocumentColorParams) ([]ColorInformation, error) {
|
|
|
|
var result []ColorInformation
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, "textDocument/documentColor", params, &result); err != nil {
|
2019-04-23 08:05:23 -06:00
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return result, nil
|
2018-09-24 15:24:58 -06:00
|
|
|
}
|
|
|
|
|
2019-04-23 08:05:23 -06:00
|
|
|
func (s *serverDispatcher) ColorPresentation(ctx context.Context, params *ColorPresentationParams) ([]ColorPresentation, error) {
|
|
|
|
var result []ColorPresentation
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, "textDocument/colorPresentation", params, &result); err != nil {
|
2019-04-23 08:05:23 -06:00
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return result, nil
|
2018-09-24 15:24:58 -06:00
|
|
|
}
|
|
|
|
|
2019-11-17 12:29:15 -07:00
|
|
|
func (s *serverDispatcher) FoldingRange(ctx context.Context, params *FoldingRangeParams) ([]FoldingRange /*FoldingRange[] | null*/, error) {
|
|
|
|
var result []FoldingRange /*FoldingRange[] | null*/
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, "textDocument/foldingRange", params, &result); err != nil {
|
2019-04-23 08:05:23 -06:00
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return result, nil
|
2018-09-24 15:24:58 -06:00
|
|
|
}
|
|
|
|
|
2019-11-17 12:29:15 -07:00
|
|
|
func (s *serverDispatcher) Declaration(ctx context.Context, params *DeclarationParams) (Declaration /*Declaration | DeclarationLink[] | null*/, error) {
|
|
|
|
var result Declaration /*Declaration | DeclarationLink[] | null*/
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, "textDocument/declaration", params, &result); err != nil {
|
2018-09-24 15:24:58 -06:00
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return result, nil
|
|
|
|
}
|
|
|
|
|
2019-11-17 12:29:15 -07:00
|
|
|
func (s *serverDispatcher) SelectionRange(ctx context.Context, params *SelectionRangeParams) ([]SelectionRange /*SelectionRange[] | null*/, error) {
|
|
|
|
var result []SelectionRange /*SelectionRange[] | null*/
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, "textDocument/selectionRange", params, &result); err != nil {
|
2019-07-11 12:53:13 -06:00
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return result, nil
|
|
|
|
}
|
|
|
|
|
2019-11-17 12:29:15 -07:00
|
|
|
func (s *serverDispatcher) Initialize(ctx context.Context, params *ParamInitialize) (*InitializeResult, error) {
|
2020-03-04 11:29:23 -07:00
|
|
|
var result *InitializeResult
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, "initialize", params, &result); err != nil {
|
2019-04-23 08:05:23 -06:00
|
|
|
return nil, err
|
|
|
|
}
|
2020-03-04 11:29:23 -07:00
|
|
|
return result, nil
|
2019-04-23 08:05:23 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *serverDispatcher) Shutdown(ctx context.Context) error {
|
2020-04-07 19:35:47 -06:00
|
|
|
return Call(ctx, s.Conn, "shutdown", nil, nil)
|
2019-04-23 08:05:23 -06:00
|
|
|
}
|
|
|
|
|
2019-11-17 12:29:15 -07:00
|
|
|
func (s *serverDispatcher) WillSaveWaitUntil(ctx context.Context, params *WillSaveTextDocumentParams) ([]TextEdit /*TextEdit[] | null*/, error) {
|
|
|
|
var result []TextEdit /*TextEdit[] | null*/
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, "textDocument/willSaveWaitUntil", params, &result); err != nil {
|
2019-04-23 08:05:23 -06:00
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return result, nil
|
2018-09-24 15:24:58 -06:00
|
|
|
}
|
|
|
|
|
2019-11-17 12:29:15 -07:00
|
|
|
func (s *serverDispatcher) Completion(ctx context.Context, params *CompletionParams) (*CompletionList /*CompletionItem[] | CompletionList | null*/, error) {
|
2020-03-04 11:29:23 -07:00
|
|
|
var result *CompletionList /*CompletionItem[] | CompletionList | null*/
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, "textDocument/completion", params, &result); err != nil {
|
2018-09-24 15:24:58 -06:00
|
|
|
return nil, err
|
|
|
|
}
|
2020-03-04 11:29:23 -07:00
|
|
|
return result, nil
|
2018-09-24 15:24:58 -06:00
|
|
|
}
|
|
|
|
|
2019-04-23 08:05:23 -06:00
|
|
|
func (s *serverDispatcher) Resolve(ctx context.Context, params *CompletionItem) (*CompletionItem, error) {
|
2020-03-04 11:29:23 -07:00
|
|
|
var result *CompletionItem
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, "completionItem/resolve", params, &result); err != nil {
|
2018-09-24 15:24:58 -06:00
|
|
|
return nil, err
|
|
|
|
}
|
2020-03-04 11:29:23 -07:00
|
|
|
return result, nil
|
2018-09-24 15:24:58 -06:00
|
|
|
}
|
|
|
|
|
2019-11-17 12:29:15 -07:00
|
|
|
func (s *serverDispatcher) Hover(ctx context.Context, params *HoverParams) (*Hover /*Hover | null*/, error) {
|
2020-03-04 11:29:23 -07:00
|
|
|
var result *Hover /*Hover | null*/
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, "textDocument/hover", params, &result); err != nil {
|
2018-09-24 15:24:58 -06:00
|
|
|
return nil, err
|
|
|
|
}
|
2020-03-04 11:29:23 -07:00
|
|
|
return result, nil
|
2018-09-24 15:24:58 -06:00
|
|
|
}
|
|
|
|
|
2019-11-17 12:29:15 -07:00
|
|
|
func (s *serverDispatcher) SignatureHelp(ctx context.Context, params *SignatureHelpParams) (*SignatureHelp /*SignatureHelp | null*/, error) {
|
2020-03-04 11:29:23 -07:00
|
|
|
var result *SignatureHelp /*SignatureHelp | null*/
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, "textDocument/signatureHelp", params, &result); err != nil {
|
2018-09-24 15:24:58 -06:00
|
|
|
return nil, err
|
|
|
|
}
|
2020-03-04 11:29:23 -07:00
|
|
|
return result, nil
|
2018-09-24 15:24:58 -06:00
|
|
|
}
|
|
|
|
|
2019-11-17 12:29:15 -07:00
|
|
|
func (s *serverDispatcher) Definition(ctx context.Context, params *DefinitionParams) (Definition /*Definition | DefinitionLink[] | null*/, error) {
|
|
|
|
var result Definition /*Definition | DefinitionLink[] | null*/
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, "textDocument/definition", params, &result); err != nil {
|
2018-09-24 15:24:58 -06:00
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return result, nil
|
|
|
|
}
|
|
|
|
|
2019-11-17 12:29:15 -07:00
|
|
|
func (s *serverDispatcher) References(ctx context.Context, params *ReferenceParams) ([]Location /*Location[] | null*/, error) {
|
|
|
|
var result []Location /*Location[] | null*/
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, "textDocument/references", params, &result); err != nil {
|
2018-09-24 15:24:58 -06:00
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return result, nil
|
|
|
|
}
|
|
|
|
|
2019-11-17 12:29:15 -07:00
|
|
|
func (s *serverDispatcher) DocumentHighlight(ctx context.Context, params *DocumentHighlightParams) ([]DocumentHighlight /*DocumentHighlight[] | null*/, error) {
|
|
|
|
var result []DocumentHighlight /*DocumentHighlight[] | null*/
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, "textDocument/documentHighlight", params, &result); err != nil {
|
2018-09-24 15:24:58 -06:00
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return result, nil
|
|
|
|
}
|
|
|
|
|
2020-03-02 15:18:50 -07:00
|
|
|
func (s *serverDispatcher) DocumentSymbol(ctx context.Context, params *DocumentSymbolParams) ([]interface{} /*SymbolInformation[] | DocumentSymbol[] | null*/, error) {
|
|
|
|
var result []interface{} /*SymbolInformation[] | DocumentSymbol[] | null*/
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, "textDocument/documentSymbol", params, &result); err != nil {
|
2018-09-24 15:24:58 -06:00
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return result, nil
|
|
|
|
}
|
|
|
|
|
2019-11-19 06:42:45 -07:00
|
|
|
func (s *serverDispatcher) CodeAction(ctx context.Context, params *CodeActionParams) ([]CodeAction /*(Command | CodeAction)[] | null*/, error) {
|
|
|
|
var result []CodeAction /*(Command | CodeAction)[] | null*/
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, "textDocument/codeAction", params, &result); err != nil {
|
2019-04-23 08:05:23 -06:00
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return result, nil
|
|
|
|
}
|
|
|
|
|
2019-11-17 12:29:15 -07:00
|
|
|
func (s *serverDispatcher) Symbol(ctx context.Context, params *WorkspaceSymbolParams) ([]SymbolInformation /*SymbolInformation[] | null*/, error) {
|
|
|
|
var result []SymbolInformation /*SymbolInformation[] | null*/
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, "workspace/symbol", params, &result); err != nil {
|
2018-09-24 15:24:58 -06:00
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return result, nil
|
|
|
|
}
|
|
|
|
|
2019-11-17 12:29:15 -07:00
|
|
|
func (s *serverDispatcher) CodeLens(ctx context.Context, params *CodeLensParams) ([]CodeLens /*CodeLens[] | null*/, error) {
|
|
|
|
var result []CodeLens /*CodeLens[] | null*/
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, "textDocument/codeLens", params, &result); err != nil {
|
2018-09-24 15:24:58 -06:00
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return result, nil
|
|
|
|
}
|
|
|
|
|
2019-04-23 08:05:23 -06:00
|
|
|
func (s *serverDispatcher) ResolveCodeLens(ctx context.Context, params *CodeLens) (*CodeLens, error) {
|
2020-03-04 11:29:23 -07:00
|
|
|
var result *CodeLens
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, "codeLens/resolve", params, &result); err != nil {
|
2018-09-24 15:24:58 -06:00
|
|
|
return nil, err
|
|
|
|
}
|
2020-03-04 11:29:23 -07:00
|
|
|
return result, nil
|
2018-09-24 15:24:58 -06:00
|
|
|
}
|
|
|
|
|
2019-11-17 12:29:15 -07:00
|
|
|
func (s *serverDispatcher) DocumentLink(ctx context.Context, params *DocumentLinkParams) ([]DocumentLink /*DocumentLink[] | null*/, error) {
|
|
|
|
var result []DocumentLink /*DocumentLink[] | null*/
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, "textDocument/documentLink", params, &result); err != nil {
|
2019-10-11 14:08:39 -06:00
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return result, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *serverDispatcher) ResolveDocumentLink(ctx context.Context, params *DocumentLink) (*DocumentLink, error) {
|
2020-03-04 11:29:23 -07:00
|
|
|
var result *DocumentLink
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, "documentLink/resolve", params, &result); err != nil {
|
2019-10-11 14:08:39 -06:00
|
|
|
return nil, err
|
|
|
|
}
|
2020-03-04 11:29:23 -07:00
|
|
|
return result, nil
|
2019-10-11 14:08:39 -06:00
|
|
|
}
|
|
|
|
|
2019-11-17 12:29:15 -07:00
|
|
|
func (s *serverDispatcher) Formatting(ctx context.Context, params *DocumentFormattingParams) ([]TextEdit /*TextEdit[] | null*/, error) {
|
|
|
|
var result []TextEdit /*TextEdit[] | null*/
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, "textDocument/formatting", params, &result); err != nil {
|
2018-09-24 15:24:58 -06:00
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return result, nil
|
|
|
|
}
|
|
|
|
|
2019-11-17 12:29:15 -07:00
|
|
|
func (s *serverDispatcher) RangeFormatting(ctx context.Context, params *DocumentRangeFormattingParams) ([]TextEdit /*TextEdit[] | null*/, error) {
|
|
|
|
var result []TextEdit /*TextEdit[] | null*/
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, "textDocument/rangeFormatting", params, &result); err != nil {
|
2018-09-24 15:24:58 -06:00
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return result, nil
|
|
|
|
}
|
|
|
|
|
2019-11-17 12:29:15 -07:00
|
|
|
func (s *serverDispatcher) OnTypeFormatting(ctx context.Context, params *DocumentOnTypeFormattingParams) ([]TextEdit /*TextEdit[] | null*/, error) {
|
|
|
|
var result []TextEdit /*TextEdit[] | null*/
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, "textDocument/onTypeFormatting", params, &result); err != nil {
|
2018-09-24 15:24:58 -06:00
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return result, nil
|
|
|
|
}
|
|
|
|
|
2019-11-17 12:29:15 -07:00
|
|
|
func (s *serverDispatcher) Rename(ctx context.Context, params *RenameParams) (*WorkspaceEdit /*WorkspaceEdit | null*/, error) {
|
2020-03-04 11:29:23 -07:00
|
|
|
var result *WorkspaceEdit /*WorkspaceEdit | null*/
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, "textDocument/rename", params, &result); err != nil {
|
2018-09-24 15:24:58 -06:00
|
|
|
return nil, err
|
|
|
|
}
|
2020-03-04 11:29:23 -07:00
|
|
|
return result, nil
|
2018-09-24 15:24:58 -06:00
|
|
|
}
|
|
|
|
|
2020-02-11 08:22:19 -07:00
|
|
|
func (s *serverDispatcher) PrepareRename(ctx context.Context, params *PrepareRenameParams) (*Range /*Range | { range: Range, placeholder: string } | null*/, error) {
|
2020-03-04 11:29:23 -07:00
|
|
|
var result *Range /*Range | { range: Range, placeholder: string } | null*/
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, "textDocument/prepareRename", params, &result); err != nil {
|
2018-09-24 15:24:58 -06:00
|
|
|
return nil, err
|
|
|
|
}
|
2020-03-04 11:29:23 -07:00
|
|
|
return result, nil
|
2018-09-24 15:24:58 -06:00
|
|
|
}
|
|
|
|
|
2019-11-17 12:29:15 -07:00
|
|
|
func (s *serverDispatcher) ExecuteCommand(ctx context.Context, params *ExecuteCommandParams) (interface{} /*any | null*/, error) {
|
|
|
|
var result interface{} /*any | null*/
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, "workspace/executeCommand", params, &result); err != nil {
|
2018-09-24 15:24:58 -06:00
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return result, nil
|
|
|
|
}
|
2020-01-10 15:35:46 -07:00
|
|
|
|
2020-01-27 06:23:25 -07:00
|
|
|
func (s *serverDispatcher) PrepareCallHierarchy(ctx context.Context, params *CallHierarchyPrepareParams) ([]CallHierarchyItem /*CallHierarchyItem[] | null*/, error) {
|
|
|
|
var result []CallHierarchyItem /*CallHierarchyItem[] | null*/
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, "textDocument/prepareCallHierarchy", params, &result); err != nil {
|
2020-01-27 06:23:25 -07:00
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return result, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *serverDispatcher) IncomingCalls(ctx context.Context, params *CallHierarchyIncomingCallsParams) ([]CallHierarchyIncomingCall /*CallHierarchyIncomingCall[] | null*/, error) {
|
|
|
|
var result []CallHierarchyIncomingCall /*CallHierarchyIncomingCall[] | null*/
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, "callHierarchy/incomingCalls", params, &result); err != nil {
|
2020-01-27 06:23:25 -07:00
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return result, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *serverDispatcher) OutgoingCalls(ctx context.Context, params *CallHierarchyOutgoingCallsParams) ([]CallHierarchyOutgoingCall /*CallHierarchyOutgoingCall[] | null*/, error) {
|
|
|
|
var result []CallHierarchyOutgoingCall /*CallHierarchyOutgoingCall[] | null*/
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, "callHierarchy/outgoingCalls", params, &result); err != nil {
|
2020-01-27 06:23:25 -07:00
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return result, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *serverDispatcher) SemanticTokens(ctx context.Context, params *SemanticTokensParams) (*SemanticTokens /*SemanticTokens | null*/, error) {
|
2020-03-04 11:29:23 -07:00
|
|
|
var result *SemanticTokens /*SemanticTokens | null*/
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, "textDocument/semanticTokens", params, &result); err != nil {
|
2020-01-27 06:23:25 -07:00
|
|
|
return nil, err
|
|
|
|
}
|
2020-03-04 11:29:23 -07:00
|
|
|
return result, nil
|
2020-01-27 06:23:25 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *serverDispatcher) SemanticTokensEdits(ctx context.Context, params *SemanticTokensEditsParams) (interface{} /* SemanticTokens | SemanticTokensEdits | nil*/, error) {
|
|
|
|
var result interface{} /* SemanticTokens | SemanticTokensEdits | nil*/
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, "textDocument/semanticTokens/edits", params, &result); err != nil {
|
2020-01-27 06:23:25 -07:00
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return result, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *serverDispatcher) SemanticTokensRange(ctx context.Context, params *SemanticTokensRangeParams) (*SemanticTokens /*SemanticTokens | null*/, error) {
|
2020-03-04 11:29:23 -07:00
|
|
|
var result *SemanticTokens /*SemanticTokens | null*/
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, "textDocument/semanticTokens/range", params, &result); err != nil {
|
2020-01-27 06:23:25 -07:00
|
|
|
return nil, err
|
|
|
|
}
|
2020-03-04 11:29:23 -07:00
|
|
|
return result, nil
|
2020-01-27 06:23:25 -07:00
|
|
|
}
|
|
|
|
|
2020-01-10 15:35:46 -07:00
|
|
|
func (s *serverDispatcher) NonstandardRequest(ctx context.Context, method string, params interface{}) (interface{}, error) {
|
|
|
|
var result interface{}
|
2020-04-07 19:35:47 -06:00
|
|
|
if err := Call(ctx, s.Conn, method, params, &result); err != nil {
|
2020-01-10 15:35:46 -07:00
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return result, nil
|
|
|
|
}
|