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
|
|
|
|
// commit: 635ab1fe6f8c57ce9402e573d007f24d6d290fd3
|
|
|
|
// last fetched Sun Oct 13 2019 10:14:32 GMT-0400 (Eastern Daylight Time)
|
|
|
|
|
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"
|
|
|
|
|
|
|
|
"golang.org/x/tools/internal/jsonrpc2"
|
2019-08-13 13:07:39 -06:00
|
|
|
"golang.org/x/tools/internal/telemetry/log"
|
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
|
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
|
2019-11-17 12:29:15 -07:00
|
|
|
CancelRequest(context.Context, *CancelParams) error
|
2019-09-07 15:01:26 -06:00
|
|
|
Progress(context.Context, *ProgressParams) error
|
2019-04-23 08:05:23 -06:00
|
|
|
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)
|
|
|
|
DocumentSymbol(context.Context, *DocumentSymbolParams) ([]DocumentSymbol /*SymbolInformation[] | DocumentSymbol[] | null*/, error)
|
|
|
|
CodeAction(context.Context, *CodeActionParams) (interface{} /*Command | CodeAction*/ /*(Command | CodeAction)[] | null*/, error)
|
|
|
|
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)
|
|
|
|
PrepareRename(context.Context, *PrepareRenameParams) (interface{} /* Range | struct{; Range Range`json:"range"`; Placeholder string`json:"placeholder"`; } | nil*/, error)
|
|
|
|
ExecuteCommand(context.Context, *ExecuteCommandParams) (interface{} /*any | null*/, error)
|
2018-09-24 15:24:58 -06:00
|
|
|
}
|
|
|
|
|
2019-07-11 10:57:35 -06:00
|
|
|
func (h serverHandler) Deliver(ctx context.Context, r *jsonrpc2.Request, delivered bool) bool {
|
|
|
|
if delivered {
|
|
|
|
return false
|
|
|
|
}
|
2019-10-11 14:08:39 -06:00
|
|
|
if ctx.Err() != nil {
|
|
|
|
ctx := xcontext.Detach(ctx)
|
|
|
|
r.Reply(ctx, nil, jsonrpc2.NewErrorf(RequestCancelledError, ""))
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
2019-10-11 14:08:39 -06:00
|
|
|
}
|
|
|
|
switch r.Method {
|
2019-07-11 10:57:35 -06:00
|
|
|
case "workspace/didChangeWorkspaceFolders": // notif
|
|
|
|
var params DidChangeWorkspaceFoldersParams
|
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
if err := h.server.DidChangeWorkspaceFolders(ctx, ¶ms); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
|
|
|
case "initialized": // notif
|
|
|
|
var params InitializedParams
|
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
if err := h.server.Initialized(ctx, ¶ms); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
|
|
|
case "exit": // notif
|
|
|
|
if err := h.server.Exit(ctx); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
|
|
|
case "workspace/didChangeConfiguration": // notif
|
|
|
|
var params DidChangeConfigurationParams
|
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
if err := h.server.DidChangeConfiguration(ctx, ¶ms); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
|
|
|
case "textDocument/didOpen": // notif
|
|
|
|
var params DidOpenTextDocumentParams
|
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
if err := h.server.DidOpen(ctx, ¶ms); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
|
|
|
case "textDocument/didChange": // notif
|
|
|
|
var params DidChangeTextDocumentParams
|
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
if err := h.server.DidChange(ctx, ¶ms); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
|
|
|
case "textDocument/didClose": // notif
|
|
|
|
var params DidCloseTextDocumentParams
|
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
if err := h.server.DidClose(ctx, ¶ms); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
|
|
|
case "textDocument/didSave": // notif
|
|
|
|
var params DidSaveTextDocumentParams
|
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
if err := h.server.DidSave(ctx, ¶ms); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
|
|
|
case "textDocument/willSave": // notif
|
|
|
|
var params WillSaveTextDocumentParams
|
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
if err := h.server.WillSave(ctx, ¶ms); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
|
|
|
case "workspace/didChangeWatchedFiles": // notif
|
|
|
|
var params DidChangeWatchedFilesParams
|
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
if err := h.server.DidChangeWatchedFiles(ctx, ¶ms); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
2019-11-17 12:29:15 -07:00
|
|
|
case "$/cancelRequest": // notif
|
|
|
|
var params CancelParams
|
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
|
|
|
sendParseError(ctx, r, err)
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
if err := h.server.CancelRequest(ctx, ¶ms); err != nil {
|
|
|
|
log.Error(ctx, "", err)
|
|
|
|
}
|
|
|
|
return true
|
2019-09-07 15:01:26 -06:00
|
|
|
case "$/progress": // notif
|
|
|
|
var params ProgressParams
|
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
|
|
|
sendParseError(ctx, r, err)
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
if err := h.server.Progress(ctx, ¶ms); err != nil {
|
|
|
|
log.Error(ctx, "", err)
|
|
|
|
}
|
|
|
|
return true
|
2019-07-11 10:57:35 -06:00
|
|
|
case "$/setTraceNotification": // notif
|
|
|
|
var params SetTraceParams
|
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
if err := h.server.SetTraceNotification(ctx, ¶ms); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
|
|
|
case "$/logTraceNotification": // notif
|
|
|
|
var params LogTraceParams
|
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
if err := h.server.LogTraceNotification(ctx, ¶ms); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
|
|
|
case "textDocument/implementation": // req
|
2019-09-07 15:01:26 -06:00
|
|
|
var params ImplementationParams
|
2019-07-11 10:57:35 -06:00
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
resp, err := h.server.Implementation(ctx, ¶ms)
|
|
|
|
if err := r.Reply(ctx, resp, err); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
|
|
|
case "textDocument/typeDefinition": // req
|
2019-09-07 15:01:26 -06:00
|
|
|
var params TypeDefinitionParams
|
2019-07-11 10:57:35 -06:00
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
resp, err := h.server.TypeDefinition(ctx, ¶ms)
|
|
|
|
if err := r.Reply(ctx, resp, err); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
|
|
|
case "textDocument/documentColor": // req
|
|
|
|
var params DocumentColorParams
|
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
resp, err := h.server.DocumentColor(ctx, ¶ms)
|
|
|
|
if err := r.Reply(ctx, resp, err); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
|
|
|
case "textDocument/colorPresentation": // req
|
|
|
|
var params ColorPresentationParams
|
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
resp, err := h.server.ColorPresentation(ctx, ¶ms)
|
|
|
|
if err := r.Reply(ctx, resp, err); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
|
|
|
case "textDocument/foldingRange": // req
|
|
|
|
var params FoldingRangeParams
|
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
resp, err := h.server.FoldingRange(ctx, ¶ms)
|
|
|
|
if err := r.Reply(ctx, resp, err); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
|
|
|
case "textDocument/declaration": // req
|
2019-09-07 15:01:26 -06:00
|
|
|
var params DeclarationParams
|
2019-07-11 10:57:35 -06:00
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
resp, err := h.server.Declaration(ctx, ¶ms)
|
|
|
|
if err := r.Reply(ctx, resp, err); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
|
|
|
case "textDocument/selectionRange": // req
|
|
|
|
var params SelectionRangeParams
|
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
resp, err := h.server.SelectionRange(ctx, ¶ms)
|
|
|
|
if err := r.Reply(ctx, resp, err); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
|
|
|
case "initialize": // req
|
2019-11-17 12:29:15 -07:00
|
|
|
var params ParamInitialize
|
2019-07-11 10:57:35 -06:00
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
resp, err := h.server.Initialize(ctx, ¶ms)
|
|
|
|
if err := r.Reply(ctx, resp, err); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
|
|
|
case "shutdown": // req
|
|
|
|
if r.Params != nil {
|
|
|
|
r.Reply(ctx, nil, jsonrpc2.NewErrorf(jsonrpc2.CodeInvalidParams, "Expected no params"))
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
err := h.server.Shutdown(ctx)
|
|
|
|
if err := r.Reply(ctx, nil, err); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2018-09-24 15:24:58 -06:00
|
|
|
}
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
case "textDocument/willSaveWaitUntil": // req
|
|
|
|
var params WillSaveTextDocumentParams
|
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
resp, err := h.server.WillSaveWaitUntil(ctx, ¶ms)
|
|
|
|
if err := r.Reply(ctx, resp, err); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
|
|
|
case "textDocument/completion": // req
|
|
|
|
var params CompletionParams
|
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
resp, err := h.server.Completion(ctx, ¶ms)
|
|
|
|
if err := r.Reply(ctx, resp, err); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
|
|
|
case "completionItem/resolve": // req
|
|
|
|
var params CompletionItem
|
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
resp, err := h.server.Resolve(ctx, ¶ms)
|
|
|
|
if err := r.Reply(ctx, resp, err); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
|
|
|
case "textDocument/hover": // req
|
2019-09-07 15:01:26 -06:00
|
|
|
var params HoverParams
|
2019-07-11 10:57:35 -06:00
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
resp, err := h.server.Hover(ctx, ¶ms)
|
|
|
|
if err := r.Reply(ctx, resp, err); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
|
|
|
case "textDocument/signatureHelp": // req
|
2019-09-07 15:01:26 -06:00
|
|
|
var params SignatureHelpParams
|
2019-07-11 10:57:35 -06:00
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
resp, err := h.server.SignatureHelp(ctx, ¶ms)
|
|
|
|
if err := r.Reply(ctx, resp, err); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
|
|
|
case "textDocument/definition": // req
|
2019-09-07 15:01:26 -06:00
|
|
|
var params DefinitionParams
|
2019-07-11 10:57:35 -06:00
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
resp, err := h.server.Definition(ctx, ¶ms)
|
|
|
|
if err := r.Reply(ctx, resp, err); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
|
|
|
case "textDocument/references": // req
|
|
|
|
var params ReferenceParams
|
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
resp, err := h.server.References(ctx, ¶ms)
|
|
|
|
if err := r.Reply(ctx, resp, err); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
|
|
|
case "textDocument/documentHighlight": // req
|
2019-09-07 15:01:26 -06:00
|
|
|
var params DocumentHighlightParams
|
2019-07-11 10:57:35 -06:00
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
resp, err := h.server.DocumentHighlight(ctx, ¶ms)
|
|
|
|
if err := r.Reply(ctx, resp, err); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
|
|
|
case "textDocument/documentSymbol": // req
|
|
|
|
var params DocumentSymbolParams
|
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
resp, err := h.server.DocumentSymbol(ctx, ¶ms)
|
|
|
|
if err := r.Reply(ctx, resp, err); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
2019-09-07 15:01:26 -06:00
|
|
|
case "textDocument/codeAction": // req
|
|
|
|
var params CodeActionParams
|
2019-07-11 10:57:35 -06:00
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
2019-09-07 15:01:26 -06:00
|
|
|
resp, err := h.server.CodeAction(ctx, ¶ms)
|
2019-07-11 10:57:35 -06:00
|
|
|
if err := r.Reply(ctx, resp, err); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
2019-09-07 15:01:26 -06:00
|
|
|
case "workspace/symbol": // req
|
|
|
|
var params WorkspaceSymbolParams
|
2019-07-11 10:57:35 -06:00
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
2019-09-07 15:01:26 -06:00
|
|
|
resp, err := h.server.Symbol(ctx, ¶ms)
|
2019-07-11 10:57:35 -06:00
|
|
|
if err := r.Reply(ctx, resp, err); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
|
|
|
case "textDocument/codeLens": // req
|
|
|
|
var params CodeLensParams
|
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
resp, err := h.server.CodeLens(ctx, ¶ms)
|
|
|
|
if err := r.Reply(ctx, resp, err); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
|
|
|
case "codeLens/resolve": // req
|
|
|
|
var params CodeLens
|
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
resp, err := h.server.ResolveCodeLens(ctx, ¶ms)
|
|
|
|
if err := r.Reply(ctx, resp, err); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
2019-10-11 14:08:39 -06:00
|
|
|
case "textDocument/documentLink": // req
|
|
|
|
var params DocumentLinkParams
|
2019-07-11 10:57:35 -06:00
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
2019-10-11 14:08:39 -06:00
|
|
|
resp, err := h.server.DocumentLink(ctx, ¶ms)
|
2019-07-11 10:57:35 -06:00
|
|
|
if err := r.Reply(ctx, resp, err); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
2019-10-11 14:08:39 -06:00
|
|
|
case "documentLink/resolve": // req
|
|
|
|
var params DocumentLink
|
2019-07-11 10:57:35 -06:00
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
2019-10-11 14:08:39 -06:00
|
|
|
resp, err := h.server.ResolveDocumentLink(ctx, ¶ms)
|
2019-07-11 10:57:35 -06:00
|
|
|
if err := r.Reply(ctx, resp, err); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
2019-10-11 14:08:39 -06:00
|
|
|
case "textDocument/formatting": // req
|
|
|
|
var params DocumentFormattingParams
|
2019-07-11 10:57:35 -06:00
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
2019-10-11 14:08:39 -06:00
|
|
|
resp, err := h.server.Formatting(ctx, ¶ms)
|
2019-07-11 10:57:35 -06:00
|
|
|
if err := r.Reply(ctx, resp, err); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
2019-10-11 14:08:39 -06:00
|
|
|
case "textDocument/rangeFormatting": // req
|
|
|
|
var params DocumentRangeFormattingParams
|
2019-07-11 10:57:35 -06:00
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
2019-10-11 14:08:39 -06:00
|
|
|
resp, err := h.server.RangeFormatting(ctx, ¶ms)
|
2019-07-11 10:57:35 -06:00
|
|
|
if err := r.Reply(ctx, resp, err); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
2019-10-11 14:08:39 -06:00
|
|
|
case "textDocument/onTypeFormatting": // req
|
|
|
|
var params DocumentOnTypeFormattingParams
|
2019-07-11 10:57:35 -06:00
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
2019-10-11 14:08:39 -06:00
|
|
|
resp, err := h.server.OnTypeFormatting(ctx, ¶ms)
|
2019-07-11 10:57:35 -06:00
|
|
|
if err := r.Reply(ctx, resp, err); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
2019-10-11 14:08:39 -06:00
|
|
|
case "textDocument/rename": // req
|
|
|
|
var params RenameParams
|
2019-07-11 10:57:35 -06:00
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
2019-10-11 14:08:39 -06:00
|
|
|
resp, err := h.server.Rename(ctx, ¶ms)
|
2019-07-11 10:57:35 -06:00
|
|
|
if err := r.Reply(ctx, resp, err); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
2019-10-11 14:08:39 -06:00
|
|
|
case "textDocument/prepareRename": // req
|
|
|
|
var params PrepareRenameParams
|
2019-07-11 10:57:35 -06:00
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
2019-10-11 14:08:39 -06:00
|
|
|
resp, err := h.server.PrepareRename(ctx, ¶ms)
|
2019-07-11 10:57:35 -06:00
|
|
|
if err := r.Reply(ctx, resp, err); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
|
|
|
case "workspace/executeCommand": // req
|
|
|
|
var params ExecuteCommandParams
|
|
|
|
if err := json.Unmarshal(*r.Params, ¶ms); err != nil {
|
2019-07-12 17:26:13 -06:00
|
|
|
sendParseError(ctx, r, err)
|
2019-07-11 10:57:35 -06:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
resp, err := h.server.ExecuteCommand(ctx, ¶ms)
|
|
|
|
if err := r.Reply(ctx, resp, err); err != nil {
|
2019-07-14 21:08:10 -06:00
|
|
|
log.Error(ctx, "", err)
|
2019-07-11 10:57:35 -06:00
|
|
|
}
|
|
|
|
return true
|
|
|
|
|
|
|
|
default:
|
|
|
|
return false
|
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
|
|
|
}
|
|
|
|
|
|
|
|
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-11-17 12:29:15 -07:00
|
|
|
func (s *serverDispatcher) CancelRequest(ctx context.Context, params *CancelParams) error {
|
|
|
|
return s.Conn.Notify(ctx, "$/cancelRequest", params)
|
|
|
|
}
|
|
|
|
|
2019-09-07 15:01:26 -06:00
|
|
|
func (s *serverDispatcher) Progress(ctx context.Context, params *ProgressParams) error {
|
|
|
|
return s.Conn.Notify(ctx, "$/progress", 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*/
|
2019-04-23 08:05:23 -06:00
|
|
|
if err := s.Conn.Call(ctx, "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*/
|
2019-04-23 08:05:23 -06:00
|
|
|
if err := s.Conn.Call(ctx, "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
|
|
|
|
if err := s.Conn.Call(ctx, "textDocument/documentColor", params, &result); err != nil {
|
|
|
|
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
|
|
|
|
if err := s.Conn.Call(ctx, "textDocument/colorPresentation", params, &result); err != nil {
|
|
|
|
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*/
|
2019-04-23 08:05:23 -06:00
|
|
|
if err := s.Conn.Call(ctx, "textDocument/foldingRange", params, &result); err != nil {
|
|
|
|
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*/
|
2019-04-23 08:05:23 -06:00
|
|
|
if err := s.Conn.Call(ctx, "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*/
|
2019-07-11 12:53:13 -06:00
|
|
|
if err := s.Conn.Call(ctx, "textDocument/selectionRange", params, &result); err != nil {
|
|
|
|
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) {
|
2019-04-23 08:05:23 -06:00
|
|
|
var result InitializeResult
|
|
|
|
if err := s.Conn.Call(ctx, "initialize", params, &result); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &result, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *serverDispatcher) Shutdown(ctx context.Context) error {
|
|
|
|
return s.Conn.Call(ctx, "shutdown", nil, nil)
|
|
|
|
}
|
|
|
|
|
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*/
|
2019-04-23 08:05:23 -06:00
|
|
|
if err := s.Conn.Call(ctx, "textDocument/willSaveWaitUntil", params, &result); err != nil {
|
|
|
|
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) {
|
|
|
|
var result CompletionList /*CompletionItem[] | CompletionList | null*/
|
2018-09-24 15:24:58 -06:00
|
|
|
if err := s.Conn.Call(ctx, "textDocument/completion", params, &result); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &result, nil
|
|
|
|
}
|
|
|
|
|
2019-04-23 08:05:23 -06:00
|
|
|
func (s *serverDispatcher) Resolve(ctx context.Context, params *CompletionItem) (*CompletionItem, error) {
|
2018-09-24 15:24:58 -06:00
|
|
|
var result CompletionItem
|
|
|
|
if err := s.Conn.Call(ctx, "completionItem/resolve", params, &result); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &result, nil
|
|
|
|
}
|
|
|
|
|
2019-11-17 12:29:15 -07:00
|
|
|
func (s *serverDispatcher) Hover(ctx context.Context, params *HoverParams) (*Hover /*Hover | null*/, error) {
|
|
|
|
var result Hover /*Hover | null*/
|
2018-09-24 15:24:58 -06:00
|
|
|
if err := s.Conn.Call(ctx, "textDocument/hover", params, &result); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &result, nil
|
|
|
|
}
|
|
|
|
|
2019-11-17 12:29:15 -07:00
|
|
|
func (s *serverDispatcher) SignatureHelp(ctx context.Context, params *SignatureHelpParams) (*SignatureHelp /*SignatureHelp | null*/, error) {
|
|
|
|
var result SignatureHelp /*SignatureHelp | null*/
|
2018-09-24 15:24:58 -06:00
|
|
|
if err := s.Conn.Call(ctx, "textDocument/signatureHelp", params, &result); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &result, nil
|
|
|
|
}
|
|
|
|
|
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*/
|
2018-09-24 15:24:58 -06:00
|
|
|
if err := s.Conn.Call(ctx, "textDocument/definition", params, &result); err != nil {
|
|
|
|
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*/
|
2018-09-24 15:24:58 -06:00
|
|
|
if err := s.Conn.Call(ctx, "textDocument/references", params, &result); err != nil {
|
|
|
|
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*/
|
2018-09-24 15:24:58 -06:00
|
|
|
if err := s.Conn.Call(ctx, "textDocument/documentHighlight", params, &result); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return result, nil
|
|
|
|
}
|
|
|
|
|
2019-11-17 12:29:15 -07:00
|
|
|
func (s *serverDispatcher) DocumentSymbol(ctx context.Context, params *DocumentSymbolParams) ([]DocumentSymbol /*SymbolInformation[] | DocumentSymbol[] | null*/, error) {
|
|
|
|
var result []DocumentSymbol /*SymbolInformation[] | DocumentSymbol[] | null*/
|
2018-09-24 15:24:58 -06:00
|
|
|
if err := s.Conn.Call(ctx, "textDocument/documentSymbol", params, &result); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return result, nil
|
|
|
|
}
|
|
|
|
|
2019-11-17 12:29:15 -07:00
|
|
|
func (s *serverDispatcher) CodeAction(ctx context.Context, params *CodeActionParams) (interface{} /*Command | CodeAction*/ /*(Command | CodeAction)[] | null*/, error) {
|
|
|
|
var result interface{} /*Command | CodeAction*/ /*(Command | CodeAction)[] | null*/
|
2019-09-07 15:01:26 -06:00
|
|
|
if err := s.Conn.Call(ctx, "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*/
|
2019-09-07 15:01:26 -06:00
|
|
|
if err := s.Conn.Call(ctx, "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*/
|
2018-09-24 15:24:58 -06:00
|
|
|
if err := s.Conn.Call(ctx, "textDocument/codeLens", params, &result); err != nil {
|
|
|
|
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) {
|
2018-09-24 15:24:58 -06:00
|
|
|
var result CodeLens
|
|
|
|
if err := s.Conn.Call(ctx, "codeLens/resolve", params, &result); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &result, nil
|
|
|
|
}
|
|
|
|
|
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*/
|
2019-10-11 14:08:39 -06:00
|
|
|
if err := s.Conn.Call(ctx, "textDocument/documentLink", params, &result); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return result, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *serverDispatcher) ResolveDocumentLink(ctx context.Context, params *DocumentLink) (*DocumentLink, error) {
|
|
|
|
var result DocumentLink
|
|
|
|
if err := s.Conn.Call(ctx, "documentLink/resolve", params, &result); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &result, nil
|
|
|
|
}
|
|
|
|
|
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*/
|
2019-04-23 08:05:23 -06:00
|
|
|
if err := s.Conn.Call(ctx, "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*/
|
2019-04-23 08:05:23 -06:00
|
|
|
if err := s.Conn.Call(ctx, "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*/
|
2019-04-23 08:05:23 -06:00
|
|
|
if err := s.Conn.Call(ctx, "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) {
|
|
|
|
var result WorkspaceEdit /*WorkspaceEdit | null*/
|
2019-04-23 08:05:23 -06:00
|
|
|
if err := s.Conn.Call(ctx, "textDocument/rename", params, &result); err != nil {
|
2018-09-24 15:24:58 -06:00
|
|
|
return nil, err
|
|
|
|
}
|
2019-04-23 08:05:23 -06:00
|
|
|
return &result, nil
|
2018-09-24 15:24:58 -06:00
|
|
|
}
|
|
|
|
|
2019-11-17 12:29:15 -07:00
|
|
|
func (s *serverDispatcher) PrepareRename(ctx context.Context, params *PrepareRenameParams) (interface{} /* Range | struct{; Range Range`json:"range"`; Placeholder string`json:"placeholder"`; } | nil*/, error) {
|
|
|
|
var result interface{} /* Range | struct{; Range Range`json:"range"`; Placeholder string`json:"placeholder"`; } | nil*/
|
2019-04-23 08:05:23 -06:00
|
|
|
if err := s.Conn.Call(ctx, "textDocument/prepareRename", params, &result); err != nil {
|
2018-09-24 15:24:58 -06:00
|
|
|
return nil, err
|
|
|
|
}
|
2019-11-17 12:29:15 -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*/
|
2019-04-23 08:05:23 -06:00
|
|
|
if err := s.Conn.Call(ctx, "workspace/executeCommand", params, &result); err != nil {
|
2018-09-24 15:24:58 -06:00
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return result, nil
|
|
|
|
}
|